Keyword automations
Create a keyword-triggered automation draft.
Create keyword automation
POST
automations:writeIdempotency-Key required/v1/automations/keyword/Parameters
| Name | In | Type | Notes |
|---|---|---|---|
Idempotency-Keyrequired | header | string (uuid) | UUID4 identifying one intended write. Reuse it only when retrying that same write. |
Request body
| Field | Type | Notes |
|---|---|---|
active_hours | object | null | — |
active_hours.windowsrequired | object[] | max 14 items |
active_hours.windows[].dayrequired | string | one of MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY |
active_hours.windows[].endrequired | string | max length 5 |
active_hours.windows[].startrequired | string | max length 5 |
assigned_member_id | integer | null | — |
comment_type | string | one of ANY_POST, SPECIFIC_POST |
future_post_slots | integer | — |
is_activerequired | boolean | — |
keywords | string[] | max 20 items |
match_mode | string | one of contains, is_exactly |
media_ids | string[] | max 50 items |
namerequired | string | max length 255 |
once_per_lead | boolean | — |
override_existing_assignment | boolean | — |
repliesrequired | object[] | max 20 items |
replies[].ai_prompt | string | max length 2000 |
replies[].ask_email_timeout_seconds | integer | — |
replies[].delay | integer | — |
replies[].file_id | string (uuid) | null | — |
replies[].media_kind | string | one of IMAGE, VIDEO, AUDIO |
replies[].reply_type | string | one of DM, COMMENT, ASK_EMAIL, MEDIA |
replies[].text | string | max length 1000 |
replies[].variant_pairing | string | one of INDEPENDENT, FOLLOW_PREVIOUS |
replies[].variants | object[] | max 10 items |
replies[].variants[].buttons | object[] | max 3 items |
replies[].variants[].buttons[].button_type | string | one of URL, POSTBACK |
replies[].variants[].buttons[].namerequired | string | max length 20 |
replies[].variants[].buttons[].payload | string | null | max length 1000 |
replies[].variants[].buttons[].url | string | null | max length 2000 |
replies[].variants[].file_id | string (uuid) | null | — |
replies[].variants[].media_kind | string | one of IMAGE, VIDEO, AUDIO |
replies[].variants[].text | string | max length 1000 |
replies[].variants[].traffic_percentage | integer | — |
set_stage | string | null | one of NEW, IN_CONTACT, QUALIFIED, UNQUALIFIED, BOOKED_CALL, DEPOSIT, WON, LOST, NO_SHOW |
tags | string[] | max 50 items |
tags_to_remove | string[] | max 50 items |
triggers | object[] | max 10 items |
triggers[].comment_type | string | null | one of ANY_POST, SPECIFIC_POST |
triggers[].future_post_slots | integer | — |
triggers[].keywordsrequired | string[] | max 20 items |
triggers[].lead_filter | object | null | — |
triggers[].match_mode | string | one of contains, is_exactly |
triggers[].media_ids | string[] | — |
triggers[].trigger_typerequired | string | one of DM, COMMENT, STORY |
Response fields (201)
| Field | Type | Notes |
|---|---|---|
active_hours | object | read-only |
active_hours.windows | object[] | read-only |
active_hours.windows[].day | string | read-only |
active_hours.windows[].end | string | read-only |
active_hours.windows[].start | string | read-only |
comment_type | string | read-only |
created_at | string (date-time) | read-only |
id | string | read-only |
is_active | boolean | read-only |
name | string | read-only |
once_per_lead | boolean | read-only |
reply_count | integer | read-only |
set_stage | string | null | read-only |
trigger_count | integer | read-only |
trigger_type | string | read-only |
Responses
201Success400The request is invalid.401Authentication is missing, invalid, or revoked.403The authenticated identity lacks the required scope or capability.404The resource is unavailable or not visible to this organization.409The write conflicts with current state or an identical request is still running.422The write contains fields outside its closed input schema.429The request-rate budget is exhausted.
Example request
curl
curl -X POST "https://api.themochi.app/v1/automations/keyword/" \
-H "Authorization: Bearer $MOCHI_API_KEY" \
-H "Idempotency-Key: $(uuidgen | tr A-Z a-z)" \
-H "Content-Type: application/json" \
-d '{"is_active":true,"name":"string","replies":[{"ai_prompt":"string","ask_email_timeout_seconds":1,"delay":1,"file_id":"00000000-0000-4000-8000-000000000000","media_kind":"IMAGE","reply_type":"DM","text":"string","variant_pairing":"INDEPENDENT","variants":[{}]}]}'