Skip to main content
A message is a communication in either direction: outbound (sent from the channel’s number, through the API or, on channels in coexistence mode, from the WhatsApp Business app) or inbound (received from a customer). It does not depend on the provider: the same object serves any channel, present or future.

The message object

Use metadata to link the message to your domain, such as the order ID. It is returned when you retrieve the message and in its events.

Content removed by retention

Routa keeps the content of a message for a period that depends on your plan. After that, the content is removed: content becomes null and content_redacted_at gives the time of the removal. The rest of the message stays, including metadata.
Treat content as optional when you read old messages. The removal is permanent: extending retention later does not bring the content back. The message.* events already delivered do not change. See Data retention.

Lifecycle

202 Accepted on creation only means accepted. Delivery happens later, asynchronously. Treat the message as delivered only when you receive delivered.

The status never goes back

Providers send status updates out of order and more than once. Routa only applies a transition that moves forward in the cycle, so a message never goes from read back to sent because an old notice arrived late. You can write if (message.status === 'delivered') with no defensive ordering logic. failed is accepted only while the message has not been delivered yet (accepted or sent).

Retries are not a status

If the provider fails temporarily, Routa tries again on its own, with growing delays. Meanwhile the message stays accepted. There is no queued or retrying status in the public API. If the attempts run out, the message becomes failed. The reason shows up in the message timeline in the dashboard.

Failure reasons

failure_code explains why the message became failed. It is never a provider code.
The set can grow. Treat an unknown value as a generic failure and use failure_code only to decide what to show or log.

Inbound messages

An inbound message starts with direction: "inbound" and status: "delivered", and produces the message.received event. To tell the sender you read it, use POST /v1/messages/{id}/read, which moves the message to read. A content type Routa cannot model yet, such as interactive or contacts, arrives as { "type": "unsupported" }: the message exists and produces message.received. Two inbound things are ignored on purpose: reactions and system notices, such as a contact changing their number. They create no message, produce no message.received and do not count as usage.

Messages sent from the WhatsApp Business app

On a channel connected in coexistence mode, the number stays in the WhatsApp Business app. What the business sends from the app, or from a linked device, also shows up in the API.
  • The message is outbound, with origin: "business_app". Routa did not send it: it only records it.
  • It starts as sent, without going through accepted. The only event is message.sent, with no message.accepted. accepted_at and sent_at mark the moment the business sent it.
  • Later status changes (message.delivered, message.read and message.failed) arrive as usual.
  • It uses none of your allowance and does not appear in GET /v1/usage.
  • to is the number in E.164 format. When the provider only reports an identifier of the person, to carries that identifier instead of a number. The same customer, by number and by identifier, appears as two conversations.
  • If the business edits the text or the caption in the app, content is updated. If it deletes the message, content becomes null and content_redacted_at records the moment. Neither produces an event.

Imported history

When the channel is connected, Routa silently imports the conversations the business already had in the app. These messages appear in GET /v1/messages and GET /v1/messages/{id}, but:
  • They produce no event or webhook, use none of your allowance and do not count as usage.
  • accepted_at is the original time of the message, so the order follows real time. Those sent by the business have origin: "business_app", and the received ones, origin: null.
  • Content older than your plan’s retention already arrives with content: null and content_redacted_at.
  • Only text and location carry content. Images, audio, videos and documents arrive as { "type": "unsupported" }.

Content types

The content field is an object discriminated by type.
Today POST /v1/messages sends only text and template. The other types, except reaction, appear in inbound messages and in the history, and you can read them as usual. To download the media of a message, use its media_id in GET /v1/media/{id}.

Template content

The content keeps the values as you sent them:
Both keys are absent when the template asks for nothing there, and on old messages. See Header and buttons.

Validation at accept time

Routa validates the message when it accepts it, not when it sends it. This turns predictable problems into an immediate 422 error instead of a message.failed seconds later:
  • The channel must be active (channel_inactive).
  • The channel must support the content type (capability_unsupported).
  • The recipient must be a valid number (invalid_recipient).
  • A template must be approved and sendable (template_not_approved, template_paused, template_not_sendable).
  • The body, header and button parameters must be exactly what the template asks for (content_rejected).
  • The file of a media header must belong to this project, be available and have an accepted type (media_not_found, media_not_ready, media_content_type_rejected).
  • Provide text or template. With neither, the API responds content_rejected. With both, it sends the template and ignores text.
See every code in Error codes.