#Events
POST /api/server/v1/:ws/events wakes the agent for one person: your backend
says what happened, or what to tell them, and when. "Task 12 was assigned to
you by Pedro", "the plans for project 430 are in Dropbox", "task 12 is due in
two days", "order #1042 shipped". When it is due, the agent reads it, looks up
the current state with its tools, and writes to the person on
WhatsApp, in its own words. Or it writes nothing, because the task was closed
or the date moved in the meantime; with required: true it always writes.
This is the one way your backend has the agent write to someone. To send your own words or a template as written, with no agent, use Messages.
It takes the same secret key as
Messages, with the messages scope.
curl -X POST https://vatio.ai/api/server/v1/acme/events \ -H "Authorization: Bearer $VATIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": "+56912345678", "event": "Task 12 (Plans for project 430) is due on 2026-11-25. Look it up by its id before writing.", "at": "2026-11-23T09:00:00-03:00", "key": "task-12-reminder" }'News the person must hear, now, whatever the agent finds:
curl -X POST https://vatio.ai/api/server/v1/acme/events \ -H "Authorization: Bearer $VATIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": "+56912345678", "event": "Order #1042 shipped today with Starken, tracking 99812. Tell them, and offer the tracking link.", "required": true, "key": "order-1042-shipped", "template": { "name": "order_shipped", "language": "es", "params": ["Ana", "#1042"] } }'What this replaces in your backend: the daily job that looks for reminders that are due, the column that remembers one was sent, the one that keeps the send's error, and the wording. Your backend says what happened and when; Vatio keeps the time, and the agent keeps the words.
#Events or messages
POST /events | POST /messages | |
|---|---|---|
| Who writes | The agent, in its own words, after checking with its tools | You: your text or a template, exactly as given |
| Whether it goes out | The agent decides; with required: true, always | Always |
| When | Now, or at | Now |
| Several at once for one person | One message for all that fall due together | One message each |
| Channels | WhatsApp, Instagram DMs, comment replies |
Use an event when the agent should write: it judges the news against the
current state, words it for the person, and is ready for the reply. Add
required: true when the person must hear it even if the agent would stay
quiet. Use a message when the words must not change (an amount, a legal
notice, a verification code) or when only a
template will do.
#Body
| Field | ||
|---|---|---|
to | required | The person's WhatsApp number, in international format |
event | required | What happened, or what to tell the person, and how to look it up: a task's id, an order's number. Up to 1,000 characters |
at | optional | When it should reach them, ISO 8601 with its offset. Without it, it goes out within about a minute. A time in the past means now. Up to 400 days ahead |
key | optional | Your name for this event; see Keys. Also taken as the Idempotency-Key header |
required | optional | true: the agent always writes. Without it, the agent may decide there is nothing to say, and the message ends skipped |
template | optional | The approved template to open the conversation with if the person's 24-hour window is closed when it falls due, as in Messages |
external_ref | optional | Your own id. Filter by it with GET /events?external_ref= |
Write event for the agent, not as the message to the person: the agent
writes the message, in the person's language, and only from what the event
says and what its tools return. An event that names the record ("task 12")
lets the agent read where it stands now, so a deadline that moved or a task
someone closed needs nothing from you. Say who the news is from and the agent
passes it on as theirs: "Claude finished: …" goes out as "Claude tells me
that…".
#When it falls due
Within about a minute of at, the events due for one person go to the agent
together, as one turn, oldest first. Four events your backend sent for one
change of a task ("created", "assigned", "due date set", "file attached")
reach the person as one message. An event without at waits 30 seconds for
the others of its burst.
The agent then:
- Checks each event with its tools, wherever it has one for it.
- Writes one message about what still matters, or nothing. When one of the
events is
required, it always writes.
The message waits out the workspace's
quiet hours and waits its turn
behind a conversation in progress. If the person's 24-hour window is closed,
it goes out as your template, or fails with outside_window when the event
has none. The event's message is that message, in the shape of
GET /messages/:id with mode: "agent", and its
status is sent, failed, or skipped when the agent decided there was
nothing to say.
A reply comes to the agent like any other, and the agent knows what the message was about on every later turn.
#Keys
A key names one event. Publishing it again:
- while it is still
scheduledmoves it and rewrites it: sendtask-12-reminderagain with the newatwhen the deadline moves; - after it
failedor wascancelled, schedules it again; - once it was
dispatched, changes nothing, and answers200withIdempotent-Replayed: trueand the event as it stands.
So a retry from a job queue never reaches anyone twice, and a key per
record and purpose (task-12-assigned, task-12-reminder) is all the state
your backend keeps.
DELETE /events?key=task-12-reminder, or DELETE /events/:id, cancels one
still waiting. You rarely need it: an event the agent finds stale is skipped.
#Responses
202: recorded, or still waiting and now rewritten. The body is the event.200withIdempotent-Replayed: true: its key already went out.
{ "id": 812, "status": "scheduled", "source": "api", "environment": "live", "to": "+56912345678", "event": "Task 12 (Plans for project 430) is due on 2026-11-25. Look it up by its id before writing.", "at": "2026-11-23T09:00:00-03:00", "key": "task-12-reminder", "external_ref": null, "template": null, "required": false, "error": null, "dispatched_at": null, "message": null, "created_at": "…", "updated_at": "…"}status:scheduleduntil it falls due;dispatchedonce it is in a message, whichmessageis (the shape ofGET /messages/:id);failedwhen not even a message could start (error.codesays why:outside_windowwith notemplate,opted_out,whatsapp_not_connected…);cancelled.source:apifor yours;toolfor one a tool's answer scheduled,agentfor a reminder the agent set itself,schedulefor a schedule.
#Lists
| Method | Path | |
|---|---|---|
| GET | /events?status=&key=&external_ref=&limit=&before= | Newest first, up to 50; page with before = the next_before of the last page |
| GET | /events/:id | One event |
| DELETE | /events/:id, /events?key= | Cancel one still waiting; 409 event_not_scheduled otherwise |
#Webhooks
What became of the message is in the message webhooks:
message.sent, message.read, message.failed, and message.skipped when the
agent decided not to write. event.failed comes when an event could not even
become a message, with the event in data.event.
#Refusals
| Status | code | |
|---|---|---|
| 409 | too_many_scheduled | This person has 100 events waiting. Give events that replace each other the same key |
| 422 | invalid_recipient | to is not a phone number in international format |
| 422 | event_required, event_too_long | No event, or one over 1,000 characters |
| 422 | invalid_at, at_too_far | at is not ISO 8601, or is more than 400 days away |
| 422 | template_required | A template without name and language |
| 422 | key_too_long | A key over 255 characters |
The rest of what can go wrong is known only when it falls due, and ends the
event failed with the code Messages would have
answered.