# Webhooks

Send meetings, briefs, new leads and recordings to your own server as they happen, and watch, re-send or turn off deliveries.

A webhook endpoint is an address on your server that Insurge sends events to as they happen: a meeting ends, its brief is ready, a new lead arrives, or a recording is ready or deleted. You add endpoints, choose their events and watch their deliveries under **Settings → Developers → Webhooks**. Whoever builds the server side needs [Webhooks for developers](/docs/developers/webhooks).

## Before you start

- You need to be an admin in Insurge. Sales users don't see **Settings**. See [Team and roles](/docs/settings/team-and-roles).
- You need the URL your developer set up to receive events. It must start with `https://` and be reachable from the internet.
- For HubSpot or Salesforce, you don't need a webhook: connect them from **Integrations**. See [HubSpot](/docs/integrations/hubspot) and [Salesforce](/docs/integrations/salesforce).

## Add an endpoint

### Open Settings → Developers

Click **Settings** at the bottom of the sidebar, then the **Developers** tab, and scroll to **Webhooks**.

### Click Add endpoint

The **Add endpoint** window opens. A workspace can have up to 10 endpoints; at 10 the button is greyed out.

### Enter the URL and a note

Paste the address into **URL**. Use **Note** to say what it is for, for example `Lead sync to our CRM`.

### Choose events

Switch on the events this endpoint should get, or **All events** to get every event, including types Insurge adds later.

| Switch | Sent when |
|---|---|
| **Meeting ended** | A meeting closes, with its transcript. |
| **Brief ready** | The brief is written, skipped because nobody spoke, or couldn't be written. |
| **New lead** | The first time a visitor gives an email. |
| **Recording ready** | A meeting's recording can be downloaded, with its size and checksum. |
| **Recording deleted** | A recording is deleted, by you or because it expired. |

### Add custom headers, if your server needs them

Under **Custom headers**, click **Add header** for each header your server or its gateway expects, such as its own key. They are sent with every request. You can add up to 10. Headers Insurge sets itself, such as `content-type` and the `webhook-` headers, can't be used.

### Click Add and copy the signing secret

A box appears: **Copy the signing secret now. It won't be shown again.** Copy it with the button next to it and give it to your developer through a safe channel, such as your secrets manager. Their server uses it to check that each request came from Insurge. Then click **I've saved it**.

### Send a test

Click **Send test** on the endpoint's row. Insurge sends a test event at once and tells you **Your endpoint answered** with the status code, or **The test didn't arrive** with the reason.

Events start from the moment the endpoint is added. Meetings opened from a test link or a Preview never send events, so test with a real share link.

## Read an endpoint's row

Each row shows the URL, your note, the events it gets, how many custom headers it has, and how deliveries are going:

| Shows | Means |
|---|---|
| **No deliveries yet** | Nothing has been sent to it. |
| **Delivered** … **ago** | The last delivery worked. |
| **Failing since** … | Deliveries have failed since then and are being tried again. |
| **Off** | It is turned off. The reason follows, such as `The endpoint answered 410 Gone` or `Every delivery failed for 3 days`. |

## See recent deliveries

Click **Log** on the row. The log lists the 50 most recent deliveries.

| Column | Shows |
|---|---|
| **Event** | The event, such as **Meeting ended**. Click it to see its `webhook-id`, the error, and the start of your server's answer. |
| **Result** | **Delivered**, **Queued**, **Retrying** with when, or **Gave up**, and how many tries it took. |
| **Response** | The status code your server answered, or **No answer**, and how long it took. |
| **Sent** | When the event was first queued. |

Insurge retries a failed delivery for about two days, then gives up. The log keeps deliveries for 30 days.

## Re-send a delivery

Click **Retry** on a delivery that hasn't been delivered. It is sent again at once, with the same `webhook-id`, so your server can tell it is the same event. A delivery that **Gave up** gets one more try.

## Turn an endpoint off or on

Use the switch on the endpoint's row. **Endpoint off** confirms it, with **Undo**.

- While an endpoint is off, new events aren't sent to it, and they aren't saved for later.
- Deliveries already waiting are held, and go out when you turn it back on.
- Insurge turns an endpoint off by itself when every delivery has failed for 3 days, or when your server answers `410 Gone`. Fix the server, then turn it back on and **Retry** the deliveries that gave up.
- **Send test** only works while the endpoint is on.

## Edit an endpoint

Click **Edit** to change the URL, note, events or custom headers. Saved header values show as **Saved; type to replace**: leave them to keep them, or type a new value.

## Rotate the signing secret

Rotate the secret if it may have leaked, or on a schedule.

### Click Rotate secret on the row

The **Rotate the signing secret?** window explains that both secrets sign every request for 24 hours.

### Click Rotate and copy the new secret

It is shown once. The old one keeps working beside it for 24 hours.

### Put the new secret on your server within 24 hours

After that, only the new secret signs requests.

## Delete an endpoint

Click the bin icon on the row, then **Delete** in **Delete this endpoint?**. Nothing more is sent to it, and its delivery log is deleted with it. To stop for a while instead, turn it off.

## Troubleshooting

#### Saving the endpoint shows an error about the URL

- `The URL must start with https://.` Plain `http://` isn't accepted.
- `Put credentials in a header, not in the URL.` Remove the user name and password from the URL and add them under **Custom headers**.
- `That address is private; a webhook must reach a public server.` The URL points inside a private network. Use an address the internet can reach.

#### The test didn't arrive

The message says why: no answer in 10 seconds, a refused connection, or a status your server returned. Check the URL with your developer. A redirect counts as a failure, so use the final address.

#### Deliveries show 401 or 403

Your server or its gateway refused the request. If it expects its own key, add it under **Custom headers**.

#### No Brief ready events for some meetings

Presentation meetings always get a brief. Meetings with other agents get one when Insurge has turned briefs on for them, or when someone writes it from the meeting's page. Ask your Insurge contact if you need briefs for those agents.

#### I didn't get events for my test meetings

Meetings from a test link or a Preview never send events. Use one of the agent's share links.
