Sendery
Sendery

Events & Workflows

Sending events

Send an event when an action succeeds in your application, such as creating an account or confirming a booking.

Send your first event

Continuing the order example, send order.created to POST /api/v1/events with your project API key. Put your order JSON inside data.

Field What to send
name The registered event name.
object.type The type you registered, such as order.
object.id Your record’s ID as a string.
data The event’s values, including recipient details.

Use the same object type and ID for related events. For example, order.created and order.shipped should identify the same order.

cURL
curl --request POST 'https://sendery.co/api/v1/events' \
  --header "Authorization: Bearer $SENDERY_API_KEY" \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: order-created-1042' \
  --data '{
    "name": "order.created",
    "object": { "type": "order", "id": "1042" },
    "data": {
      "id": "1042",
      "buyer": {"name": "Alex", "email": "[email protected]"},
      "seller": {"name": "Sam", "email": "[email protected]"},
      "price": 49
    }
  }'

Include each recipient’s language

After adding language mappings, include the language codes in your event data. Here the buyer receives Japanese (ja) and the seller English (en). Each language must have a published translation in the template. Omit the language value to use the template’s default.

JSON
{
  "name": "order.created",
  "object": {"type": "order", "id": "1042"},
  "data": {
    "id": "1042",
    "buyer": {"name": "Alex", "email": "[email protected]", "locale": "ja"},
    "seller": {"name": "Sam", "email": "[email protected]", "locale": "en"},
    "price": 49
  }
}

Check the response

202 confirms Sendery accepted the event. matched_workflows shows how many flows started; it is 0 if no active workflow matched. Use GET /api/v1/events/{id} to check its progress.

202 · application/json
{
  "id": "019b0123-1000-7000-8000-000000000001",
  "status": "accepted",
  "matched_workflows": 1
}

Retries and data

Use the same Idempotency-Key when retrying a request to avoid starting the same flow twice. SDKs generate a key for you and reuse it with .retry(). See your SDK guide for an example.

Delayed emails use the data from the original event. Send only the information your emails need; it may be retained while a flow is waiting.