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 app | Use |
|---|---|
| decides that something happened | POST /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 inOALO_URL(App environment). From the preview it's a dry run: the reply has"dry_run": trueandwould_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 (scopeevents); write access doesn't include it, andoalo tokens create --name app-events --scope eventsmakes one that can do nothing else. - From your server only. A request a browser makes (it carries an
Originheader) 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.createdandlead.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_refis 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. Withemailorphonetoo, 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.nameis 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_atset) 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 token | 300 events a minute |
| Per workspace | 20,000 events a day (UTC), app events and row events together |
| Names | 100 app.* names per workspace |
| Fields | 50 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
| Status | Code | Why |
|---|---|---|
| 401 | invalid_token | missing or wrong token |
| 403 | forbidden | the token can't send events |
| 403 | browser_request | sent from a browser |
| 413 | too_large | payload over 64 KB |
| 422 | bad_params, unknown_event, too_many_events | see the message |
| 429 | rate_limited, daily_cap | slow down, or wait for tomorrow (UTC) |
What starts a flow or a loop (events, schedules, dates, forms, API calls), what on and off mean, and how one runs another.
The six kinds of credential in Oalo, what each one is for, how to create it, and which ones are safe to put in an app.
Read and write your workspace's data from your own server over HTTP: rows, environments, tokens, bulk writes, the live stream, limits, and mirroring.
How Oalo tracks people. The contact record, tags and custom fields, how contacts are created, customer segments (RFM), and the contact timeline.
Sign up, install the CLI, and deploy your repo in a few minutes.