Most/Docs

Most failures: messages/whatsapp

Every functionality most-server runs and every way each can fail, from the server's own failure catalogue.

How a refusal reads#

most-server answers a request it refuses with the cause's HTTP status and a body naming the step that failed and why (`detail`), and, under `error`, the cause (`<functionality>.<cause>`), its fix (`remedy`), its code and whether sending it again can help; a refusal of the request itself (a 4xx) also says what it observed of the request. A failure of the host (a 5xx) keeps what it observed in the service's log line of the same request. A refused start prints what failed, the fix and the cause on stderr and exits with the cause's status: 2 for a usage error, 69 when retrying unchanged can help, 1 otherwise.

This page is generated from the failure catalogue the running most-server prints (`most-server errors list`); a cause whose test cannot run on a developer's machine is listed in the Most repository's tests/untested-causes/ with why.

Refusal body
{"detail": "<the step that failed>: <why>",
 "error": {"code": "config", "service": "backend", "impact": "messaging",
           "retryable": false, "cause": "<functionality>.<cause>",
           "remedy": "<the fix>", "observed": "<the state observed, for a 4xx>"}}

most.whatsapp.send#

Send text to one WhatsApp user from the operator's business number over Meta's Cloud API, and keep the chat and the message with the id Meta gave it.

Started through: `POST /v3/chats (preferred_service WhatsApp)`, `POST /v3/chats/{chat_id}/messages on a WhatsApp chat`.

Uses: `most.core.storage`.

  • `most.whatsapp.send.recipient-count` — HTTP 400, exit 2. creating a WhatsApp chat: a WhatsApp message from the business number goes to exactly one user. Observed: to names {count} recipients. Fix: create one chat per WhatsApp number. Provoked by `tests/whatsapp/refusal.rs::a_chat_with_two_recipients_is_refused`.
  • `most.whatsapp.send.number-invalid` — HTTP 400, exit 2. creating a WhatsApp chat: a WhatsApp user is named by a phone number in E.164 form: + and up to 15 digits. Observed: the recipient is {recipient:?}. Fix: name the recipient as +<country code><number>, digits only after the +. Provoked by `tests/whatsapp/refusal.rs::a_recipient_that_is_not_a_phone_number_is_refused`.
  • `most.whatsapp.send.part-not-text` — HTTP 400, exit 2. sending a WhatsApp message: the WhatsApp channel sends text only. Observed: part {index} is {kind}. Fix: send text parts only on a WhatsApp chat. Provoked by `tests/whatsapp/refusal.rs::a_part_that_is_not_text_is_refused`.
  • `most.whatsapp.send.text-missing` — HTTP 400, exit 2. sending a WhatsApp message: none of the message's text parts holds any text, and Meta sends no empty message. Observed: {parts} part(s), none with text. Fix: give at least one text part a value. Provoked by `tests/whatsapp/refusal.rs::a_message_without_text_is_refused`.
  • `most.whatsapp.send.number-unstored` — HTTP 403, exit 1. sending on WhatsApp chat {chat}: the chat keeps no WhatsApp number to send to. Observed: chat {chat} has no backend_ref. Fix: start a new chat with POST /v3/chats naming the WhatsApp number; this one cannot be sent on. Provoked by `tests/whatsapp/refusal.rs::a_chat_stored_without_a_number_is_refused`.
  • `most.whatsapp.send.user-without-number` — HTTP 403, exit 1. sending on WhatsApp chat {chat}: the chat was started by a WhatsApp user Meta names only by a business-scoped user id (a user with a username and no visible number), and this channel sends to numbers. Observed: chat {chat} keeps the user id {user}. Fix: answer that user from the WhatsApp Business app, or ask them for a number and start a chat with it. Provoked by `tests/whatsapp/refusal.rs::a_chat_with_a_user_id_and_no_number_is_refused`.
  • `most.whatsapp.send.token-not-text` — HTTP 503, exit 1. reading the WhatsApp token {reference} names: the access token and the verify token are text, and the secret holds bytes that are not UTF-8. Observed: {bytes} byte(s), not UTF-8 from byte {at}. Fix: store, as written, the access token Meta issued or the verify token entered in the app's webhook configuration in {reference}. Provoked by `tests/whatsapp/refusal.rs::a_token_that_is_not_text_is_refused`.
  • `most.whatsapp.send.token-blank` — HTTP 503, exit 1. reading the WhatsApp token {reference} names: the secret holds nothing but whitespace; a blank verify token would let any request pass Meta's subscription check, and a blank access token authorizes nothing. Observed: {bytes} byte(s), all whitespace. Fix: store, as written, the access token Meta issued or the verify token entered in the app's webhook configuration in {reference}. Provoked by `tests/whatsapp/refusal.rs::a_token_of_only_whitespace_is_refused`.
  • `most.whatsapp.send.setting-missing` — HTTP 503, exit 1. registering the WhatsApp channel: MOST_WHATSAPP_TOKEN_SECRET is declared, and a send also needs the number it is sent from and the Graph API version; none is assumed. Observed: {setting} is unset or empty. Fix: set {setting} (docs/messages/whatsapp.md), or unset MOST_WHATSAPP_TOKEN_SECRET to run without WhatsApp, and start most-server again. Provoked by `tests/whatsapp/refusal.rs::a_token_without_its_number_is_refused`.
  • `most.whatsapp.send.refused` — HTTP 403, exit 1. calling Meta's {call}: Meta refused the call, in its own words. Observed: Meta answered HTTP {status}, code {code}{subcode}: {message} (fbtrace_id {trace}). Fix: act on Meta's words: code 190 is an access token Meta no longer accepts, 10 and 200-299 a permission the app lacks, 100 a parameter Meta does not take (a phone number id or a Graph API version it does not know). Provoked by `tests/whatsapp/refusal.rs::a_token_meta_does_not_hold_is_refused_in_metas_words`.
  • `most.whatsapp.send.outside-window` — HTTP 403, exit 1. calling Meta's {call}: the user has not written to or called the business number in the last 24 hours, and outside that customer service window Meta delivers only an approved template. Observed: Meta answered code {code}: {message}. Fix: wait for the user to write to the business number, then send; templates are not sent by Most. Provoked by `tests/whatsapp/refusal.rs::a_message_outside_the_window_is_refused`.
  • `most.whatsapp.send.rate-limited` — HTTP 429, exit 69, and sending it again can help. calling Meta's {call}: Meta is throttling this app or business number. Observed: Meta answered code {code}: {message}. Fix: send again later; Most does not wait and resend on its own. Provoked by `tests/whatsapp/refusal.rs::a_throttled_send_is_named`.
  • `most.whatsapp.send.unreachable` — HTTP 503, exit 69, and sending it again can help. calling Meta's {call}: no answer came back from Meta. Observed: {error}. Fix: check that this host reaches graph.facebook.com, then send again. Provoked by `tests/whatsapp/refusal.rs::an_unreachable_graph_api_is_named`.
  • `most.whatsapp.send.unreadable` — HTTP 503, exit 1. calling Meta's {call}: the answer is neither the Cloud API's result nor Graph's error. Observed: HTTP {status}: {error}. Fix: check that the configured Graph origin is Meta's. Provoked by `tests/whatsapp/refusal.rs::an_answer_that_is_not_the_cloud_api_is_named`.

most.whatsapp.receive#

Answer Meta's subscription check, take each messages webhook Meta signed under the app secret, keep each text message on the Most chat of its sender and send it to that sender's subscribers as message.received.

Started through: `GET /v3/whatsapp/webhook (Meta's subscription check)`, `POST /v3/whatsapp/webhook (Meta's messages webhook)`.

Uses: `most.core.storage`, `most.core.webhook_delivery`.

  • `most.whatsapp.receive.receiving-undeclared` — HTTP 503, exit 1. answering a request to the WhatsApp webhook: this most-server receives no WhatsApp messages: MOST_WHATSAPP_APP_SECRET_SECRET and MOST_WHATSAPP_VERIFY_TOKEN_SECRET, which Meta's requests are checked against, are not both declared, or the WhatsApp channel is not registered. Observed: no WhatsApp receiver is registered. Fix: declare both secrets beside MOST_WHATSAPP_TOKEN_SECRET (docs/messages/whatsapp.md), start most-server again and read /healthz for the whatsapp backend. Provoked by `tests/server/whatsapp.rs::a_webhook_on_a_server_without_whatsapp_is_refused`.
  • `most.whatsapp.receive.subscribe-refused` — HTTP 401, exit 1. answering Meta's subscription check: the check is not Meta's subscription of this webhook under the operator's verify token. Observed: {what}. Fix: enter, in the app's WhatsApp webhook configuration, the verify token MOST_WHATSAPP_VERIFY_TOKEN_SECRET names, and verify again. Provoked by `tests/whatsapp/webhook.rs::a_subscription_check_with_another_token_is_refused`.
  • `most.whatsapp.receive.signature-missing` — HTTP 401, exit 1. taking a WhatsApp webhook: Meta signs every webhook in X-Hub-Signature-256, and this request carries none, so it is not taken as Meta's. Observed: no X-Hub-Signature-256 header. Fix: point only Meta's webhook configuration at this address; a post from anything else is refused. Provoked by `tests/whatsapp/webhook.rs::a_webhook_without_a_signature_is_refused`.
  • `most.whatsapp.receive.signature-invalid` — HTTP 401, exit 1. taking a WhatsApp webhook: X-Hub-Signature-256 is not sha256= and the HMAC-SHA256 of the body under the app secret, so the body is not taken as Meta's. Observed: the signature {why}. Fix: store, in the secret MOST_WHATSAPP_APP_SECRET_SECRET names, the App Secret of the Meta app whose webhook posts here, and start most-server again. Provoked by `tests/whatsapp/webhook.rs::a_webhook_signed_under_another_secret_is_refused`.
  • `most.whatsapp.receive.body-unreadable` — HTTP 403, exit 1. reading a WhatsApp webhook Meta signed: the body is not Meta's messages webhook. Observed: {error}. Fix: subscribe the app's webhook to the messages field only; another field's body is not read. Provoked by `tests/whatsapp/webhook.rs::a_signed_body_that_is_not_a_webhook_is_refused`.
  • `most.whatsapp.receive.sender-absent` — HTTP 403, exit 1. receiving WhatsApp message {message}: the message names neither the sender's number nor their business-scoped user id. Observed: message {message} has no from and no from_user_id. Fix: nothing in Most: Meta names one of the two for every message its reference describes; report the message id to Meta. Provoked by `tests/whatsapp/receive.mjs::a_message_without_a_sender_is_logged`.
  • `most.whatsapp.receive.timestamp-unreadable` — HTTP 403, exit 1. reading when WhatsApp message {message} was sent: Meta writes the time as whole Unix seconds in a string, and this one is not, so the message is received without the time it was sent. Observed: timestamp is {timestamp:?}. Fix: nothing in Most: report the message id to Meta; the message itself is kept and sent on. Provoked by `tests/whatsapp/receive.mjs::a_message_with_an_unreadable_time_is_received_without_it`.
  • `most.whatsapp.receive.inbound-not-text` — HTTP 403, exit 1. receiving WhatsApp message {message}: the message is not text (a photo, a voice note, a reaction), and the WhatsApp channel receives text only. Observed: message {message} is of type {kind}. Fix: send text to the business number; receiving other kinds is not built (docs/messages/whatsapp.md). Provoked by `tests/whatsapp/receive.mjs::a_message_without_text_is_logged`.
  • `most.whatsapp.receive.subscription-unsigned` — HTTP 403, exit 1. sending WhatsApp message {message} to subscription {subscription}: the subscription keeps no plaintext signing secret, so the event cannot be signed for it. Observed: subscription {subscription}. Fix: create the subscription again ('DELETE /v3/webhook-subscriptions/{subscription}', then 'POST /v3/webhook-subscriptions') so it keeps its signing secret. Provoked by `tests/whatsapp/receive.mjs::an_unsigned_subscription_is_logged`.
  • `most.whatsapp.receive.event-kept` — HTTP 503, exit 69, and sending it again can help. sending WhatsApp message {message} to {target}: the subscriber did not accept the event, so it is kept in the webhook outbox. Observed: {target}: {error}. Fix: repair the subscriber, then 'most-cli webhook-outbox redeliver' sends it again. Provoked by `tests/whatsapp/receive.mjs::an_event_the_subscriber_refuses_is_kept`.