POST /v1/messages reaches one person. You say who, what, and — through its steps —
which channels to try in which order and what counts as getting there on each. OMNI tries
the first; if it can’t take the message, doesn’t deliver it in time, or the person
doesn’t read it in time, the next one goes.
202 Accepted with the message as it stands — usually its first attempt
already made. What happens next arrives as webhooks, and
GET /v1/messages/{message_id} tells the whole story at any time.
Steps: which channels, in what order
A message carries up to six steps. Each step names a channel, what counts as done on it, and how long to wait:within is in seconds, from 30 to 7 days; 15 minutes when left out. A step can only wait
for what its channel reports — asking SMS for read is refused.
A message without steps is tried on the channels your account has on, in OMNI’s order
— WhatsApp, then SMS, then your other channels — each done when delivered (or sent, where
the channel doesn’t report delivery), within 15 minutes.
Saved routes (
/v1/routes) were removed: those endpoints answer 410 gone. Give the
steps in each message instead.Calls as a step
When your account has Voice, the last step can be a call: WhatsApp, then SMS, then ring them into an IVR, done when answered.POST /v1/calls — screened for
consent the same way — and the attempt carries its call id. A message without steps is
never turned into a phone call: calls happen only when a step asks for one.
How a step hands over
A step is refused, for example, when WhatsApp’s 24-hour window is closed and no
approved template was given (
window_closed), when an SMS’s text fills in none of your
registered DLT templates (no_dlt_match), when nothing was written for that channel
(no_content), when the channel is off (channel_off), when the balance can’t cover it
(insufficient_balance), when an account below a reseller has no units of that type
(no_units), or when the provider says no (provider_refused). The account and money
codes are the same on every channel; see Errors.
If a channel gets there after its step has timed out, that is recorded on its attempt
— but nothing is sent again.
What to send: templates and content
A unified template is one message written once per channel, with{{values}}:
"template": "order_shipped" and its "values". A message missing a value
the template needs is refused before anything is sent. You can also give content per
channel instead of a template — or as well, to change one part of it:
WhatsApp media and buttons
Inside the 24-hour window, a WhatsApp step can send more than text. Give one of these withtext; if you give several, media goes first, then a list, then buttons.
Outside the window, WhatsApp only allows an approved template. Give
template as well,
as above, and that goes instead. Without one the step is refused (window_closed) and
the next step runs.
A step is also refused when the link can’t be fetched, isn’t public or is too large
(media_unavailable), or when the buttons or list break WhatsApp’s limits
(invalid_content).
Consent and quiet hours
Every attempt is screened like any message OMNI sends:- Someone who asked never to be contacted, or opted out of everything, is never
tried on any channel: the message fails with
not_permitted. - A channel they opted out of is skipped: that step is refused with
not_permitted. - During their quiet hours the message waits (
postponed) and is tried when they end. "purpose": "marketing"applies marketing consent;transactional(the default) applies the rules for messages people expect.
How a message ends
Each attempt points at the message it sent on its channel (
cm_…), whose own deliveries
arrive as channel_message.* events.
Charging. Every attempt a channel actually took is a message sent on that channel
and is charged like one. Refused steps cost nothing. A step the balance can’t cover is
refused with
insufficient_balance (no_units for an account below a reseller that has
no units of that type, reseller_paused when its reseller’s money has run out), and the
next step runs. A test key’s messages reach
no channel and cost nothing.Test keys
With anff_test_… key, a message succeeds at once on its first step with the code
test, and nothing reaches any phone — so you can build the whole flow, webhooks
included, before going live.