Automations

Set MAILCOACH_API_URL and MAILCOACH_TOKEN as shown in Authentication. Automations are built in the Mailcoach interface; the API can start one for existing subscribers. To manage the emails an automation sends, use the Automation mails endpoints.

Trigger an automation

The automation must have a Webhook trigger. Pass the UUIDs of the subscribers to start it for:

curl -X POST "$MAILCOACH_API_URL/automations/9bbdca04-a68f-3bfd-b3c9-e2be829c5f23/trigger" \
    -H "Authorization: Bearer $MAILCOACH_TOKEN" \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{"subscribers":["2a0c72d9-f91a-4fd2-88a7-589dfd75f464"]}'

A 200 response means the automation was started for each subscriber; the first actions run in the background. Calling this does not create or change the automation’s workflow.

Error handling

  • 400: the automation has no Webhook trigger.
  • 404: the automation UUID doesn’t exist in your account.
  • 422: subscribers is missing, or contains a UUID that doesn’t match a subscriber.