Events

Report a custom event

Changed on

Reports something that happened in your site or app, such as a signed lease, so tasks, email sequences and webhooks can act on it. Crevio announces it once as custom.<name> (lease.signed becomes custom.lease.signed) and stores nothing but the audit log entry.

Listen for it with a task (trigger_type: "event", event_conditions: {event_type: "custom.lease.signed"}, optionally narrowed by site and by values in data), an email sequence (trigger: {event: "custom.lease.signed"}, which enrolls the event's contact), or a webhook endpoint (enable custom.lease.signed, or custom.* for every custom event).

Sites built on Crevio report events from their mutations with ctx.emit(name, { contact, data }); they are sent only after the mutation succeeds. Send an Idempotency-Key when you retry, so a retry is not announced twice.

post/events

Request

  • Base URL
    https://api.crevio.co/v1
  • Auth
    API key in header Authorization

Headers

Idempotency-Key, string

Makes this write safe to retry: a repeat with the same key replays the first response instead of creating a second resource. Scoped to the account, remembered for 24 hours; reusing a key with a different payload is an error.

Request body

object required
name, string required

What happened, in lowercase words joined by dots, such as lease.signed or booking_request.approved. A leading custom. is accepted and dropped.

contact, string

The contact (con_...) it happened to. Email sequences enroll this contact; without one they ignore the event.

site, string

The site that reported it, by id (site_...) or worker name. Sites built on Crevio send their own. An id that is not one of your sites leaves site null. Tasks can listen to one site's events.

data, object

Details of what happened, up to 8 KB as JSON. Passed through as data to tasks and webhooks; tasks can match on its top-level values.

Example request

{
  "name": "lease.signed"
}

Response

The event was announced

object required
id, string required

Unique id of this report (cev_...). Webhook deliveries and task runs carry it as data.object.id.

object, 'custom_event' required
type, string required

The event type everything listens for: custom. followed by name, such as custom.lease.signed.

name, string required

The name you sent, without the custom. prefix.

contact, string nullable required

The contact (con_...) it happened to, or null.

site, string nullable required

The site (site_...) that reported it, or null.

data, object required

The details you sent.

livemode, boolean required
created_at, string date-time required

Changes