Messaging webhook events

The messaging module sends its events through Karta's own webhooks: signed as Standard Webhooks, retried, replayable, listed in the console. Make a webhook as usual (POST /api/v2/webhooks, or the Webhooks page) in Karta's own (standard) format and name the messaging events you want:

{"name": "Shop", "url": "https://shop.example/hooks/karta", "format": "standard",
 "events": ["messaging.message.received", "messaging.message.status"]}

A webhook with no event list does not receive messaging events. "Every event" means every mail event, those added later included; the messaging events are a separate list that a webhook must choose, so that adding the module never changes what an existing webhook receives. The same holds for a webhook that names mail events only. Webhooks in the other formats (Postal, Mailgun, SendGrid, Postmark) cannot carry them.

Each request body is {"type", "timestamp", "version": 1, "data": {...}}.

messaging.message.received

A message arrived. Not sent for history imported when a number is first linked (backfill: true messages are stored and not announced).

{"type": "messaging.message.received", "timestamp": "2026-11-13T09:58:10.000000Z", "version": 1,
 "data": {
   "server_id": "...", "connector_id": "...", "channel": "whatsapp",
   "conversation_id": "...", "message_id": "...",
   "address": "+59971112222", "address_kind": "e164", "display_name": "Maria",
   "sender_address": "+59971112222", "kind": "text", "text": "Is mijn boeket klaar?",
   "media_id": null, "occurred_at": "2026-11-13T09:58:10.000000Z",
   "backfill": false, "external_ref": "pos_customer:812"}}

text is null unless the server setting webhook events carry the text (server.webhook_include_body, off by default) is on; then it is the text, or a media message's caption. Webhook events are kept 30 days in a table that is not encrypted, outside the messaging retention: with the setting off the text of a message stays only in the encrypted column and the application reads it with GET /messages/:id.

messaging.message.status

An outbound message moved on: sent, delivered, read, failed or unknown. It says which channel was used and, where the provider reported it, the cost.

{"type": "messaging.message.status", "version": 1,
 "data": {"server_id": "...", "message_id": "...", "request_id": "...", "attempt_no": 1,
          "channel": "whatsapp", "connector_id": "...", "address": "+59971112222",
          "reference": "order-1043", "state": "delivered", "final": true,
          "fallback_from": null, "error_class": null, "error_code": null,
          "cost": null, "duplicate_possible": false}}

final is true when nothing more is expected of this attempt and Karta will not try again or move to another channel: delivered, read, unknown, and failed when no retry follows. A failed attempt with final: false is followed by another attempt (attempt_no 2). unknown means nobody can tell whether the message went out (duplicate_possible: true); Karta stops there and leaves the decision to you. A messaging.message.status with late: true and duplicate_possible: true says an agent's answer to a command Karta had given up on turned out to be ok: the message was sent after all, and may have been sent again meanwhile.

error_class is one of permanent, retry, unknown_recipient, not_linked, rate_limited, unknown_outcome, unsupported, too_large, expired.

Connector events

messaging.connector.connected, .disconnected, .needs_link, .needs_update: server_id, connector_id, name, plug, channel, status, agent_version, reason. A shop's computer going offline or its WhatsApp needing a new scan is announced here, so the application can say so.

messaging.history.imported

An agent finished importing the history of a newly linked number: connector_id, account_id, chats, messages, from, to.

Receiving them

Verify the signature as for any Karta webhook, and treat a delivery as at least once: the webhook-id header is the same on a retry, so keep the ones you have handled.