Data events: record what a contact did (upgraded-plan, invited-teammate) so it shows on their profile and can drive segments and messages.
Context Vars
intercom.token
Functions
build-event-body
fn (event-name: Str, contact: Map, options: Map): Map
Build a data event body. contact identifies who did it: one of
{id} (Intercom id), {user_id} or {email}. options:
created_at (Unix seconds; defaults to now), metadata (a flat Map
of Str/number/Bool values, or rich {url, value} / {amount, currency} objects). Unset fields are omitted. Exposed for testing.
Example
::intercom::events/build-event-body("upgraded-plan", {email: "ada@example.com"}, {created_at: 1767225600})
// {event_name: "upgraded-plan", created_at: 1767225600, email: "ada@example.com"}
list-events
fn (contact: Map): Any
fn (contact: Map, options: Map): Any
fn (contact: Map, options: Map, opts: Map): Any
GET /events - A contact's events from the last 90 days. contact:
{intercom_user_id}, {user_id} or {email}; options: type
("user" by default, or "lead"), per_page, since/before (Unix
seconds), summary (Bool: counts per event name instead of the events).
Example
out ::intercom::events/list-events({email: "ada@example.com"}, {per_page: 50})
map(out.events, %.event_name)
// Counts per event name
::intercom::events/list-events({user_id: "user-42"}, {summary: true})
submit-event
fn (event-name: Str, contact: Map): Any
fn (event-name: Str, contact: Map, options: Map): Any
fn (event-name: Str, contact: Map, options: Map, opts: Map): Any
POST /events - Submit a data event. Intercom answers 202 with an empty body, so success returns null.
Example
::intercom::events/submit-event("upgraded-plan", {email: "ada@example.com"}, {metadata: {plan: "enterprise", seats: 25}})