Skip to content

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.

POST/api/v1/automations
  • Console only: owner or admin
  • Workspace: X-Tenant-ID

Headers

  • Cookiestringrequired

    The whatsappx_session cookie the app sets when you sign in. Browsers send it automatically; API keys are not accepted on this endpoint.

    Example
    whatsappx_session=…
  • X-Tenant-IDuuidrequired

    Workspace id. Required for session requests. You can pass ?tenant=<id> instead.

    Example
    8d0f6c2e-3b1a-4c55-9a7e-2f4b6d1e9c30

Body

application/json
  • namestringrequired

    Rule name.

    Constraints
    2–100 characters.
    Example
    Opening hours
  • keywordstringrequired

    Keyword to look for. Stored in lower case.

    Constraints
    1–100 characters.
    Example
    hours
  • replystringrequired

    Text to send back.

    Constraints
    1–4096 characters.
    Example
    We are open Monday to Saturday, 9 am to 6 pm.
  • enabledbooleanoptional

    Whether the rule is active right away.

    Default
    false
    Example
    true

Response

201 Createdapplication/json

  • iduuid

    Automation id.

  • namestring

    Rule name.

  • keywordstring

    Keyword, stored in lower case.

  • replystring

    Text sent back when the keyword matches.

  • enabledinteger

    1 when the rule is on, 0 when it is off.

  • runsinteger

    How many times the rule has replied.

  • created_atinteger

    Creation 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 characters or invalid 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 gets admin required; a user who is not a member of the workspace gets forbidden.

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 price also matches “prices?”.
  • If several rules match, the oldest enabled rule wins and only one reply is sent.
  • Each reply increments the rule’s runs counter.