Zum Inhalt springen

Push an event to trigger automations

POST
/automations/trigger
Code sample: Shell / cURL
curl --request POST \
--url https://rocketem.fotone.io/api/v2/automations/trigger \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "email": "customer@example.com", "event": "purchase", "data": { "order_id": "12345", "total": 99.9 } }'

Required scope: automations:trigger

Push an event that starts the automations with the trigger “API Push”. An automation starts when its event name is empty or equals event, and when it works on the audience named by audience_id (without it: every audience).

The answer says how many automations the event starts (automations). ignored with automations: 0 means no active automation matches the event name and audience; nothing is queued.

data is yours: at most 50 fields and 8192 bytes as JSON. Its fields are available as placeholders in the e-mails of the automation and in its conditions (group “Event”). None of its fields acts as a filter.

Requires automations:trigger scope. Without the automations feature: 403 feature_not_available.

Idempotency-Key
string
<= 255 characters

Unique key for idempotent requests. Responses cached 24h.

Media typeapplication/json
object
email
required

Recipient email address

string format: email
event

Event name (e.g. purchase, signup)

string
<= 100 characters
audience_id

Numeric id of the audience whose automations the event starts (0 = the newsletter); without it every audience

integer
data

Your own event data, at most 8192 bytes as JSON

object
<= 50 properties
key
additional properties
any

Example

{
"email": "customer@example.com",
"event": "purchase",
"data": {
"order_id": "12345",
"total": 99.9
}
}

Event dispatched or ignored

Media typeapplication/json
object
status
string
Allowed values: dispatched ignored
automations

Number of automations the event starts

integer
message
string

Examples

{
"status": "dispatched",
"automations": 1,
"message": "Automation event queued for processing"
}

Token without the scope, IP not allowed, or the automations feature is missing (feature_not_available)

Media typeapplication/json
object
error
object
code
string
message
string
status
integer

Example generated

{
"error": {
"code": "example",
"message": "example",
"status": 1
}
}

Invalid call: no e-mail address, more than 50 fields or more than 8192 bytes in data

Media typeapplication/json
object
error
object
code
string
message
string
status
integer

Example generated

{
"error": {
"code": "example",
"message": "example",
"status": 1
}
}