# Receive Insurge webhooks

Receive signed events, verify signatures, and handle retries without duplicate processing.

Receive signed HTTP POST requests when meetings end, briefs are written, or new leads arrive. Webhooks push records to your server; the [API reference](/docs/developers/api) explains how to fetch records instead.

## Set up an endpoint

Sign in to the [Insurge dashboard](https://dashboard.insurgeai.com) as a workspace admin, then open **Settings → Developers → Webhooks**:

1. Select **Add endpoint** and enter your server's public HTTPS URL, for example `https://your-app.example/insurge/events`.
2. Choose event types. The default is all events, including types added later.
3. Optionally add up to 10 custom headers if your gateway requires them. Their values are stored encrypted and never shown again.
4. Copy the signing secret. It is shown once. Store it on your server as `INSURGE_WEBHOOK_SECRET`.
5. Deploy a receiver that verifies signatures (below), then select **Send test**. Confirm your receiver gets a `ping` and returns `2xx`.
6. Open **Log** to see each delivery's status, your response, and retries.

A workspace can have up to 10 endpoints. Only workspace admins can manage them; API keys cannot create, change, or delete endpoints.

The URL must use `https://` and cannot contain a username or password. An IP address or `localhost` that is not public is rejected when you save. At every delivery, Insurge resolves the hostname again and refuses to connect if any address is private, loopback, link-local, or a cloud metadata address; that delivery fails and is retried.

Custom header names use standard HTTP token characters (1–64 characters) and cannot repeat. You cannot set `Content-Type`, `Content-Length`, `Host`, `User-Agent`, `Connection`, `Transfer-Encoding`, `TE`, `Upgrade`, `Expect`, or any header starting with `webhook-` or `svix-`. Values can be up to 1,024 characters, without line breaks.

## Choose events

| Type | When it is sent | What to expect |
| --- | --- | --- |
| `meeting.ended` | A meeting closes, including one closed automatically after the visitor left | Meeting, lead, and transcript; the brief is not written yet |
| `meeting.summarized` | A brief is written for the meeting | The brief's `summary.status` is `ready`, `failed`, or `skipped` |
| `lead.created` | A visitor gives an email your workspace has not seen before | The new lead; anonymous visitors never create one |
| `recording.ready` | A meeting's recording has been saved and can be downloaded | The recording and enough of its meeting to file it |
| `recording.deleted` | A recording was deleted, by you (API or dashboard) or at the end of its retention period | The recording, now `deleted` or `expired` |
| `ping` | You select **Send test** | A test message, sent only to that endpoint |

Use `meeting.summarized` when you want one complete record per meeting: lead, brief, and transcript together.

**When briefs are written.** Presentation meetings get a brief automatically. For Tour guide, Help desk, Copilot, Onboarding, and Training meetings, automatic briefs are turned on by Insurge and may not be active for your workspace; ask your Insurge contact. You can always request a brief for a finished meeting from its page in the dashboard with **Write brief** (or **Try again** after a failure, **Write again** to redo it); that also sends `meeting.summarized`. A meeting where the visitor never spoke gets a `skipped` brief, except a presentation.

**Repeats.** `meeting.summarized` can arrive more than once for a meeting: each time a brief is written again, a new event with a new ID is sent. Keep the one with the latest `summary.generated_at`.

**Every meeting counts.** `meeting.ended` is sent even when the visitor opened the link and left without speaking (`visitor_spoke: false`). Filter on your side if you only want conversations.

**Test meetings send nothing.** A meeting opened from a test link or a Preview sends no events, and a visitor form filled in on a test link creates no lead. To check delivery, use **Send test** for a `ping`, then open a real sharing link.

Events start when the endpoint is added; earlier meetings are not replayed. Use the [API](/docs/developers/api) to backfill them.

## Request headers and body

Insurge signs every request using [Standard Webhooks](https://www.standardwebhooks.com/), so its libraries can verify them.

| Header | Value |
| --- | --- |
| `Content-Type` | `application/json` |
| `User-Agent` | `Insurge-Webhooks/1.0` |
| `webhook-id` | The event ID, such as `evt_…`. The same on every retry, so use it to drop duplicates. |
| `webhook-timestamp` | When this attempt was sent, in Unix seconds |
| `webhook-signature` | One or more space-separated signatures, each `v1,<base64 signature>` |

Every body has the same envelope. A `ping`:

```json
{
  "id": "evt_ping_example",
  "type": "ping",
  "timestamp": "2026-11-23T10:05:00Z",
  "api_version": "2026-10-22",
  "tenant_id": "your_workspace",
  "data": {
    "message": "A test event from Insurge. Your endpoint is reachable.",
    "endpoint_id": "we_example"
  }
}
```

`id` equals the `webhook-id` header. The envelope `timestamp` is when the event happened (ISO 8601, UTC); the header timestamp is when this attempt was sent. A retry sends exactly the same body. Bodies are compact JSON in UTF-8; the samples here are formatted for reading, use placeholder IDs, and leave out some fields of the meeting and lead records. Ignore fields you do not recognise, and rely only on the fields described on this page.

### Meeting events

A `meeting.ended` event arrives before the brief is written:

```json
{
  "id": "evt_ended_example",
  "type": "meeting.ended",
  "timestamp": "2026-11-23T09:59:48Z",
  "api_version": "2026-10-22",
  "tenant_id": "your_workspace",
  "data": {
    "meeting": {
      "id": "your_meeting_id",
      "lead_id": "your_lead_id",
      "agent_id": "product-tour",
      "status": "completed",
      "started_at": 1795427412.3,
      "ended_at": 1795427987.6,
      "duration_s": 575.3,
      "lang": "en-US",
      "platform": "desktop_web",
      "source": null,
      "embed_host": "www.yoursite.com"
    },
    "lead": {
      "id": "your_lead_id",
      "email": "jane@example.com",
      "name": "Jane Example",
      "company": "Example Co",
      "role": "Operations lead",
      "first_seen_at": 1795427405.8,
      "last_seen_at": 1795427405.8,
      "meeting_count": 1,
      "lead_score": null,
      "status": "engaged",
      "custom_fields": {"team_size": "11-50"},
      "language": null
    },
    "qualification": null,
    "summary": null,
    "follow_up_requested": null,
    "follow_up": null,
    "recording": {
      "status": "processing",
      "content_type": null,
      "size_bytes": null,
      "sha256": null,
      "completed_at": null,
      "expires_at": null,
      "deleted_at": null,
      "deleted_by": null,
      "download_path": null
    },
    "progress": {"sections_done": ["Getting started", "Billing"], "sections_total": 4, "next_section": "Reports"},
    "resumed_from_meeting_id": null,
    "resumable": true,
    "agent": {"id": "product-tour", "name": "Product guide", "kind": "tour"},
    "visitor_identified": true,
    "visitor_spoke": true,
    "transcript": [
      {"at": 0.0, "speaker": "agent", "text": "Hi Jane, welcome. What would you like to see?"},
      {"at": 6.4, "speaker": "visitor", "text": "Show me billing."},
      {"at": 9.1, "speaker": "agent", "text": "Here is the billing page."}
    ],
    "transcript_truncated": false,
    "dashboard_url": "https://dashboard.insurgeai.com/meetings/your_meeting_id"
  }
}
```

The matching `meeting.summarized` event has its own event ID and the finished brief. Its `meeting`, `transcript`, and other fields have the same shape as above:

```json
{
  "id": "evt_summary_example",
  "type": "meeting.summarized",
  "timestamp": "2026-11-23T10:00:31Z",
  "api_version": "2026-10-22",
  "tenant_id": "your_workspace",
  "data": {
    "meeting": {"id": "your_meeting_id", "lead_id": "your_lead_id", "agent_id": "product-tour", "status": "completed"},
    "lead": {"id": "your_lead_id", "email": "jane@example.com", "name": "Jane Example", "lead_score": "hot"},
    "qualification": {
      "need": "Faster invoicing",
      "timeline": "This quarter",
      "authority": "Decides for her team",
      "budget": null,
      "asked_pricing": 1,
      "asked_integration": 0,
      "requested_follow_up": 1,
      "lead_score": "hot",
      "score_rationale": "Asked for pricing and a call this week.",
      "objections": []
    },
    "summary": {
      "status": "ready",
      "generated_at": 1795428031.2,
      "exec_summary": "Jane reviewed billing and asked about pricing for her team.",
      "pain_points": ["Invoicing takes too long"],
      "objections": [],
      "intent_signals": {"asked_pricing": true, "asked_integration": false, "requested_follow_up": true},
      "next_steps": ["Call Jane on Tuesday afternoon"],
      "questions": ["How is pricing calculated?"],
      "unresolved": [],
      "answers": [
        {"question": "Which plan did they want?", "answer": "Pro", "evidence": "The Pro one, for the whole team."},
        {"question": "Who decides?", "answer": null, "evidence": null}
      ]
    },
    "follow_up_requested": true,
    "follow_up": {"status": "agreed", "when": "Tuesday afternoon", "evidence": "Can someone call me on Tuesday afternoon?"},
    "agent": {"id": "product-tour", "name": "Product guide", "kind": "tour"},
    "visitor_identified": true,
    "visitor_spoke": true,
    "transcript": [{"at": 6.4, "speaker": "visitor", "text": "Show me billing."}],
    "transcript_truncated": false,
    "dashboard_url": "https://dashboard.insurgeai.com/meetings/your_meeting_id"
  }
}
```

Both meeting events contain these fields in `data`:

| Field | Meaning |
| --- | --- |
| `meeting` | The meeting: ID, lead ID, agent ID, status, start and end times (Unix seconds), language, device, and the website it was embedded on |
| `lead` | The lead's profile, including custom form answers in `custom_fields`, or `null` |
| `qualification` | Need, timeline, authority, budget, and what the visitor asked about; `null` until a brief is ready |
| `summary` | The brief and its `status`, or `null` before briefing starts |
| `follow_up_requested` | `true` if the visitor asked for a next conversation, `false` if not; `null` until a brief is ready |
| `follow_up` | `status` (`agreed`, `requested`, or `none`), `when` (the visitor's own words for the timing, or `null`), and `evidence` (the visitor's line); `null` whenever `follow_up_requested` is `null` |
| `recording` | The meeting's recording, described as in [Recording events](#recording-events); `status` is `none` when the meeting was not recorded |
| `progress` | How far the visitor got through the agent's brief, merged across every visit of a continued demo: `sections_done`, `sections_total`, and `next_section`; `null` when nothing was recorded |
| `resumed_from_meeting_id` | The meeting this one carried on from through a continue link, or `null` |
| `resumable` | `true` when a continue link can be created for this meeting |
| `agent` | The agent's `id`, `name`, and `kind`, or `null` |
| `visitor_identified` | Whether the lead has a real email |
| `visitor_spoke` | Whether the visitor said or typed anything |
| `transcript` | Visitor and agent lines, oldest first |
| `transcript_truncated` | Whether the transcript was shortened to fit the size limit |
| `dashboard_url` | The meeting's page in the Insurge dashboard |

Every field from `meeting` to `resumable` is exactly the body of `GET /api/v1/meetings/{meeting_id}` in the [API](/docs/developers/api#fetch-a-brief-or-transcript).

**Progress and continue links.** `progress.sections_done` lists the brief's sections the visitor moved past, by title; `next_section` is where a continue link would carry on, or `null` when everything is done. For a brief without a clear numbered outline, `sections_total` and `next_section` are `null` and `sections_done` holds the agent's own short names for what it covered. `resumable` is `true` when this is the visitor's newest visit, they left before the end, they gave their email, and the agent is a Tour guide, Help desk, or Training agent that is switched on. To send a "carry on where you left off" email, act on `meeting.ended` with `resumable: true` and [create a continue link](/docs/developers/api#continue-a-visitors-demo).

**The brief.** On `meeting.ended`, `summary` is `null` or `{"status": "pending"}`. On `meeting.summarized`, `summary.status` is:

- `ready`: the brief is complete.
- `skipped`: the visitor never spoke. There is no brief content; `follow_up_requested` is `false`.
- `failed`: there is no usable brief, even if fields from an earlier brief are still present; `follow_up_requested` is `null`.

**Your questions.** `summary.answers` answers the questions written in the agent's **After the meeting → Questions** box, in the order you wrote them. `answer` and `evidence` are `null` when the visitor did not answer that question; answers are taken only from what the visitor said. `answers` is `null` when the agent had no questions when the brief was written. Match on `question`; editing a question's wording changes it from the next brief on.

**Follow-ups.** To call people back, act on `meeting.summarized` with `follow_up_requested: true`. Nothing is booked on a calendar; `when` is never a date Insurge worked out.

**Scores and kinds.** `agent.kind` is `presenter`, `tour`, `helpdesk`, `copilot`, `onboarding`, or `training`; allow for new values. Lead scores (`hot`, `warm`, `cold`) are set only for presentations and tours. The `qualification.asked_*` and `requested_follow_up` values are `1` or `0`; the same signals in `summary.intent_signals` are booleans.

**Transcripts.** Each line has `at` (seconds from the first line, to 0.1 s), `speaker` (`agent` or `visitor`), and `text`. A voice line that said something different from the written text, such as a translation, also has `spoken`. System notes and tool results are left out. If a body would exceed 1,000,000 bytes, the transcript is shortened, keeping the earliest lines, and `transcript_truncated` is `true`; fetch the whole conversation from `GET /api/v1/meetings/{meeting_id}/transcript` with a key that has `transcripts:read`. Anonymous visitors' emails end in `@anonymous.invalid`. Cost and token usage are never included.

### Recording events

`recording.ready` and `recording.deleted` describe the recording and enough of its meeting to file it. They carry no transcript or brief; `meeting.summarized` has those.

```json
{
  "id": "evt_recording_example",
  "type": "recording.ready",
  "timestamp": "2026-11-23T10:01:12Z",
  "api_version": "2026-10-22",
  "tenant_id": "your_workspace",
  "data": {
    "meeting": {"id": "your_meeting_id", "lead_id": "your_lead_id", "agent_id": "product-tour", "status": "completed", "started_at": 1795427412.3, "ended_at": 1795427987.6},
    "lead": {"id": "your_lead_id", "email": "jane@example.com", "name": "Jane Example"},
    "agent": {"id": "product-tour", "name": "Product guide", "kind": "tour"},
    "visitor_identified": true,
    "recording": {
      "status": "completed",
      "content_type": "video/mp4",
      "size_bytes": 48211934,
      "sha256": "9f2c4a7e0b1d3f5a6c8e9b0d2f4a6c8e0b1d3f5a7c9e1b3d5f7a9c1e3b5d7f9a",
      "completed_at": 1795428072.0,
      "expires_at": 1798019412.3,
      "deleted_at": null,
      "deleted_by": null,
      "download_path": "/api/v1/meetings/your_meeting_id/recording.mp4"
    },
    "dashboard_url": "https://dashboard.insurgeai.com/meetings/your_meeting_id"
  }
}
```

- **Keep recordings in your own storage:** on `recording.ready`, download `download_path` from `https://api.insurgeai.com` with a key that has `recordings:read`, check the file against `sha256`, then delete Insurge's copy with `DELETE /api/v1/meetings/{meeting_id}/recording?sha256=…` and a key that has `recordings:delete`. See [Download and delete recordings](/docs/developers/api#download-and-delete-recordings).
- `expires_at` is when Insurge deletes its copy at the end of its retention period; it is `null` once the recording is gone.
- On `recording.deleted`, `recording.status` is `deleted` or `expired`, and `download_path` is `null`. `deleted_by.kind` is `api_key` or `user` (with its ID), `insurge` (Insurge support, no ID), or `retention` (it expired).
- `meeting.ended` and `meeting.summarized` carry the same `recording` object, so you can also see a recording's state there.

### Lead event

A `lead.created` event contains the new lead and `visitor_identified: true`. Join records on `lead.id`; it is also the `lead_id` returned when a native app [creates a lead](/docs/developers/embed#open-a-meeting-from-a-native-app).

```json
{
  "id": "evt_lead_example",
  "type": "lead.created",
  "timestamp": "2026-11-23T09:50:05Z",
  "api_version": "2026-10-22",
  "tenant_id": "your_workspace",
  "data": {
    "lead": {
      "id": "your_lead_id",
      "email": "jane@example.com",
      "name": "Jane Example",
      "company": "Example Co",
      "role": "Operations lead",
      "first_seen_at": 1795427405.8,
      "last_seen_at": 1795427405.8,
      "meeting_count": 0,
      "lead_score": null,
      "status": "new",
      "custom_fields": {"team_size": "11-50"},
      "language": null
    },
    "visitor_identified": true
  }
}
```

## Verify signatures before processing

Verify the raw request bytes before you parse or trust the JSON. Parsing and re-serialising the body changes its bytes and breaks the signature, so do not put a JSON body parser in front of this route.

The signed content is `{webhook-id}.{webhook-timestamp}.{raw body}`, signed with HMAC-SHA256. The key is the base64-decoded part of your signing secret after `whsec_`. Accept the request if any `v1` signature in the header matches, and reject timestamps more than five minutes from your server's clock. The Standard Webhooks libraries below do all of this; pass them the secret exactly as copied, including `whsec_`.

### Node.js

Install Express and the [Standard Webhooks JavaScript library](https://github.com/standard-webhooks/standard-webhooks/tree/main/libraries/javascript):

```bash
npm install express standardwebhooks
```

This ES-module receiver keeps the raw body and returns `400` when verification fails:

```javascript
import express from "express";
import { Webhook } from "standardwebhooks";

const app = express();
const verifier = new Webhook(process.env.INSURGE_WEBHOOK_SECRET);

app.post("/insurge/events", express.raw({ type: "application/json" }),
  async (req, res) => {
    let event;
    try {
      event = verifier.verify(req.body, req.headers);
    } catch {
      return res.status(400).end();
    }
    try {
      await persistEventOnce(event.id, event);
      return res.status(200).end();
    } catch {
      return res.status(503).end();
    }
  });
app.listen(8080);
```

### Python

Install FastAPI, Uvicorn, and the [Standard Webhooks Python library](https://github.com/standard-webhooks/standard-webhooks/tree/main/libraries/python):

```bash
pip install fastapi uvicorn standardwebhooks
```

This FastAPI receiver reads the raw bytes before verifying them:

```python
import os
from fastapi import FastAPI, HTTPException, Request, Response
from standardwebhooks import Webhook

app = FastAPI()
verifier = Webhook(os.environ["INSURGE_WEBHOOK_SECRET"])

@app.post("/insurge/events")
async def receive(request: Request):
    body = await request.body()
    try:
        event = verifier.verify(body, dict(request.headers))
    except Exception:
        raise HTTPException(400, "Invalid webhook signature")
    try:
        await persist_event_once(event["id"], event)
    except Exception:
        raise HTTPException(503, "Could not persist event")
    return Response(status_code=200)
```

Run it with `uvicorn receiver:app --port 8080` if you saved it as `receiver.py`.

In both examples, `persistEventOnce` / `persist_event_once` is yours to write: save the event to your database or a durable queue with a unique constraint on its ID, and succeed without repeating side effects when the ID is already stored. Return `2xx` only after it has succeeded, and do the slow work in a separate worker. Keep the secret out of logs and responses.

## Delivery and retries

Return any `2xx` within 10 seconds, after you have stored the event. Anything else, including a timeout or connection failure, is retried.

| Behaviour | What Insurge does |
| --- | --- |
| Retries | About 30 seconds, 2 minutes, 10 minutes, 30 minutes, 1 hour, 3 hours, 6 hours, 12 hours, and 24 hours after each failure, with up to 10% jitter |
| Attempts | Up to 10, over about two days |
| `429` or `503` | Waits at least the `Retry-After` you send, up to 24 hours, before the next attempt |
| Duplicates | Possible: delivery is at least once, so drop repeats by event ID |
| Order | Not guaranteed; use `summary.generated_at` and the meeting times to reconcile |
| Redirects | Not followed; a `3xx` counts as a failure |
| `410 Gone` | Disables the endpoint at once |
| Repeated failure | The endpoint is disabled after three days with no successful delivery |
| History | Deliveries and their bodies are kept for 30 days |

The dashboard shows a disabled endpoint and why. Events that happen while it is disabled are not queued for it; re-enabling it resumes deliveries that were waiting for a retry. Use **Retry** in the delivery log to send a delivery again.

## Rotate the signing secret

Select **Rotate secret**, copy the new secret, and deploy it to your receiver. For 24 hours Insurge signs each request with both the old and the new secret, so either one verifies; after that only the new secret signs. Rotating again within those 24 hours retires the oldest secret immediately.

## Payload versions

`api_version` (currently `2026-10-22`) names the payload contract. New fields can be added within a version, so ignore fields you do not recognise. New event types can be added too: an endpoint that receives all events also gets types added later, so ignore types you do not handle and still answer `2xx`. Removing or renaming a field needs a new version. Do not hard-code the example IDs on this page.

The one exception: in November 2026, `meeting.recording_uri` was removed from every payload within version `2026-10-22`. It held Insurge's private storage location, which no receiver could use. Use the `recording` object instead.

## Validate your receiver

Before relying on it, check that:

- **Send test** delivers a signed `ping` that your receiver stores and answers with `2xx`.
- A changed body, a missing signature, or an old timestamp is rejected with `400`.
- The same event sent twice produces one result in your system.
- A temporary failure on your side shows as a retry in **Log**, and the retry succeeds.
- Your code handles `ready`, `failed`, and `skipped` briefs, repeated `meeting.summarized` events, and truncated transcripts.
- Your record mapping copes with events out of order, and with fields and event types it does not know.

See the [API reference](/docs/developers/api) to backfill records, and the [embed guide](/docs/developers/embed#listen-for-milestones) for browser milestones.
