# Signed events, retried and replayable.

bubbl3 tells your server about replies, delivery status, opt-outs, number health and agent handoffs by posting signed JSON to your endpoint. Each delivery carries an HMAC-SHA256 signature that verifyWebhook checks. Failed deliveries are retried with backoff for up to 24 hours, and you can replay any finished delivery.

In the API, each number is a `line` object, so the events about your numbers are the `line.*` events below.

## Events

- Messages: `message.received` and `message.status`.
- Contacts: `contact.created`, `contact.opted_out` and `contact.opted_in`.
- Conversations and agents: `conversation.assigned` and `agent.handoff`.
- Numbers: `line.state_changed`, `line.degraded` and `line.recovered`.
- Workflows: `workflow.run.completed` and `workflow.webhook`.

## Retries and replay

- Answer with any `2xx` within 10 seconds, then do slow work afterwards.
- Anything else is retried with exponential backoff and jitter for up to 24 hours. Answer `410 Gone` to stop and disable the endpoint.
- Delivery is at least once, and events can arrive out of order. Skip an event `id` you've already handled.
- Every attempt is kept. Replay a finished delivery from the dashboard or the API; it sends the same event with a fresh signature.

## Endpoints and secrets

- An endpoint must be a public `https` URL. Private, loopback and metadata addresses are refused.
- Each endpoint's signing secret is shown once, when you create it. When you rotate it, deliveries carry both signatures for 24 hours.
- A workspace can have up to 20 endpoints.

## A delivery, and how to verify it

Delivery:

```
POST https://your-app.com/hooks/bubbl3
bubbl3-signature: t=1791405120,v1=9f2c…

{
  "id": "evt_01JAX…",
  "type": "message.received",
  "created_at": "2026-10-06T16:12:04Z",
  "data": { "message": {
    "conversation_id": "cnv_3QF8…",
    "from": "+19175550142",
    "line_id": "ln_07",
    "channel": "imessage",
    "body": "Yes, see you then"
  } }
}
```

Verify:

```
import express from "express";
import { verifyWebhook } from "@bubbl3/sdk";

const app = express();

app.post("/hooks/bubbl3", express.raw({ type: "application/json" }), (req, res) => {
  const signature = req.headers["bubbl3-signature"];
  if (!verifyWebhook(req.body, signature, process.env.BUBBL3_WEBHOOK_SECRET)) {
    return res.status(400).end();
  }
  const event = JSON.parse(req.body.toString("utf8"));
  res.status(200).end(); // answer within 10 seconds, then do the work
  handle(event); // skip event.id if you have seen it before
});
```

## In the documentation

- [Webhooks quick-start](https://docs.bubbl3.com/quickstart/webhooks)
- [Webhook events](https://docs.bubbl3.com/reference/webhook-events)

Updated: 2026-10-15
