auto_write
orders

Send customer events from your own backend (a lesson completed, a trial started), one or a batch of up to 500, for custo

Changed on

Send customer events from your own backend (a lesson completed, a trial started), one or a batch of up to 500, for customer messaging flows to act on. Each event is answered with its outcome: applied, duplicate (that id was already stored; nothing new), rejected_schema (with the field), rejected_unknown_customer (Magistry has no customer with that external id) or suppressed_erasure (the customer was erased). Requires an idempotency key, which also becomes the event id when an event has none; a retry with the same key answers duplicate with the same id. Stores data only: nothing is sent to the customer by this call. Also served at /api/v1/events.

The same operation as /api/v1/tools/cm_events_track.

post/api/v1/events

Request

  • Base URL
    https://app.magistry.io
  • Auth
    • HTTP bearer
    • or OAuth 2
      Authorization codehttps://app.magistry.io/api/oauth/authorize
      Token URLhttps://app.magistry.io/api/oauth/token
      Scopesorders:write

Headers

Idempotency-Key, string

Required, here or as idempotency_key in the body. A unique string you choose for this request; send the SAME key when retrying and the first answer is returned instead of writing twice (idempotent-replayed: true). The same key with other arguments is 409 idempotency_conflict. If the header and idempotency_key are both sent they must be equal.

Request body

object required
events, object[]

A batch. Or send one event's fields at the top level instead.

id, string

Your own id for this event. Default: the Idempotency-Key (with :<index> in a batch). The same id again is a duplicate, never a second event.

customer_external_id, string

The customer's id in your system: the external_id Magistry holds for them.

name, string

The event, in lower snake_case, e.g. lesson_completed.

occurred_at, string date-time

When it happened, with a time zone.

properties, object

Anything about the event, at most 4 KB as JSON.

idempotency_key, string required

Required. A unique string you choose for this request. Send the SAME key when retrying after a timeout and Magistry returns the original outcome instead of performing the write twice. Reusing a key with different arguments is refused rather than replayed.

Response

Tool result

object required
ok, boolean required
result, unknown required

Changes