Automations
Create an automation
Creates a keyword rule that replies automatically to matching incoming messages. Only owners and admins signed in to the app can create rules; API keys get 403.
- Console only: owner or admin
- Workspace:
X-Tenant-ID
Headers
CookiestringrequiredThe
whatsappx_sessioncookie the app sets when you sign in. Browsers send it automatically; API keys are not accepted on this endpoint.X-Tenant-IDuuidrequiredWorkspace id. Required for session requests. You can pass
?tenant=<id>instead.
Body
application/jsonnamestringrequiredRule name.
keywordstringrequiredKeyword to look for. Stored in lower case.
replystringrequiredText to send back.
enabledbooleanoptionalWhether the rule is active right away.
Response
201 Createdapplication/json
iduuidAutomation id.
namestringRule name.
keywordstringKeyword, stored in lower case.
replystringText sent back when the keyword matches.
enabledinteger1when the rule is on,0when it is off.runsintegerHow many times the rule has replied.
created_atintegerCreation time in Unix seconds.
Status codes
- 201Created. The new automation.
- 400Bad request.
name must be 2–100 characters,provide a keyword (1–100 characters),provide a reply up to 4096 charactersorinvalid body. - 401Unauthorized. No signed-in session (
unauthorized). - 403Forbidden. API keys can never call this endpoint (
API keys cannot administer workspaces). A signed-in user who is not an owner or admin getsadmin required; a user who is not a member of the workspace getsforbidden.
How are automations matched?
- Every incoming message (not your own) is lower-cased and checked against the enabled automations.
- A rule matches when its keyword appears anywhere in the message text, so the keyword
pricealso matches “prices?”. - If several rules match, the oldest enabled rule wins and only one reply is sent.
- Each reply increments the rule’s
runscounter.