# Webhooks: setup, signatures and retries

> Receive signed events about calls, campaigns and more: the event envelope, the signature headers, how to answer a delivery, and how retries work.

Webhooks tell your server when something happens in MoreVoice: a call ends, a recording is ready, a campaign finishes, a contact opts out. MoreVoice sends an HTTPS `POST` with a JSON body to a URL you choose, signs it, and retries until your server confirms it got it.

## Two webhook formats

MoreVoice has two webhook formats. These pages describe **webhooks v2**, the format of the public API.

| | Webhooks v2 | Endpoints created before v2 |
|---|---|---|
| Where you add the endpoint | **Developers › Webhooks**, or `POST /v1/webhook_endpoints` | **Settings › Compliance**, or the webhook in a campaign's settings |
| Events | The whole [event catalogue](https://docs.morevoice.ai/webhooks/events/) | Eight events, under their [legacy names](https://docs.morevoice.ai/webhooks/events/#legacy-event-names) |
| Body | The [event envelope](#the-event-envelope) | `{ "id", "event", "createdAt", "data" }` |
| Signature | [Standard Webhooks](https://www.standardwebhooks.com) headers | `X-Webhook-Signature: sha256=…` |
| Retries | Up to 72 hours | Up to 24 hours |

Both formats are signed with a secret that only you and MoreVoice know, and the SDK verifies both: see [verifying signatures](https://docs.morevoice.ai/webhooks/verify/).

## Add an endpoint

In the dashboard, open **Developers › Webhooks**, select **Add endpoint** (or **Add test endpoint** for test mode), enter your URL and pick the events. The endpoint's `whsec_…` secret is shown once, when you create it or rotate it; the tab also sends a test event and lists every delivery with your server's response. With the API, `POST /v1/webhook_endpoints` does the same and answers with the secret (see the [event streams guide](https://docs.morevoice.ai/guides/realtime/) for an example).

> **Part of the API beta**
>
> Webhooks v2 is switched on per organisation with the API beta. Until it is on for yours, the endpoints in **Settings › Compliance** and in campaign settings keep working in the earlier format.

Your endpoint must:

- accept a `POST` with a JSON body. Use HTTPS; the port can be 80, 443, or any port from 1024 up;
- be reachable from the internet. Addresses inside a private network (`localhost`, `10.x`, `192.168.x`) are refused unless an administrator allows private network addresses for your organisation;
- read the **raw body** before parsing it, because the signature covers the exact bytes MoreVoice sent.

## The event envelope

Every event has the same envelope. `type` says what happened, and `data.object` holds the object it happened to: a call, a campaign, a contact. The [event catalogue](https://docs.morevoice.ai/webhooks/events/) lists every type with its payload.

```json title="POST https://your-server.example.com/webhooks"
{
  "id": "evt_3fT9kq2ZpLr8YwVbN1cX0a",
  "object": "event",
  "type": "call.ended",
  "created": "2026-11-03T09:14:22Z",
  "api_version": "2026-11-01",
  "livemode": true,
  "org_id": "org_0000000000000000000001",
  "data": {
    "object": {
      "id": "call_IGuHGrBtu5JTm5igG2I8EG",
      "object": "call",
      "direction": "inbound",
      "from": "+972501234567",
      "to": "+972541234567",
      "status": "…",
      "assistant_id": "asst_yosOhvUkeWL0SUSxrLfMTg",
      "flow_id": "flow_tR9pvZPjzIEif0WVmzbQUt",
      "queue_id": "q_FG2uL2gdWXNMUfXZyRFLfT",
      "agent_id": "usr_yhfp6RLIuxEKA5Zn4hcCNX",
      "campaign_id": "cmp_FUcgwuMRgvytMFC432pOdi",
      "contact_id": "ctc_NKhjnYPvBUr2gmEgqwqw5N",
      "end_reason": "…",
      "duration_ms": 93120,
      "answered_by": "human",
      "started_at": "2026-11-03T09:14:22Z",
      "answered_at": "2026-11-03T09:14:22Z",
      "ended_at": "2026-11-03T09:14:22Z",
      "metadata": {},
      "ai_generated": true,
      "ai_segments": [
        {
          "start_ms": 93120,
          "end_ms": 93120,
          "source": "assistant"
        }
      ],
      "recording_announced": true,
      "recording_announced_at": "2026-11-03T09:14:22Z",
      "ai_disclosure_played": true,
      "ai_disclosure_played_at": "2026-11-03T09:14:22Z",
      "consent_basis": "notice",
      "channel": "phone",
      "whatsapp": {
        "wacid": "…",
        "whatsapp_number_id": "wan_ih9k2g5BlZ66QfYFrjyTyl",
        "whatsapp_phone_number_id": "…",
        "whatsapp_user_id": "…",
        "biz_opaque_callback_data": "…",
        "whatsapp_user_name": "…",
        "cta_payload": "…",
        "deeplink_payload": "…"
      }
    }
  },
  "request": {
    "id": null,
    "idempotency_key": null
  }
}
```

| Field | Description |
| --- | --- |
| `id` | The event ID. Receivers deduplicate on it (it is also the `webhook-id` header). |
| `object` | Always `event`. |
| `type` | The event type, for example `call.ended`. |
| `created` | An ISO-8601 timestamp in UTC. |
| `api_version` | The API version the payload is rendered in (the endpoint's pinned version). |
| `livemode` | `true` in live mode, `false` in test mode. |
| `org_id` | The organisation the event belongs to. |
| `data` | `object` is the object the event is about: see the [event catalogue](https://docs.morevoice.ai/webhooks/events/) for each type. |
| `request` | The API request that caused the event, if any: its ID (`X-Request-Id`) and its `Idempotency-Key`. |

## Signature headers

Each delivery carries three [Standard Webhooks](https://www.standardwebhooks.com) headers. Check them before you trust the body: [verifying signatures](https://docs.morevoice.ai/webhooks/verify/) shows how, with the SDK, in plain Node.js and in Python.

| Header | Description | Example |
| --- | --- | --- |
| `webhook-id` | The event ID (`evt_…`); the same on every retry. Deduplicate on it. | `evt_3fT9kq2ZpLr8YwVbN1cX0a` |
| `webhook-timestamp` | Unix seconds of this delivery attempt. Reject deliveries more than 5 minutes old. | `1762161262` |
| `webhook-signature` | Space-separated `v1,<base64 HMAC-SHA256>` signatures of `<webhook-id>.<webhook-timestamp>.<body>` with the endpoint secret (two while a secret rotates). | `v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=` |

While a secret is being rotated, `webhook-signature` carries two signatures, one per secret, so both the old and the new secret verify.

## Answering a delivery

Answer with any `2xx` status within **10 seconds**. Anything else, including a redirect or a timeout, counts as a failure and is retried.

- **Acknowledge first, work later.** Store the event and answer `200` or `204` straight away. Do slow work, such as updating your CRM, in the background.
- **Deduplicate on `webhook-id`.** A retry sends the same event with the same ID, so an event can arrive more than once. Keep the IDs you have processed and skip repeats.
- **Don't rely on order.** Events can arrive out of order. Use `created` and the object's `status` to ignore an update that is older than the one you already have.

## Retries

When a delivery fails, MoreVoice tries again, waiting longer between attempts. Webhooks v2 retries a failed delivery for up to **72 hours**. Endpoints created before v2 are retried on this schedule:

| Retry | Wait after the previous attempt | Time since the event |
| --- | --- | --- |
| 1 | 10 s | 10 s |
| 2 | 20 s | 30 s |
| 3 | 40 s | 1 min 10 s |
| 4 | 1 min 20 s | 2 min 30 s |
| 5 | 2 min 40 s | 5 min 10 s |
| 6 | 5 min 20 s | 10 min 30 s |
| 7 | 10 min 40 s | 21 min 10 s |
| 8 | 21 min 20 s | 42 min 30 s |
| 9 | 42 min 40 s | 1 h 25 min |
| 10 | 1 h | 2 h 25 min |

Then every hour, until 24 hours after the event.

After the last retry the delivery stops. Replaying missed events, from the dashboard or through the event log API, comes with webhooks v2.

## Test mode

Events that happen in test mode (`livemode: false`) are sent only to test-mode endpoints, and live events only to live endpoints, so a test never reaches your production systems.
