Automations

Create a new automation

POST
/api/automations

Creates a new Automation in the caller organization. The trigger logic (event vs timer), conditions, schedule and actions are all configurable. The enabled field in the body sets the calling user's per-automation preference at creation time (defaults to true); it does NOT set a global enabled flag on the Automation itself, and other users start with no preference until they call PATCH /{id}/preference.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/api/automations" \  -H "Content-Type: application/json" \  -d '{    "name": "Follow-up after 24h",    "description": "Send a follow-up SMS if the lead has not replied in 24h.",    "event": "message.received",    "actions": {      "sendMessage": [        {          "template": "follow-up-24h",          "channel": "sms"        }      ]    },    "sourceStatuses": [      "New lead"    ],    "triggerType": "status_change",    "triggerLogicType": "timer",    "timerLogic": {      "enabled": true,      "delay": 24,      "unit": "hours"    },    "schedule": {      "start": "09:00",      "end": "18:00"    },    "maxFollowUpCount": 3  }'
{  "success": true,  "message": "Automation created successfully",  "data": {    "_id": "64d2f9c5e8a1d4e001a0b1c2",    "name": "Follow-up after 24h",    "description": "Send a follow-up SMS if the lead has not replied in 24h.",    "triggerLogicType": "timer",    "enabled": false  }}