App events

Start workflows from your app: send an app.* event to POST /api/events/v1, or turn on row events so table changes fire data.<table>.created.

An app tells Oalo what happened (a trial ended, a lesson was completed), and the workspace's workflows react with no new code: send a WhatsApp template or an email, tag the contact, wait three days and nudge. There are two ways in, for two situations:

The appUse
decides that something happenedPOST /api/events/v1 with an app.* name
changes a row in a live table (its own, or an Oalo model)row events on that table

Sending an event

POST $OALO_URL/api/events/v1
Authorization: Bearer $OALO_SYNC_TOKEN
Content-Type: application/json
Idempotency-Key: 6f1c...   (optional: a retry with the same key is answered once)

{
  "name": "app.trial_ended",
  "payload": {"plan": "pro", "days_used": 14},
  "contact": {"external_ref": "user_42", "email": "ana@example.com", "name": "Ana"}
}

The reply is 202 with event_id and contact_id.

  • The token. A server app on Oalo already has one: OALO_SYNC_TOKEN, with the URL in OALO_URL (App environment). From the preview it's a dry run: the reply has "dry_run": true and would_start, the workflows the live app's event would start, and none runs. An app hosted elsewhere uses a Sync API token with Can send events (scope events); write access doesn't include it, and oalo tokens create --name app-events --scope events makes one that can do nothing else.
  • From your server only. A request a browser makes (it carries an Origin header) is refused, because anyone holding the token could start the workspace's workflows.
  • The name is app. and one to three lowercase parts (letters, digits, _): app.trial_ended, app.lesson.completed. Two catalog events can be sent as well, when the app owns that fact: order.created and lead.captured. Give them the fields the catalog lists for them.
  • The payload is a JSON object up to 64 KB. Its top-level keys become the event's fields in the trigger picker, so keep them stable.
  • The contact is optional. external_ref is your own user id, the same one the Conversations API's chat tokens use, so the app's user and their chats are one contact. With email or phone too, a contact found by any of them is used; if none is found, one is made. An email or phone fills in a contact that lacks it and never replaces one it has. name is used only for a new contact.
  • Tags (contact.tags, optional) are CRM tags put on the contact before the event runs, up to 10: "contact": {"email": "ana@example.com", "tags": ["newsletter"]}. A tag the contact already has is skipped, so sending the same signup twice fires Contact tagged once. Tags need a contact to put them on.

Names appear when first sent

There's nothing to declare. The first time an app.* name arrives it is added to the workspace's trigger catalog (category "App"), with the payload's keys as its fields; later sends add any new keys. A trigger can name an app.* event before the app sends it, which is handy while the app's code is being written. oalo emit app.trial_ended --payload '{"plan":"pro"}' sends a test one from the CLI and registers it the same way.

Row events

A change to a live table can start workflows itself: turn on Workflow events in a model's table settings in Data, or for any live table (including one the app made with its own SQL):

oalo data events signups created updated
oalo data events signups --off

Then every change to a live row fires data.<table>.created or data.<table>.updated, whatever wrote it: the app's own SQL through DATABASE_URL, the Sync API, a mobile app's sync, an edit in the dashboard. It's a trigger on the table in the database, so nothing in the app's code has to remember to send it. The payload is the row: a model's fields and id, or the table's columns.

  • Rows in dev never fire them, so testing against dev data starts nothing.
  • A soft delete (deleted_at set) isn't an update, and deletes fire nothing.
  • There is no contact. A workflow that needs one finds it from a field (an email, say).
  • A row over 64 KB carries only its id.

Which to use: row events for "a row changed" (a new signup row, an order row's status). POST /api/events/v1 for facts that aren't one row's change (a trial ended, a lesson was finished), or when the app wants to choose exactly what the workflow sees.

Limits

Per token300 events a minute
Per workspace20,000 events a day (UTC), app events and row events together
Names100 app.* names per workspace
Fields50 per name

Past the daily cap the endpoint answers 429 (daily_cap), and row events are dropped for the day while the writes themselves still succeed. Past 100 names a new name is refused (too_many_events): put the detail in the payload (app.lesson_completed with {"lesson": 3}), not in the name.

Errors

StatusCodeWhy
401invalid_tokenmissing or wrong token
403forbiddenthe token can't send events
403browser_requestsent from a browser
413too_largepayload over 64 KB
422bad_params, unknown_event, too_many_eventssee the message
429rate_limited, daily_capslow down, or wait for tomorrow (UTC)
Related
Try it on your own Base

Sign up, install the CLI, and deploy your repo in a few minutes.

bring your repo