# Webhooks

Receive Chatwise events as signed HTTPS requests to your own server.

A webhook endpoint is a URL of yours that Chatwise sends events to. When a customer writes, on any channel, your server gets a signed POST with the message, its conversation and the account it came in on.

## What a delivery looks like

```http
POST /webhooks/chatwise HTTP/1.1
Host: example.com
Content-Type: application/json
User-Agent: Chatwise-Webhooks/1.0
webhook-id: evt_01JE2Z3QK4T8M6N2R5S7V9W1X3
webhook-timestamp: 1794475538
webhook-signature: v1,L1bPoz66MpwZv1+qbTZ/JIqM6Q++GR68lDnkBgwUnw8=
X-Chatwise-Event: message.received
X-Chatwise-Delivery: wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90

{"id":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3","type":"message.received", …}
```

| Header | What it is |
| --- | --- |
| `webhook-id` | The event's id. It is the same on every retry and redelivery, so dedupe on it. Two endpoints that receive the same event get the same id. |
| `webhook-timestamp` | When this attempt was signed, in Unix seconds. |
| `webhook-signature` | The [signature](https://chatwise.so/docs/webhooks/verify-signatures.md). Two of them while a [secret is rotated](https://chatwise.so/docs/webhooks/secrets.md). |
| `X-Chatwise-Event` | The event's name, to route a request before you parse it. |
| `X-Chatwise-Delivery` | The delivery's id, to find it in the [delivery log](https://chatwise.so/docs/webhooks/testing.md). |
| `User-Agent` | `Chatwise-Webhooks/1.0` |

The body is JSON. Every event has the same outer fields, and `data` depends on the event: see [events](https://chatwise.so/docs/webhooks/events.md).

## Set up an endpoint

**In the dashboard:** open **Settings → Developer → Webhooks**. Workspace admins and owners can manage endpoints there.

**With the API:** [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md) with a key that has `webhooks:write`, and `messages:read` for `message.*` events.

Creating one returns its signing secret, the only time it is shown. Then:

1. [Verify the signature](https://chatwise.so/docs/webhooks/verify-signatures.md) of every request.
2. Answer with a 2xx status within 10 seconds, and do the work afterwards.
3. Skip events you already handled, by `webhook-id`: [delivery is at least once](https://chatwise.so/docs/webhooks/delivery.md).
4. [Send a test event](https://chatwise.so/docs/webhooks/testing.md).

An endpoint receives events that happen after it was created, while it is active.

## Pause, resume and delete

- **Pause** an endpoint by setting its `status` to `PAUSED`. What happens while it is paused isn't sent. Deliveries already waiting are sent once it is active again, to its URL at that time.
- **Resume** it with `ACTIVE`. That also clears its failure count, and turns an endpoint back on that Chatwise [disabled](https://chatwise.so/docs/webhooks/delivery.md#410-gone).
- **Remove an event** from it, and its deliveries that weren't sent yet are cancelled. Changing its accounts cancels none.
- **Delete** it, and all of its deliveries that weren't sent yet are cancelled.

## What is stored and sent

Events carry the full message and conversation. Chatwise keeps a copy of what it sends for [30 days](https://chatwise.so/docs/webhooks/limits.md), for retries and the delivery log. When a message is unsent, deleted or hidden, its waiting deliveries are no longer sent and the log no longer shows it.

## Not to be confused with

- **Flows with a webhook trigger** receive events from other tools. Webhook endpoints send Chatwise events to your server.
- **MCP event subscriptions** wake an AI client that is connected with MCP. They carry ids, not messages, and are set up by the client.
