Custom Events
Custom events let you tell Arsel about things that happen in your product or systems — an order completed, a trial started, a feature used — and act on them: trigger automations, segment contacts, and personalize messaging.
A custom event has two parts:
- A definition — a named schema you create once (e.g.
order.completedwith the fields it carries). - Sends — individual occurrences you report against that definition for a specific contact.
How it works
Define event ──► Send events ──► Validate against schema ──► Trigger automations
(once) (per occurrence) (accepted / rejected) (in real time)
- You define the event and its field schema — once, up front.
- Your application sends an event each time it happens, identifying the contact and attaching a data payload.
- Arsel validates the payload against the schema. Accepted events are recorded; payloads that don't match are rejected.
- Automations subscribed to the event fire for the matching contact.
Defining an event
An event definition has:
- Name — a unique identifier for your organization, such as
order.completedortrial.started. The name is immutable once created. - Description — optional, human-readable.
- Schema — a list of fields each event payload may (or must) include. Each field has a
name, atype(string,number,boolean, ordate), and whether it isrequired.
You can manage event definitions from the Arsel dashboard, or via the API — see Create Event.
A noun.verb convention (order.completed, subscription.cancelled) keeps events readable and groups related events together.
Sending events
Each send identifies the contact in one of two ways:
email— if no contact with that email exists yet, one is auto-created when the automation runs.contact_id— an existing contact's ID.
Provide exactly one. The send also carries a data payload, which is validated against the event's schema. See Send Event for the API.
Validation
When a payload is sent:
- Required fields must be present.
- Field types must match the schema (
numberfields must be numbers, etc.).
If validation fails, the event is rejected and recorded as such — it does not trigger automations. If it passes, it is accepted and processed asynchronously.
Triggering automations
Once an event is defined, you can build an automation that starts whenever that event is received. The event's payload fields are available downstream in the automation, so you can branch on them or use them in messaging.
Next steps
- Create Event — define an event via the API
- Send Event — report an occurrence
- List Events — see your defined events