Skip to main content
When a customer writes to your number, Routa normalizes the message, stores it with direction: "inbound" and produces the message.received event. You do not deal with the provider payload, or with verifying the provider’s webhook.
Required scopes: webhooks:write to register the endpoint, messages:read to retrieve messages and media:read to download media.

Receive by webhook

1

Register an endpoint

Create an HTTPS endpoint that subscribes to message.received.
The returned secret is used to verify the signature of each delivery. It is shown only on creation (and on rotation).
2

Verify and process the event

Validate the signature over the raw body and handle message.received. The data field is the inbound message.
3

Answer 2xx quickly

Return 2xx within 10 seconds and do the heavy work afterwards. If you are slow or fail, Routa tries again. See Retries and replay.

Example event

Inbound content types

The content of an inbound message can be text, image, document, audio, video, sticker or location. A type Routa does not model yet, such as interactive or contacts, arrives as { "type": "unsupported" }: the message exists and produces message.received. See Content types.
Reactions and system notices, such as a contact changing their number, are ignored on purpose. They create no message, produce no message.received and do not count as usage. Routa does not yet tell you when a contact changes their number.

Download inbound media

For image, document, audio, video and sticker, the content carries a media_id. Routa downloads and stores the file asynchronously. Ask for a signed URL:
If status is pending, try again in a moment. The URL is valid for 15 minutes. See Media.

Mark as read

To send the read receipt to the customer, call:
Only inbound messages can be marked as read. For an outbound message, the API returns 422 message_direction_invalid. Scope: messages:write.

Query the history

List inbound messages with cursor pagination:
See Pagination.

Make sure no message is lost

Webhooks are delivered at least once, so the same event can arrive more than once. Deduplicate by the event id. If your server was down, recover what you missed with GET /v1/events.