Automation Triggers

Start one of your automations from your own systems. Turn on **When called from outside** in the automation's trigger, and post JSON to its webhook URL.

Start an automation
POST /webhooks/workflow/{webhookId}

The Automation Trigger object

Returned by the automation triggers endpoints.

Attributes
runIdstring
The ID of the new run. Search for it on the **Automation runs** page.
statusenum
Always `pending`: the run is queued and its steps run in the background.pending
The Automation Trigger object
{
  "runId": "6711a0c4d2e3f4a5b6c7d8e9",
  "status": "pending"
}

Start an automation

POST https://api.trycareflow.com/webhooks/workflow/{webhookId}

Starts one run of the automation that owns this webhook, and returns straight away while the steps run in the background. Follow the run on the **Automation runs** page. The webhook ID in the address is the only credential, so keep the full URL secret, like an API key. Careflow doesn't sign or check anything else on these requests. To stop a leaked URL from working, turn off **When called from outside** in the automation's trigger and save. Turning it on again later gives a new URL. The body becomes the run's input. Send a JSON object, and name its fields under **What the run starts with** so steps can use them as `{{name}}`. A body that isn't a JSON object arrives as text in a field called `raw`. Careflow also adds `_webhook_id`, and the request's headers under `_webhook_headers`, so keep credentials out of your headers. Every call starts a new run. If your system might send the same event twice, include your own ID in the body and check it in the automation.

Path parameters
webhookIdstringrequired
The webhook ID, shown in the automation's trigger under **Your webhook**.
curl https://api.trycareflow.com/webhooks/workflow/9c4e2a7b1f6d3e8a0b5c7d9e2f4a6b8c
const Automation trigger = await careflow.automationtriggers.create('9c4e2a7b1f6d3e8a0b5c7d9e2f4a6b8c')
Response
{
  "code": "SUCCESS",
  "message": "webhook received",
  "data": {
    "runId": "6711a0c4d2e3f4a5b6c7d8e9",
    "status": "pending"
  }
}
{
  "code": "ERROR",
  "message": "webhook not found or disabled"
}
{
  "code": "ERROR",
  "message": "too_many_requests",
  "error": "You have exceeded the rate limit for public. Please try again in 8s."
}
{
  "code": "ERROR",
  "message": "failed to initiate run"
}