# Webhook Events

> Complete reference for Sendable webhook events and payloads.

Source: https://wav1.recrav.com/docs/webhook-events

## Envelope Shape [#envelope-shape]

Every webhook uses the same top-level envelope:

```json
{
  "createdAt": "2026-03-02T10:30:00.000Z",
  "type": "message.sent",
  "data": {}
}
```

## Event Types [#event-types]

### Message Events [#message-events]

### message.sent [#messagesent]

Triggered when WhatsApp accepts a message sent through the API (sync or async send). `status` is usually still `PENDING`.

```json
{
  "createdAt": "2026-03-02T10:30:00.000Z",
  "type": "message.sent",
  "data": {
    "id": "wamid.HBgLN...",
    "type": "text",
    "timestamp": 1740911400,
    "origin": "personal",
    "direction": "OUTBOUND",
    "to": "6281234567890@s.whatsapp.net",
    "chatId": "6281234567890@s.whatsapp.net",
    "status": "PENDING",
    "text": {
      "content": "Hello from Sendable"
    }
  }
}
```

### message.delivered [#messagedelivered]

Triggered once per outbound message, on the first `SENT` or `DELIVERED` status update.

```json
{
  "createdAt": "2026-03-02T10:30:05.000Z",
  "type": "message.delivered",
  "data": {
    "id": "wamid.HBgLN...",
    "type": "text",
    "timestamp": 1740911400,
    "origin": "personal",
    "direction": "OUTBOUND",
    "to": "6281234567890@s.whatsapp.net",
    "chatId": "6281234567890@s.whatsapp.net",
    "status": "DELIVERED",
    "text": {
      "content": "Hello from Sendable"
    }
  }
}
```

### message.read [#messageread]

Triggered when the recipient reads a message.

```json
{
  "createdAt": "2026-03-02T10:35:00.000Z",
  "type": "message.read",
  "data": {
    "id": "wamid.HBgLN...",
    "type": "text",
    "timestamp": 1740911400,
    "origin": "personal",
    "direction": "OUTBOUND",
    "to": "6281234567890@s.whatsapp.net",
    "chatId": "6281234567890@s.whatsapp.net",
    "status": "READ",
    "text": {
      "content": "Hello from Sendable"
    }
  }
}
```

### message.failed [#messagefailed]

Triggered once when a send through the API fails for good, before WhatsApp accepts it. There is no stored message, so `id` is `null`; `error` and `statusCode` describe the failure and `runId` is set for async sends.

* Sync sends (the default, without `"async": true`) emit it once, on the failed request.
* Async sends (`"async": true`) are retried by the send queue (5 attempts by default, exponential backoff). Only the attempt that ends the job emits `message.failed`, so a job produces at most one event. Earlier failed attempts are silent.
* 4xx errors (`statusCode` 400 or 404, for example an invalid payload) are not retried: the job fails on the first attempt.
* `attempt` is the attempt that failed (1-based), `maxAttempts` the job's limit, `final` is always `true`, and `retryable` tells whether the error was transient (5xx, network) or permanent (4xx). A permanent failure will fail again if you resend the same request.

The same event appears in `GET /v1/events?type=message.failed` with the same `data`, so you can replay failures you missed.

```json
{
  "createdAt": "2026-03-02T10:30:10.000Z",
  "type": "message.failed",
  "data": {
    "id": null,
    "chatId": "6281234567890@s.whatsapp.net",
    "to": "6281234567890@s.whatsapp.net",
    "direction": "OUTBOUND",
    "status": "FAILED",
    "error": "whatsapp socket not connected",
    "statusCode": 503,
    "runId": "42",
    "attempt": 5,
    "maxAttempts": 5,
    "final": true,
    "retryable": true
  }
}
```

### message.received [#messagereceived]

Triggered when an incoming direct message is received. Group and community traffic may also arrive as `message-personal.received` or `message-group.received` depending on the chat origin.

```json
{
  "createdAt": "2026-03-02T10:40:00.000Z",
  "type": "message.received",
  "data": {
    "id": "wamid.HBgLM...",
    "type": "text",
    "timestamp": 1740912000,
    "origin": "personal",
    "direction": "INBOUND",
    "from": "6281234567890@s.whatsapp.net",
    "to": "6289876543210@s.whatsapp.net",
    "senderJid": "6281234567890@s.whatsapp.net",
    "chatId": "6281234567890@s.whatsapp.net",
    "quotedMessageId": null,
    "mentionsMe": false,
    "mentionAll": false,
    "quotedParticipant": null,
    "quotedFromMe": false,
    "senderLid": "123456789012345@lid",
    "text": {
      "content": "Hello!"
    }
  }
}
```

Every message event (`message.received`, the `*-personal.received` / `*-group.received` variants, `message.sent`, `message.delivered`, `message.read`) carries the same mention and reply context, so an agent can decide whether a message is addressed to it without extra lookups:

| Field               | Meaning                                                                                                                                                                                                                                                                           |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mentionedJids`     | Raw mentioned JIDs (`@lid` in LID-addressed groups, `@s.whatsapp.net` otherwise). Only present when non-empty.                                                                                                                                                                    |
| `mentionsMe`        | `true` when the message @mentions this session's account, matched on both its phone JID and its LID.                                                                                                                                                                              |
| `mentionAll`        | `true` when the sender used WhatsApp's @all mention.                                                                                                                                                                                                                              |
| `quotedParticipant` | Sender of the replied-to message (`quotedMessageId`), or `null` when the message is not a reply.                                                                                                                                                                                  |
| `quotedFromMe`      | `true` when the replied-to message was sent by this session's account.                                                                                                                                                                                                            |
| `senderLid`         | The sender's LID when known. `senderJid` can be `null` for LID-only senders.                                                                                                                                                                                                      |
| `catchUp`           | Only on `received` events: `true` for a recent group message that arrived while the session was catching up after a reconnect instead of live. `timestamp` is the original send time. Only messages from the last couple of minutes are delivered this way; older history is not. |

`message.received` and `message-group.received` (or `message-personal.received`) are both sent for the same message with the same `data`. Subscribe to one of them, or deduplicate on `data.id`.

### Session Events [#session-events]

### session.socket-connected [#sessionsocket-connected]

Triggered when the WhatsApp socket connects successfully.

```json
{
  "createdAt": "2026-03-02T10:00:00.000Z",
  "type": "session.socket-connected",
  "data": {
    "sessionId": "sess_xyz789",
    "socketStatus": "connected",
    "status": "authenticated"
  }
}
```

### session.socket-disconnected [#sessionsocket-disconnected]

Triggered when the WhatsApp socket disconnects.

```json
{
  "createdAt": "2026-03-02T10:15:00.000Z",
  "type": "session.socket-disconnected",
  "data": {
    "sessionId": "sess_xyz789",
    "socketStatus": "disconnected",
    "status": "authenticated",
    "reason": 515
  }
}
```

## Normalized Events [#normalized-events]

These events come from the WhatsApp session itself (other devices, contacts, groups, WhatsApp servers). Each one is delivered as a webhook when subscribed **and** appears in `GET /v1/events` with the same `type` and `data`, so you can replay anything you missed:

```bash
curl "https://api.sendable.dev/v1/events?type=group.join-request&limit=50" \
  -H "x-api-key: YOUR_SESSION_API_KEY"
```

| Type                                   | Source                                                                     | `data`                                                                                                |
| -------------------------------------- | -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `message.deleted`                      | message revoked for everyone, or deleted on another device                 | `{ items: [{ messageId, chatId, participantId, isDeleted }] }` (`chatId`/`all` for chat-wide deletes) |
| `message.edited`                       | message edited                                                             | `{ items: [{ messageId, chatId, participantId, text, editedAt }] }`                                   |
| `message.reaction`                     | reaction added or removed                                                  | `{ items: [{ messageId, chatId, reactorJid, fromMe, emoji, removed, timestamp }] }`                   |
| `status.received`                      | status posted by a contact (**only when the session opted in**, see below) | `{ items: [{ messageId, senderJid, senderPushname, timestamp, type, text }] }`                        |
| `status.posted`                        | status posted by this account                                              | same as `status.received`                                                                             |
| `chat.upsert` / `chat.updated`         | chat created or changed (archive, pin, mute, unread)                       | `{ items: [{ id, name, conversationTimestamp, unreadCount, archived, pinned }] }`                     |
| `chat.deleted`                         | chat deleted                                                               | `{ items: [{ chatId }] }`                                                                             |
| `chat.locked`                          | chat locked or unlocked                                                    | `{ chatId, locked }`                                                                                  |
| `group.upserted`                       | joined or created a group                                                  | `{ items: [{ id, subject, desc, owner, announce, restrict, ... }] }`                                  |
| `group.updated`                        | group settings changed                                                     | `{ items: [{ id, ...changedFields }] }`                                                               |
| `group.participants.updated`           | participants added, removed, promoted, demoted                             | `{ groupId, action, authorId, participants: [{ id, phoneNumber, admin }] }`                           |
| `group.join-request`                   | someone requested to join, or a request was revoked/rejected               | `{ groupId, action, method, authorId, authorPn, participant, participantPn }`                         |
| `group.member-tag.updated`             | a member changed their group member tag                                    | `{ groupId, participant, participantAlt, label, timestamp }`                                          |
| `contact.upserted` / `contact.updated` | contacts synced or changed                                                 | `{ items: [{ id, lid, phoneNumber, name, notify, verifiedName, pictureChanged? }] }`                  |
| `label.edited`                         | Business label created, renamed, recolored, deleted                        | `{ id, name, color, deleted, predefinedId }`                                                          |
| `label.association.updated`            | label added to or removed from a chat or message                           | `{ action, type, labelId, chatId, messageId }`                                                        |
| `call.updated`                         | incoming call offer, ringing, accept, reject, timeout, terminate           | `{ items: [{ id, chatId, from, callerPn, isGroup, groupJid, isVideo, status, offline, date }] }`      |
| `newsletter.reaction`                  | reaction on a channel post                                                 | `{ newsletterId, serverId, code, count, removed }`                                                    |
| `newsletter.view`                      | view count on a channel post                                               | `{ newsletterId, serverId, count }`                                                                   |
| `newsletter.participants.updated`      | channel admin promoted or demoted                                          | `{ newsletterId, author, user, role, action }`                                                        |
| `newsletter.settings.updated`          | channel name or description changed                                        | `{ newsletterId, update: { name?, description? } }`                                                   |
| `settings.updated`                     | account setting synced from another device                                 | `{ setting, value }`                                                                                  |
| `message-capping.updated`              | new-chat message cap changed                                               | WhatsApp cap info (`total_quota`, `used_quota`, ...)                                                  |
| `blocklist.set`                        | full blocklist synced                                                      | `{ blocklist: [jid] }`                                                                                |
| `blocklist.updated`                    | account blocked or unblocked                                               | `{ action: "add" \| "remove", jids: [jid] }`                                                          |
| `history.synced`                       | a history sync chunk was stored                                            | `{ chats, contacts, messages, lidPnMappings, isLatest, progress, syncType, chunkOrder }` (counts)     |
| `history.status`                       | a history sync phase finished or paused                                    | `{ syncType, status, explicit }`                                                                      |

`GET /v1/events` also returns `message.created` and `message.updated` (feed only; subscribe to the `message.*` webhooks above instead) and `message.failed` (same `data` as the [`message.failed`](#messagefailed) webhook). Call `GET /webhooks/event-types` for the list a webhook can subscribe to.

### group.join-request [#groupjoin-request]

```json
{
  "createdAt": "2026-11-23T08:00:00.000Z",
  "type": "group.join-request",
  "data": {
    "groupId": "120363025000000000@g.us",
    "action": "created",
    "method": "invite_link",
    "authorId": "123456@lid",
    "authorPn": "6281234567890@s.whatsapp.net",
    "participant": "123456@lid",
    "participantPn": "6281234567890@s.whatsapp.net"
  }
}
```

### message.reaction [#messagereaction]

```json
{
  "createdAt": "2026-11-23T08:00:00.000Z",
  "type": "message.reaction",
  "data": {
    "items": [
      {
        "messageId": "3EB0C0A9F1D2",
        "chatId": "6281234567890@s.whatsapp.net",
        "reactorJid": "6281234567890@s.whatsapp.net",
        "fromMe": false,
        "emoji": "👍",
        "removed": false,
        "timestamp": 1763884800000
      }
    ]
  }
}
```

### call.updated [#callupdated]

```json
{
  "createdAt": "2026-11-23T08:00:00.000Z",
  "type": "call.updated",
  "data": {
    "items": [
      {
        "id": "CALL_ID",
        "chatId": "6281234567890@s.whatsapp.net",
        "from": "6281234567890@s.whatsapp.net",
        "callerPn": null,
        "isGroup": false,
        "groupJid": null,
        "isVideo": true,
        "status": "offer",
        "offline": false,
        "date": "2026-11-23T08:00:00.000Z"
      }
    ]
  }
}
```

Reject it with `POST /v1/calls/CALL_ID/reject`.

### Received Statuses Are Opt-In [#received-statuses-are-opt-in]

Statuses posted by your contacts are **not stored by default**. They are dropped before storage, so `GET /v1/status` stays empty and no `status.received` webhook or event is produced. Opt in per session:

```bash
curl -X PUT "https://api.sendable.dev/v1/status/settings" \
  -H "x-api-key: YOUR_SESSION_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "storeReceived": true }'
```

Statuses you post (`POST /v1/status`) are always stored and produce `status.posted`.

## Verifying Webhooks [#verifying-webhooks]

Use the SDK with the raw request body plus the `webhook-*` headers:

```typescript
import express from 'express'
import { Sendable } from '@sendable-dev/sdk'

const sendable = new Sendable({
  apiKey: process.env.SENDABLE_API_KEY!,
  apiKeyScope: 'session',
  webhookSecret: process.env.SENDABLE_WEBHOOK_SECRET,
})

app.post('/webhook', express.raw({ type: 'application/json' }), async (req, res) => {
  const payload = req.body.toString()

  try {
    const event = await sendable.webhooks.verifyAndParse(payload, req.headers)
    if (event.type === 'group.join-request') {
      // Normalized events carry a plain `data` object.
      console.log('join request', event.data.groupId, event.data.participant)
    } else {
      console.log(event.type, event.data)
    }
    return res.sendStatus(200)
  } catch {
    return res.status(401).send('Invalid signature')
  }
})
```
