Documentation

Events

Record a named event for one address and start every active automation whose trigger waits on it.

An event is a name your app emits when something happens to a person, such as trial_started or invoice_overdue. Recording one enrols that address in every active automation with an event trigger for that name. Your app makes one call and does not need to know which sequences exist, and a sequence can be added or retired without changing the app. See Automations for how this fits with the other triggers.

Events are not stored. An event that no automation is waiting for does nothing and is not an error, and an automation created later is not started by events recorded before it. The exception is an event whose name is a conversion goal: it is also recorded as a conversion and credited to the email that earned it.

Record an event

POST /v1/events · requires emails:send

Finds every automation in the workspace whose status is active, whose trigger kind is event, and whose event_name equals name exactly, including case. The address is enrolled in each of them just as Enrol someone would: each automation's automatic exits still apply, someone already active in an automation is not enrolled a second time, and an automation whose reenrollment is never does not enrol someone who has been through it before.

The response counts only the automations that actually enrolled the person. An exclusion, an existing active enrolment, or an automation that cannot enrol anyone is not reported individually; automations_started is simply lower. Check the person's enrolments on Retrieve an automation when a number is not what you expected.

The calling key's guardrails apply as they do to enrolling directly, and are checked before any automation is looked up: a key that holds its sends for approval cannot record events (403 forbidden), and a key with a recipient allowlist can record them only for addresses on it (403 recipient_not_allowed). A key's daily limit is not checked, and the steps the automations send do not count against it.

Body

FieldTypeRequiredDefaultDescription
namestringyes1 to 120 characters. Matched exactly against each automation's trigger.event_name.
emailstringyesA single email address.
variablesobjectno{}String values for the placeholders in the automations' steps, passed to every enrolment this event starts. Every value must be a string.
idstringnoYour own id for the event, such as an invoice id, up to 200 characters. When name is a conversion goal, a second event with the same id records nothing new and answers the first conversion's id. Ignored otherwise.
valuenumbernoWhat the conversion was worth, as a decimal (49.99), 0 or more. Requires currency. Ignored unless name is a conversion goal.
currencystringnoThe ISO 4217 code for value, such as USD. Stored upper case. Requires value.

Example

curl -X POST https://api.sendraven.ai/v1/events \
  -H "Authorization: Bearer $SENDRAVEN_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "name": "trial_started", "email": "ana@example.com", "variables": { "name": "Ana" } }'

Response

200 OK

{ "event": "trial_started", "automations_started": 2, "conversion_id": null }

conversion_id is the conversion this event recorded when name is a conversion goal, and null otherwise. It starts pending and is credited a few seconds later; read it with Retrieve a conversion.

Errors

StatusTypeWhen
403forbiddenThe calling key holds its sends for approval.
403recipient_not_allowedThe calling key has a recipient allowlist and email is not on it.
422invalid_requestname or email is missing or invalid, variables is not an object of strings, or value and currency were not sent together. The message names each field that failed, and details lists them.

On this page