Source: https://chatwise.so/docs # Chatwise API What you can build with the Chatwise API: read the inbox, send WhatsApp templates, and receive events by webhook. Chatwise is one shared inbox for WhatsApp, Instagram, Messenger and Website Chat. The API lets your own software work with that inbox. | You want to | Use | | --- | --- | | Read conversations and messages | [Conversations](https://chatwise.so/docs/api/list-conversations.md) and [messages](https://chatwise.so/docs/api/list-messages.md), on every channel | | Search message text | [List or search messages](https://chatwise.so/docs/api/list-messages.md) | | Send an approved WhatsApp template | [By id](https://chatwise.so/docs/api/send-message.md) or [by name](https://chatwise.so/docs/api/send-whatsapp-template.md) | | Find or create WhatsApp templates | [List](https://chatwise.so/docs/api/list-whatsapp-templates.md) and [create](https://chatwise.so/docs/api/create-whatsapp-template.md) | | Know when a customer writes | [Webhooks](https://chatwise.so/docs/webhooks.md) | Start with the [quickstart](https://chatwise.so/docs/quickstart.md): create a key, make a request and receive your first webhook. ## How it works - **Base URL:** `https://api.chatwise.so`. Requests and responses are JSON. - **API keys:** every request sends a key, which belongs to one workspace and has only the [scopes](https://chatwise.so/docs/authentication.md) you gave it. - **Ids are strings**, even when they look like numbers. Don't parse them. - **Times** are ISO 8601 in UTC, such as `2026-11-12T09:25:36.000Z`. - **Results** are in `data`. Long lists also have a [cursor](https://chatwise.so/docs/pagination.md). - **The same objects everywhere:** a webhook sends the message and conversation the API returns, with the same fields, as they were when the event was prepared. ## What the API doesn't do - **It sends WhatsApp templates only.** Free-form replies are sent from the Chatwise inbox or by an AI client connected to it. - **It doesn't return files.** Attachments have a type and, usually only on Instagram, a media id, but no link to download them. Messages from Messenger and Website Chat list no attachments: an image there is a message without one. ## For AI agents Every page is also plain Markdown: add `.md` to its address. [Docs for agents](https://chatwise.so/docs/agents.md) lists everything made for agents, such as [llms.txt](https://chatwise.so/llms.txt) and the [OpenAPI file](https://chatwise.so/docs/openapi.json). To let an assistant like Claude or ChatGPT work in your inbox, connect it with MCP instead: see [integrations](https://chatwise.so/integrations#setup). --- Source: https://chatwise.so/docs/quickstart # Quickstart Create an API key, make your first request and receive your first webhook. You need a Chatwise workspace you are an admin of, and Node.js 20 or later, or Python 3.9 or later, to run the samples. ## 1. Create an API key 1. In the dashboard, open **Settings → Developer → API Keys** ([open it](https://app.chatwise.so/settings/api-keys)). 2. Select **New key** and name it. 3. Choose **Read conversations**, **Read messages**, **Read webhook endpoints** and **Manage webhook endpoints**. 4. Create it and copy the key. It is shown once. Keep the key on your server, for example in an environment variable: ```bash export CHATWISE_API_KEY='paste your key here' ``` ## 2. Make a request List the latest conversations: **curl**: ```bash curl 'https://api.chatwise.so/v1/conversations?limit=5' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/conversations?limit=5", { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}` }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/conversations?limit=5", headers={"Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}"}, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` `data` holds the conversations, and `pagination.nextCursor` leads to the [next page](https://chatwise.so/docs/pagination.md). An answer that isn't 2xx has a `message` that says what is wrong: see [errors](https://chatwise.so/docs/errors.md). ## 3. Receive a webhook Chatwise sends events to a public `https://` URL on port 443. While you develop, a tunnel to your machine gives you one. **Create the endpoint.** Replace the URL with yours: ```bash curl -X POST 'https://api.chatwise.so/v1/webhook-endpoints' \ -H "Authorization: Bearer $CHATWISE_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "name": "Quickstart", "url": "https://example.com/webhooks/chatwise", "events": ["message.received"] }' ``` The answer has the endpoint's `id` and its `signingSecret`. The secret is shown only now, so keep it like the API key: ```bash export CHATWISE_WEBHOOK_SECRET='paste the signing secret here' ``` **Run a receiver.** Copy the server and the function it uses from [verify signatures](https://chatwise.so/docs/webhooks/verify-signatures.md) into two files, and start it where your URL leads: **Node.js**: ```bash node server.mjs ``` **Python**: ```bash python3 server.py ``` **Send a test event.** Use the endpoint's `id`: ```bash curl -X POST 'https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/test' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` The answer says what your endpoint did: ```json { "data": { "delivered": true, "statusCode": 204, "durationMs": 182, "error": null } } ``` If `delivered` is false, see [testing](https://chatwise.so/docs/webhooks/testing.md). **Write to your own inbox.** Send a message to one of your connected accounts from another phone or account. Your receiver gets a [`message.received`](https://chatwise.so/docs/webhooks/events/message-received.md) event. ## Next - [Delivery and retries](https://chatwise.so/docs/webhooks/delivery.md): what Chatwise does with each answer, and why to dedupe. - [Authentication and scopes](https://chatwise.so/docs/authentication.md): give each integration only what it needs. - [API reference](https://chatwise.so/docs/api.md): every route. --- Source: https://chatwise.so/docs/authentication # Authentication and scopes Create API keys, send them with each request, and give each key only the scopes it needs. Every request needs an API key in the `Authorization` header: ```http GET /v1/conversations HTTP/1.1 Host: api.chatwise.so Authorization: Bearer ``` A key belongs to one workspace, so no request names a workspace. ## Create a key Workspace admins create keys in the dashboard, under **Settings → Developer → API Keys** ([open it](https://app.chatwise.so/settings/api-keys)). Choose a name, the permissions and when it expires: in at most 365 days, or never. The key is shown once. Chatwise stores only a hash of it and can't show it again. Keep keys on your server. Don't put one in a web page, a mobile app or a repository: anyone who has it can use it. ## Scopes A key can do only what its scopes allow. | Scope | In the dashboard | What it allows | | --- | --- | --- | | `conversations:read` | Read conversations | List, find and read conversations. | | `messages:read` | Read messages | List, search and read messages. Also needed for anything that would give the key a message by webhook, see below. | | `messages:send` | Send messages | Send approved WhatsApp templates. | | `templates:read` | Read templates | List and read WhatsApp templates. | | `templates:write` | Create templates | Create WhatsApp templates and submit them to Meta. | | `webhooks:read` | Read webhook endpoints | List webhook endpoints, their deliveries and the event types. | | `webhooks:write` | Manage webhook endpoints | Create, change, test and delete webhook endpoints, rotate their secrets and redeliver. | One scope doesn't include another: `webhooks:write` alone can't list endpoints. Each page of the [API reference](https://chatwise.so/docs/api.md) names the scope its route needs. You can't change a key's scopes. Create another key and revoke the old one. ### When `messages:read` is needed too Webhooks carry messages, so a key must not get a message by webhook that it couldn't read through the API. With `message.*` events, these need `messages:read` as well: | What you do | Scope | Also | | --- | --- | --- | | [Create an endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md) with `message.*` events | `webhooks:write` | `messages:read` | | [Change an endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md) that has them, or add them | `webhooks:write` | `messages:read` | | [Rotate the secret](https://chatwise.so/docs/api/rotate-webhook-secret.md) of an endpoint that has them | `webhooks:write` | `messages:read` | | [Read a delivery](https://chatwise.so/docs/api/get-webhook-delivery.md) of a `message.*` event | `webhooks:read` | `messages:read` | | [Redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md) a `message.*` event | `webhooks:write` | `messages:read` | [Testing](https://chatwise.so/docs/api/test-webhook-endpoint.md) and [deleting](https://chatwise.so/docs/api/delete-webhook-endpoint.md) an endpoint, and [listing its deliveries](https://chatwise.so/docs/api/list-webhook-deliveries.md), don't need it: they return no messages. ## Rotate a key 1. Create a key with the same scopes. 2. Deploy it. 3. Make a request with it. 4. Revoke the old key in the dashboard. A revoked or expired key stops working right away: it answers `401`. ## When a key is refused | Status | Message | What to do | | --- | --- | --- | | 401 | A valid Bearer API key is required | Send `Authorization: Bearer` and the key. | | 401 | Invalid or revoked API key | Check the key. It may have been revoked, or have expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: … | Use a key with the scope the message names. | | 400 | Message events need an API key with the messages:read scope too. | Subscribe with a key that also has `messages:read`. | | 403 | Changing an endpoint that receives message events needs an API key with the messages:read scope too. | The same, for changing an endpoint or rotating its secret. | | 403 | Reading a message event's delivery needs an API key with the messages:read scope too. | The same, for reading or redelivering a delivery. | | 429 | API key rate limit exceeded | [Wait](https://chatwise.so/docs/rate-limits.md), then go on. | --- Source: https://chatwise.so/docs/pagination # Pagination Read long lists page by page with cursors, and pull only what is new. Lists come in pages. Each answer has the items in `data` and, in `pagination.nextCursor`, where the next page starts: ```json { "data": [], "pagination": { "nextCursor": "eyJ2IjoxLCJiaW5kaW5nIjoiZXhhbXBsZSJ9" } } ``` - `limit` sets how many items a page has, from 1 to 100. The default is 50. - Leave out `cursor` for the first page. For the next one, send `nextCursor` as `cursor` and repeat the same filters and order. - `nextCursor` is `null` on the last page. - A cursor only works with the request it came from. With other filters, or another order, it is refused with a 400. Don't read or build cursors yourself. - Conversations are sorted by their latest message, so one that gets a message while you read the pages moves to the top, and you can miss it. ## Read every page **Node.js**: ```js async function* everyItem(path, query = {}) { let cursor; do { const search = new URLSearchParams({ ...query, limit: "100", ...(cursor && { cursor }) }); const response = await fetch(`https://api.chatwise.so${path}?${search}`, { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}` }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); yield* body.data; cursor = body.pagination.nextCursor; } while (cursor); } for await (const message of everyItem("/v1/messages", { channel: "WHATSAPP" })) { console.log(message.id, message.text); } ``` **Python**: ```python import json import os import urllib.parse import urllib.request def every_item(path, **query): cursor = None while True: search = urllib.parse.urlencode({**query, "limit": 100, **({"cursor": cursor} if cursor else {})}) request = urllib.request.Request( f"https://api.chatwise.so{path}?{search}", headers={"Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}"}, ) with urllib.request.urlopen(request) as response: body = json.load(response) yield from body["data"] cursor = body["pagination"]["nextCursor"] if not cursor: return for message in every_item("/v1/messages", channel="WHATSAPP"): print(message["id"], message["text"]) ``` ## Which routes have pages [Conversations](https://chatwise.so/docs/api/list-conversations.md), [messages](https://chatwise.so/docs/api/list-messages.md), [a conversation's messages](https://chatwise.so/docs/api/list-conversation-messages.md), [WhatsApp templates](https://chatwise.so/docs/api/list-whatsapp-templates.md) and [webhook deliveries](https://chatwise.so/docs/api/list-webhook-deliveries.md). Webhook endpoints and event types are short lists and come whole. ## Filter by date Conversations and messages take `from` and `to`: ISO 8601 times with a time zone and at most milliseconds, such as `2026-11-01T00:00:00Z`. `from` is included, `to` isn't, and `from` must come before `to`. In a URL, write the `+` of a time zone such as `+05:30` as `%2B`. ## Pull only new messages To copy messages on a schedule, sort by when Chatwise stored them. That also finds imported history, whose `sentAt` is older: ```bash curl 'https://api.chatwise.so/v1/messages?timeField=ingestedAt&order=asc&from=2026-11-13T00:00:00Z&to=2026-11-14T00:00:00Z&limit=100' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` Keep `to` fixed while you read the pages of one run, let runs overlap a little, and dedupe by message `id`. To get messages as they arrive instead, use [webhooks](https://chatwise.so/docs/webhooks.md). --- Source: https://chatwise.so/docs/errors # Errors How errors are shaped, what each status means, and which requests to retry. A route that refuses or fails answers with a 4xx or 5xx status and a JSON body. `message` says what is wrong, and some errors have more fields. [Every error](https://chatwise.so/docs/api/all-errors.md) lists them all. An address that isn't a public route can answer 404 with HTML, or 401 with the message `Unauthorized`. If you get one of those, check the path and the method. ## Shapes **Most errors** have only a message. Some 500s also have an `errorId`: quote it when you contact support. ```json { "message": "Conversation not found" } ``` **Invalid parameters and fields.** `errors` has one entry for each problem. `path` starts with `params`, `query`, `headers` or `body`. ```json { "message": "Validation failed", "errors": [ { "path": "query.limit", "message": "Limit must be an integer between 1 and 100" } ] } ``` **A value that was refused.** `field` names it, and some have more in `data`. ```json { "object": "Webhook endpoint", "field": "url", "message": "Use a public https:// URL on port 443, without a username, password or #fragment." } ``` **Errors with a code.** Check `code` in your program, not `message`. ```json { "code": "TEMPLATE_EXISTS", "message": "A WhatsApp template with this name and language already exists" } ``` ## Codes | Code | Status | What it means | | --- | --- | --- | | `ADMIN_SERVICES_BLOCKED` | 402 | Sending is paused for the workspace. Contact support. | | `WHATSAPP_REAUTH_REQUIRED` | 403 | Meta no longer accepts Chatwise's access to the number. `reason` is `expired`, `revoked` or `missing`. Reconnect it in the dashboard. | | `TEMPLATE_EXISTS` | 409 | There is a template with this name and language. | | `IDEMPOTENCY_KEY_REUSED` | 409 | The key was used with another template. | | `TEMPLATE_SUBMISSION_IN_PROGRESS` | 409 | A submission of this name and language, with this key or another, is running or unconfirmed. Wait, then repeat it with the key it was made with. | | `TEMPLATE_SUBMISSION_UNCONFIRMED` | 409, 502 | Meta hasn't confirmed the submission. Repeat it with the same key and body. If a 409 keeps coming back, Meta doesn't have the template: submit it under another name. | | `WHATSAPP_CONNECTION_CHANGED` | 409 | The workspace connected another WhatsApp Business Account since. Submit again with a new key. | | `WHATSAPP_LOOKUP_FAILED` | 502 | Meta couldn't be asked about the submission. Repeat it with the same key and body. | | `WHATSAPP_RATE_LIMITED` | 503 | WhatsApp is limiting submissions. Wait, then repeat it with the same key and body. | ## Statuses | Status | What it means | Retry? | | --- | --- | --- | | 400 | A parameter, body field, cursor or date range is invalid, or a key without `messages:read` subscribes to message events. | No. Fix the request. | | 401 | The key is missing, invalid, expired or revoked. | No, except `Invalid API key`. | | 402 | Sending is paused for the workspace. | No. | | 403 | The key lacks a scope, WhatsApp has to be reconnected, or its account can't create templates. | No. | | 404 | It doesn't exist in the key's workspace, or the workspace has no connected WhatsApp number. | No. | | 409 | A template submission conflicts with an earlier one. | As its code says. | | 413 | The body is larger than 100 KB. | No. | | 429 | Too many requests with this key. | Yes, after `Retry-After` seconds. | | 500 | Something failed in Chatwise, or WhatsApp didn't accept a message you sent. | Reads: yes, with growing waits. Template creation: yes, with the same key and body. Sends: see below. | | 502, 503 | Meta didn't confirm a template submission, or is busy. | Template creation: yes, with the same key and body. Sends: see below. | ## Sends aren't retried safely The two send routes have no idempotency key. After a timeout, or a 500, 502 or 503, read the conversation's messages before you send again. If the message is there, it was sent. If it isn't, it may still have been sent. When WhatsApp doesn't accept a message, the answer is a 500 whose `message` starts with `Internal server error: WhatsApp send failed:`, followed by Meta's HTTP status and, when that was JSON, Meta's answer: - **429:** try again later. - **5xx:** check the conversation first, as above. - **Anything else:** fix what the answer names. The same request will fail again. A send that isn't accepted can still create the customer's conversation, without a message. --- Source: https://chatwise.so/docs/rate-limits # Rate limits How many requests a key can make, and what to do when it makes too many. By default each API key can make **120 requests a minute**, across all routes. The count starts again with every minute of the clock. A request over the limit isn't carried out. It answers `429` with a `Retry-After` header, in seconds: ```http HTTP/1.1 429 Too Many Requests Retry-After: 60 {"message":"API key rate limit exceeded"} ``` Wait that long, then repeat the request: **Node.js**: ```js async function chatwise(path, options = {}) { for (;;) { const response = await fetch(`https://api.chatwise.so${path}`, { ...options, headers: { ...options.headers, Authorization: `Bearer ${process.env.CHATWISE_API_KEY}` }, }); if (response.status !== 429) return response; const seconds = Number(response.headers.get("retry-after") ?? 60); await new Promise((resolve) => setTimeout(resolve, seconds * 1000)); } } ``` **Python**: ```python import os import time import urllib.error import urllib.request def chatwise(path): request = urllib.request.Request( f"https://api.chatwise.so{path}", headers={"Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}"}, ) while True: try: return urllib.request.urlopen(request) except urllib.error.HTTPError as error: if error.code != 429: raise time.sleep(int(error.headers.get("Retry-After", 60))) ``` ## Stay under it - Read lists with `limit=100`. - Use [webhooks](https://chatwise.so/docs/webhooks.md) instead of asking again and again for new messages. - Give each integration its own key: each key has its own limit. A request refused because its key is invalid or lacks the route's scope doesn't count. Meta has limits of its own for sending and creating templates. --- Source: https://chatwise.so/docs/several-accounts # Several accounts Work with workspaces that connect several WhatsApp numbers, Instagram accounts, Messenger Pages or websites. A workspace can connect several WhatsApp numbers, Instagram accounts, Messenger Pages and Website Chat sites. Each is an **account** with an id. Webhook events and endpoints name accounts by that id. Conversations and messages from the API don't name their account. ## Conversations belong to one account A customer who writes to two of your numbers has two conversations. Tell them apart by the conversation's `id`, not by the customer's phone number. ## Which account a webhook is about Every [`message.received`](https://chatwise.so/docs/webhooks/events/message-received.md) event names the account the customer wrote to: ```json { "data": { "account": { "id": "11", "channel": "WHATSAPP" } } } ``` `data.account` is `null` for a conversation that has no account. ## Webhooks for some accounts only An endpoint receives events from every account unless you list some in `accountIds`: ```bash curl -X POST 'https://api.chatwise.so/v1/webhook-endpoints' \ -H "Authorization: Bearer $CHATWISE_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "name": "Support number only", "url": "https://example.com/webhooks/chatwise", "events": ["message.received"], "accountIds": ["11"] }' ``` Without `accountIds`, or with an empty list, the endpoint also receives events from accounts you connect later. The API has no route that lists accounts. The ids are in webhook events. Once a channel has several accounts, the dashboard lets you choose them by name. ## Which number a template is sent from Both send routes take `from`: one of the workspace's connected WhatsApp numbers, digits only. ```json { "to": "12025550147", "channel": "WHATSAPP", "templateId": "123456789012345", "from": "12025550199" } ``` Without `from`, the message goes out from a connected number on the template's WhatsApp Business Account: the one the customer last wrote to, else the oldest. So with several numbers the sender depends on the customer: send `from` to choose it yourself. The answer's `from` says which number was used. A template belongs to one WhatsApp Business Account, and only numbers on that account can send it: - [Send by id](https://chatwise.so/docs/api/send-message.md) refuses a `from` on another account with a 400. - [Send by name](https://chatwise.so/docs/api/send-whatsapp-template.md) looks the template up on the account of the `from` number. Without `from`, it takes the first approved template with that name, on any account. A `from` that isn't connected is refused with a 400, whose `data.accounts` lists the connected numbers. --- Source: https://chatwise.so/docs/agents # Docs for agents Markdown pages, llms.txt and an OpenAPI file, for AI agents and the people who build with them. Everything in these docs can be read without a browser, a script or an account. | What | Where | | --- | --- | | An index of every page | [/llms.txt](https://chatwise.so/llms.txt) | | Every page in one file | [/llms-full.txt](https://chatwise.so/llms-full.txt) | | One page as Markdown | Its address with `.md`, such as [/docs/quickstart.md](https://chatwise.so/docs/quickstart.md) | | Every route and event, with schemas and examples | [/docs/openapi.json](https://chatwise.so/docs/openapi.json) (OpenAPI 3.1) | - **Markdown by header.** A request for a page with `Accept: text/markdown` gets the same Markdown. - **Copy a page.** Each page has a button that copies its Markdown. - **Complete pages.** The page of an event has everything needed to handle it: headers, an example, every field and the code that verifies the signature. The page of a route has its scope, fields, examples and errors. - **All samples are there.** On the website the samples of a step are tabs. In Markdown each one follows the other. ## Signed examples to test with The OpenAPI file has `x-webhook-signing-examples`: two deliveries with their secret, headers and exact body, signed by the code that signs real ones. Use them to test a receiver without sending anything. They are old, so pass their timestamp as the current time. ## Generated from the code The API reference and the event pages are generated from the OpenAPI file, and that is built from the code of the API: its routes, scopes, request checks and response types. An event the API doesn't send yet is marked **coming soon**. --- Source: https://chatwise.so/docs/webhooks # 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. --- Source: https://chatwise.so/docs/webhooks/verify-signatures # Verify signatures Check that a webhook really comes from Chatwise, with samples in Node.js and Python. Anyone can send a request to your URL. The signature proves that it comes from Chatwise, that nobody changed it and that it isn't an old one sent again. Chatwise signs the way [Standard Webhooks](https://www.standardwebhooks.com) does, so the libraries of that project can verify it too. The samples below need no library. ## How it is signed 1. The key is your signing secret without `whsec_`, decoded from base64. 2. The signed text is the `webhook-id` header, a dot, the `webhook-timestamp` header, a dot, and the raw body. 3. The signature is `v1,` and the base64 of the HMAC-SHA256 of that text. 4. `webhook-signature` holds one signature, or two with a space between them while a [secret is rotated](https://chatwise.so/docs/webhooks/secrets.md). To verify a request: - **Use the raw body**, byte for byte. Parsing the JSON and writing it again can change it, and then no signature matches. - **Refuse old timestamps.** The timestamp is signed, and it is new on every attempt, so a request that is more than five minutes old isn't a retry. - **Accept any matching signature**, and compare in constant time. - **Limit what you read.** Until the signature is checked, the request can be from anyone. An event is at most 256 KiB. - **Answer 400** when nothing matches. ## Verify **Node.js** `verify.mjs`: ```js import { createHmac, timingSafeEqual } from "node:crypto"; const FIVE_MINUTES = 5 * 60; // rawBody is the request body exactly as received (a Buffer or a string). // headers has lowercase names, as Node's request.headers does. export function verifyChatwiseWebhook(rawBody, headers, secret, now = Date.now() / 1000) { const id = headers["webhook-id"]; const timestamp = headers["webhook-timestamp"]; const signatures = headers["webhook-signature"]; if (!id || !timestamp || !signatures) return false; // Refuse old requests, so a captured one can't be sent again later. if (!(Math.abs(now - Number(timestamp)) <= FIVE_MINUTES)) return false; const key = Buffer.from(secret.slice("whsec_".length), "base64"); const expected = createHmac("sha256", key).update(`${id}.${timestamp}.`).update(rawBody).digest(); // While a secret is being rotated there are two signatures. One match is enough. return signatures.split(" ").some((signature) => { const [version, value = ""] = signature.split(","); const received = Buffer.from(value, "base64"); return version === "v1" && received.length === expected.length && timingSafeEqual(received, expected); }); } ``` **Python** `verify.py`: ```python import base64 import hashlib import hmac import time FIVE_MINUTES = 5 * 60 def verify_chatwise_webhook(raw_body, headers, secret, now=None): """raw_body is the request body exactly as received, as bytes. headers is a mapping with case-insensitive or lowercase names. """ message_id = headers.get("webhook-id") timestamp = headers.get("webhook-timestamp") signatures = headers.get("webhook-signature") if not message_id or not timestamp or not signatures: return False # Refuse old requests, so a captured one can't be sent again later. try: age = abs((time.time() if now is None else now) - int(timestamp)) except ValueError: return False if age > FIVE_MINUTES: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{message_id}.{timestamp}.".encode() + raw_body expected = "v1," + base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode() # While a secret is being rotated there are two signatures. One match is enough. return any( hmac.compare_digest(signature.encode(), expected.encode()) for signature in signatures.split(" ") ) ``` ## A complete server It reads the raw body, at most the 256 KiB an event can have, verifies it, skips events it already handled, and answers before it does the work. It remembers events in memory, so it loses them when it stops: use it to try things out. Save it next to the file above. **Node.js** `server.mjs`: ```js import { createServer } from "node:http"; import { verifyChatwiseWebhook } from "./verify.mjs"; const secret = process.env.CHATWISE_WEBHOOK_SECRET; const MAX_BODY_BYTES = 256 * 1024; // The largest event Chatwise sends. // In production, keep the events in your database: save one, answer, then do the work. const handled = new Set(); async function handle(event) { if (event.type === "message.received") { console.log(`New message in conversation ${event.data.message.conversationId}`); } } async function receive(request, response) { // Anyone can send a request, so don't read more than an event can be. if (Number(request.headers["content-length"] ?? 0) > MAX_BODY_BYTES) { response.writeHead(413, { Connection: "close" }).end(); return; } const chunks = []; let size = 0; for await (const chunk of request) { size += chunk.length; if (size > MAX_BODY_BYTES) throw new Error("The body is too large"); chunks.push(chunk); } const rawBody = Buffer.concat(chunks); if (!verifyChatwiseWebhook(rawBody, request.headers, secret)) { response.writeHead(400).end(); return; } // The same event can arrive more than once. const id = request.headers["webhook-id"]; const isNew = !handled.has(id); handled.add(id); // Answer within 10 seconds, then do the work. response.writeHead(204).end(); if (isNew) await handle(JSON.parse(rawBody)); } const server = createServer((request, response) => { receive(request, response).catch((error) => { console.error(error.message); response.destroy(); }); }); server.listen(Number(process.env.PORT ?? 3000)); ``` **Python** `server.py`: ```python import json import os from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer from verify import verify_chatwise_webhook SECRET = os.environ["CHATWISE_WEBHOOK_SECRET"] MAX_BODY_BYTES = 256 * 1024 # The largest event Chatwise sends. # In production, keep the events in your database: save one, answer, then do the work. handled = set() def handle(event): if event["type"] == "message.received": print(f"New message in conversation {event['data']['message']['conversationId']}", flush=True) class Webhooks(BaseHTTPRequestHandler): timeout = 10 # Seconds a sender may take. def do_POST(self): # Anyone can send a request, so don't read more than an event can be. length = self.headers.get("Content-Length", "") if not length.isdecimal() or int(length) > MAX_BODY_BYTES: self.answer(413) return raw_body = self.rfile.read(int(length)) if not verify_chatwise_webhook(raw_body, self.headers, SECRET): self.answer(400) return # The same event can arrive more than once. event_id = self.headers["webhook-id"] is_new = event_id not in handled handled.add(event_id) # Answer within 10 seconds, then do the work. self.answer(204) if is_new: handle(json.loads(raw_body)) def answer(self, status): self.send_response(status) self.end_headers() self.wfile.flush() ThreadingHTTPServer(("", int(os.environ.get("PORT", "3000"))), Webhooks).serve_forever() ``` Start it with the secret you got when you created the endpoint: **Node.js**: ```bash CHATWISE_WEBHOOK_SECRET='whsec_…' node server.mjs ``` **Python**: ```bash CHATWISE_WEBHOOK_SECRET='whsec_…' python3 server.py ``` ## In a framework Many frameworks parse JSON before your code runs, and some refuse a body as large as an event can be. Get both right: the raw body, and a limit of at least 256 KiB. A request your framework refuses with a 413 is a failed delivery that [isn't retried](https://chatwise.so/docs/webhooks/delivery.md#what-each-answer-does). | Framework | The raw body | Its limit for a body | | --- | --- | --- | | Express | `express.raw({ type: "application/json", limit: "300kb" })` on the route | Takes at most 100 KB by default, which is too little: always set `limit` | | Next.js route handlers | `await request.text()` | Has no limit: answer 413 yourself when `content-length` is over 300 KB | | Flask | `request.get_data()` | Has no limit by default: set `app.config["MAX_CONTENT_LENGTH"] = 300 * 1024` | | FastAPI | `await request.body()` | Has no limit: answer 413 yourself when `content-length` is over 300 KB | A proxy or a host in front of your server can have a limit of its own. With Express, next to `verify.mjs`: `express.mjs`: ```js import express from "express"; import { verifyChatwiseWebhook } from "./verify.mjs"; const secret = process.env.CHATWISE_WEBHOOK_SECRET; const app = express(); // The raw body, and room for the largest event (256 KiB): Express allows 100 KB unless you say otherwise. const rawBody = express.raw({ type: "application/json", limit: "300kb" }); app.post("/webhooks/chatwise", rawBody, (request, response) => { // The body is only bytes if the request said it was JSON. if (!Buffer.isBuffer(request.body) || !verifyChatwiseWebhook(request.body, request.headers, secret)) { response.sendStatus(400); return; } // Skip events you already handled, by webhook-id, as in the complete server above. response.sendStatus(204); const event = JSON.parse(request.body); console.log(`Received ${event.type}`); }); app.listen(Number(process.env.PORT ?? 3000)); ``` ## If it doesn't match - The secret is another endpoint's, or it was [rotated](https://chatwise.so/docs/webhooks/secrets.md) more than 24 hours ago. - The body was parsed, decoded or reformatted before it was verified. - A proxy in front of your server changes the body or removes the `webhook-` headers. - Your server's clock is more than five minutes off. [Send a test event](https://chatwise.so/docs/webhooks/testing.md) to try again: it is signed like every other event. --- Source: https://chatwise.so/docs/webhooks/delivery # Delivery and retries What Chatwise does with each answer, when it tries again, and how to handle an event more than once. ## Answer quickly Answer with any **2xx** status within **10 seconds**. Only the status counts: Chatwise doesn't read the body. Save the event or put it in a queue, answer, and do the work afterwards. An endpoint that does slow work before it answers times out, and gets the same event again. ## What each answer does | Your answer | What happens | | --- | --- | | 2xx | Delivered. | | 408, 425, 429 or 5xx | Retried. | | No answer in 10 seconds, or a connection error | Retried. | | [410 Gone](#410-gone) | Failed, and the endpoint is disabled. | | Any other status, redirects included | Failed, without a retry. | So answer 4xx only for a request you will never accept, such as one whose signature is wrong. Make sure nothing in front of your code does it for you: a framework or proxy that [limits bodies](https://chatwise.so/docs/webhooks/verify-signatures.md#in-a-framework) to less than 256 KiB answers 413 to large events, and those aren't retried. If a mistake of yours refused good events, fix it and [redeliver](https://chatwise.so/docs/webhooks/testing.md#redeliver) them. ## Retry schedule A delivery is tried 8 times. After a failed attempt the next one comes after: | Attempt | Waits after the one before | | --- | --- | | 1 | The first attempt | | 2 | 10 seconds | | 3 | 1 minute | | 4 | 5 minutes | | 5 | 30 minutes | | 6 | 2 hours | | 7 | 6 hours | | 8 | 16 hours | Each wait can be up to 20% shorter, so that many retries don't arrive together. When all 8 attempts failed, the delivery fails with `retry_exhausted`, and `lastStatusCode` has the last answer's status. Every attempt sends the same event with the same `webhook-id`. The `webhook-timestamp` and the signature are new each time. ## Handle an event more than once Delivery is **at least once**. The same event can arrive again, for example when your answer got lost on the way or someone redelivers it. Keep the `webhook-id` of every event you handled, and skip one you already have. If two endpoints lead to the same receiver, an event they both receive arrives twice with the same id: ```sql CREATE TABLE handled_webhooks (id text PRIMARY KEY, handled_at timestamptz NOT NULL DEFAULT now()); -- In the transaction that does the work. No row inserted: it was already handled. INSERT INTO handled_webhooks (id) VALUES ($1) ON CONFLICT DO NOTHING; ``` Keep the ids for at least 30 days, as long as an event can be redelivered. ## Don't rely on the order Events can arrive in another order than they happened, above all after a retry. Sort by `data.message.sentAt` where the order matters, or [read the conversation's messages](https://chatwise.so/docs/api/list-conversation-messages.md). ## 410 Gone Answer 410 to say that a URL doesn't want events any more. Chatwise then: - marks the delivery as failed, without a retry; - sets the endpoint's `status` to `DISABLED`, with the reason in `health.disabledReason`. A disabled endpoint receives nothing. To turn it on again, [set its status](https://chatwise.so/docs/api/update-webhook-endpoint.md) to `ACTIVE`. Its deliveries that were still waiting are then sent, but events that happened in between aren't. Nothing else disables an endpoint. ## What isn't sent - **Events from before the endpoint** was created, or from while it was paused or disabled. - **A message that was unsent, deleted or hidden** before its delivery went out. The delivery fails with `message_removed`, which doesn't count against the endpoint. If the event wasn't prepared yet, there is no delivery. - **An event larger than 256 KiB.** The delivery fails with `payload_too_large`. - **An event whose payload can't be built.** There is no delivery. ## Slow endpoints Chatwise sends an endpoint only a few requests at a time, so one that answers slowly delays its own events, and can delay those of the workspace's other endpoints. [Get the endpoint](https://chatwise.so/docs/api/get-webhook-endpoint.md) to see how it is doing: `health` has its last success, its last failure and how many attempts failed in a row. --- Source: https://chatwise.so/docs/webhooks/secrets # Rotate the secret Replace an endpoint's signing secret without missing a delivery. Each endpoint has one signing secret: `whsec_` and 32 random bytes in base64. It is returned when you create the endpoint and when you rotate it, and never again. Rotate it when someone who shouldn't have it may have seen it, or if you lost it. ## How a rotation works [Rotate the signing secret](https://chatwise.so/docs/api/rotate-webhook-secret.md), in the dashboard or with the API: ```bash curl -X POST 'https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/rotate-secret' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` ```json { "data": { "signingSecret": "whsec_ZXhhbXBsZS1zZWNyZXQtZG8tbm90LXVzZS0wMDAwMDA=", "previousSecretExpiresAt": "2026-12-01T10:00:00.000Z" } } ``` For the next **24 hours** every delivery carries two signatures, made with the new secret and the previous one: ```http webhook-signature: v1,L1bPoz66MpwZv1+qbTZ/JIqM6Q++GR68lDnkBgwUnw8= v1,DNb+TcqHMMG6Ay8s5t9N3mfeugBMQi6Li09ENz7mWDY= ``` A receiver that accepts a request when **any** signature matches, as the [samples](https://chatwise.so/docs/webhooks/verify-signatures.md) do, works with either secret. So: 1. Rotate the secret. 2. Put the new one in your receiver, within 24 hours. 3. [Send a test event](https://chatwise.so/docs/webhooks/testing.md). After 24 hours only the new secret signs. > Rotating again within the 24 hours replaces the previous secret too. Deliveries are then signed with the two latest secrets, and a receiver that still has an older one refuses them. --- Source: https://chatwise.so/docs/webhooks/testing # Testing and the delivery log Send a test event, see what was delivered and why something failed, and send it again. ## Send a test event [Send a test event](https://chatwise.so/docs/api/test-webhook-endpoint.md) from the dashboard or with the API. Chatwise sends a signed [`webhook.test`](https://chatwise.so/docs/webhooks/events/webhook-test.md) event right away and tells you what your endpoint did: ```bash curl -X POST 'https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/test' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` ```json { "data": { "delivered": false, "statusCode": 400, "durationMs": 96, "error": "http_400" } } ``` - The request itself answers 200, also when your endpoint failed. Look at `delivered`. - `statusCode` is `null` when there was no answer, and `error` says why. - It works while the endpoint is paused, and needs no subscription. - A test isn't retried and isn't in the delivery log. ## Test without Chatwise The [OpenAPI file](https://chatwise.so/docs/openapi.json) has two signed deliveries under `x-webhook-signing-examples`, with their secret, headers and exact body. Your verification should accept both when you pass their timestamp as the current time, and refuse them when you change one character of the body. ## Read the delivery log The log has one delivery for each event and endpoint, newest first. [List deliveries](https://chatwise.so/docs/api/list-webhook-deliveries.md) filters by `status` and `eventType`: ```bash curl 'https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/deliveries?status=FAILED' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` | Status | What it means | | --- | --- | | `PENDING` | Waiting to be sent. | | `PROCESSING` | Being sent now. | | `RETRY` | The last attempt failed. `nextAttemptAt` says when the next one is due. | | `DELIVERED` | Your endpoint answered with a 2xx status. | | `FAILED` | It won't be sent again by itself. `lastError` says why. | | `CANCELLED` | The endpoint stopped subscribing to the event before it was delivered. An attempt that was under way may have arrived. | [Get a delivery](https://chatwise.so/docs/api/get-webhook-delivery.md) adds its payload and its attempts. A success on the first try has no entry in `attemptLog`. Its time and status are on the delivery. After a redelivery the attempt numbers start again and the earlier attempts stay, so sort them by `startedAt`. ## Why a delivery failed | `lastError` | What happened | Retried | | --- | --- | --- | | `http_408`, `http_425`, `http_429`, `http_5xx` | Your endpoint answered with that status. | Yes | | `timeout` | No answer within 10 seconds. | Yes | | `network` | Chatwise couldn't connect, or the connection broke. | Yes | | `delivery_error` | Something failed in Chatwise. | Yes | | `http_410` | Your endpoint answered 410 Gone. Chatwise disabled it. | No | | `http_3xx`, other `http_4xx` | Your endpoint answered with that status. Redirects aren't followed. | No | | `invalid_url` | The URL can't be used. | No | | `private_address` | The URL's name leads to a private address. | No | | `payload_too_large` | The event is larger than 256 KiB. | No | | `message_removed` | The message was unsent, deleted or hidden before it was sent. | No | | `retry_exhausted` | All 8 attempts failed. It takes the place of the last attempt's own error. | No | `http_5xx` stands for the actual status, such as `http_503`. ## Redeliver [Redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md) sends a delivery again, with the same event id and from its first attempt, with all its retries. Do it after you fixed your endpoint: ```bash curl -X POST 'https://api.chatwise.so/v1/webhook-deliveries/wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90/redeliver' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` You can redeliver what was delivered, failed, was cancelled or is waiting for a retry, for 30 days. While the endpoint is paused or disabled, it waits. It is refused with a 400 when: - the delivery is already waiting or being sent; - the endpoint no longer subscribes to the event; - the message was unsent, deleted or hidden. A receiver that dedupes on `webhook-id` skips a redelivery of an event it already handled. --- Source: https://chatwise.so/docs/webhooks/limits # Limits and retention How many endpoints a workspace can have, which URLs they accept, how large events are and how long they are kept. | What | Limit | | --- | --- | | Endpoints in a workspace | 10 | | URL | Public `https://` on port 443, at most 2048 characters | | Name | 1 to 80 characters | | Accounts listed in `accountIds` | 50 | | Event size | 256 KiB | | Time to answer | 10 seconds | | Attempts | 8 | | Events, deliveries and attempts are kept | 30 days | | The previous secret still signs after a rotation | 24 hours | ## URLs Chatwise sends to public addresses only: - The URL starts with `https://`, uses port 443 and has no username, password or `#fragment`. - `localhost` and names ending in `.localhost`, `.local` or `.internal` are refused when you save the endpoint. - The name is looked up again for every attempt. If any of its addresses is private, nothing is sent and the delivery fails with `private_address`, without a retry. - The certificate must be valid for the name. - Redirects aren't followed. An answer of 301 or 302 is a failure, so save the final URL. Requests don't come from fixed IP addresses. Trust the [signature](https://chatwise.so/docs/webhooks/verify-signatures.md), not the sender's address. ## Event size An event larger than 256 KiB isn't sent. Its delivery fails with `payload_too_large`. Your server has to accept events up to that size: [some frameworks don't](https://chatwise.so/docs/webhooks/verify-signatures.md#in-a-framework) unless you raise their limit. ## Retention Events, their deliveries and their attempts are kept for 30 days, then deleted. Until then you can read a delivery and [redeliver](https://chatwise.so/docs/webhooks/testing.md#redeliver) it. A deleted endpoint's log can't be read any more. --- Source: https://chatwise.so/docs/webhooks/events # Events Every event Chatwise sends, or will send, to a webhook endpoint, with its channels and status. Events are the same on every channel: `message.received` is a message from a customer, whether it came by WhatsApp, Instagram, Messenger or Website Chat. `data.message.channel` says which. | Event | Sent when | Channels | Status | | --- | --- | --- | --- | | [`message.received`](https://chatwise.so/docs/webhooks/events/message-received.md) | A customer sent a message. | WhatsApp, Instagram, Messenger, Website Chat | Available | | [`message.sent`](https://chatwise.so/docs/webhooks/events/message-sent.md) | The workspace sent a message: from the dashboard, the mobile app, the API, MCP, a flow, Comment to DM, or the native WhatsApp Business or Instagram app. | WhatsApp, Instagram, Messenger, Website Chat | Coming soon | | [`message.delivered`](https://chatwise.so/docs/webhooks/events/message-delivered.md) | The channel reported an outgoing message was delivered. | WhatsApp, Messenger | Coming soon | | [`message.read`](https://chatwise.so/docs/webhooks/events/message-read.md) | The channel reported the customer read an outgoing message. | WhatsApp, Instagram, Messenger | Coming soon | | [`message.failed`](https://chatwise.so/docs/webhooks/events/message-failed.md) | The channel reported an outgoing message could not be delivered. | WhatsApp | Coming soon | | [`comment.received`](https://chatwise.so/docs/webhooks/events/comment-received.md) | Someone commented on a post of a connected Instagram account. | Instagram | Coming soon | An endpoint can subscribe to an event that is coming soon, but nothing is sent for it until it is available. There is also [`webhook.test`](https://chatwise.so/docs/webhooks/events/webhook-test.md), which is only sent when you [send a test event](https://chatwise.so/docs/webhooks/testing.md). Endpoints don't subscribe to it. To read this list from a program, call [list event types](https://chatwise.so/docs/api/list-webhook-event-types.md). It lists events that are coming soon too. ## What every event has Every event is a JSON object with the same outer fields. `data` depends on the event. | Field | Type | Description | | --- | --- | --- | | `id` | string | The event's id, the same on every retry and redelivery. Also the `webhook-id` header. | | `type` | string | The event's name. Also the `X-Chatwise-Event` header. | | `timestamp` | string | When the event happened. The same on every retry. ISO 8601, in UTC. | | `apiVersion` | string | The payload format, as a date. | | `workspaceId` | string | The workspace the event happened in. | | `data` | object | What happened. | --- Source: https://chatwise.so/docs/webhooks/events/message-received # message.received A customer sent a message. Sent when a live message from a customer is saved, on any connected WhatsApp number, Instagram account, Messenger Page or Website Chat site. Not sent for reactions, edits, system messages or imported history, or when the message was deleted or hidden before the event was prepared. `data` is the message and conversation as they were when the event was prepared, after the message was saved. Every retry and redelivery sends the same. **Channels:** WhatsApp, Instagram, Messenger, and Website Chat. ## Headers | Header | Description | Example | | --- | --- | --- | | `webhook-id` | The event's id, the same on every retry and redelivery. Dedupe on it. | `evt_01JE2Z3QK4T8M6N2R5S7V9W1X3` | | `webhook-timestamp` | When this attempt was signed, in Unix seconds. | `1794475538` | | `webhook-signature` | One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `..`. | `v1,` | | `X-Chatwise-Event` | The event's name. | `message.received` | | `X-Chatwise-Delivery` | The delivery's id. | `wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90` | | `User-Agent` | Always `Chatwise-Webhooks/1.0`. | `Chatwise-Webhooks/1.0` | ## Payload ```json { "id": "evt_01JE2Z3QK4T8M6N2R5S7V9W1X3", "type": "message.received", "timestamp": "2026-11-12T09:25:36.000Z", "apiVersion": "2026-12-01", "workspaceId": "42", "data": { "message": { "id": "5678", "conversationId": "1234", "channel": "WHATSAPP", "direction": "inbound", "type": "text", "text": "Is this available in blue?", "sentAt": "2026-11-12T09:25:36.000Z", "ingestedAt": "2026-11-12T09:25:36.412Z", "replyToMessageId": null, "attachments": [] }, "conversation": { "id": "1234", "channel": "WHATSAPP", "status": "open", "participant": { "name": "Jordan Example", "channelId": "12025550147", "phoneNumber": "12025550147", "instagramUsername": null }, "createdAt": "2026-11-01T09:12:00.000Z", "lastMessageAt": "2026-11-12T09:25:36.000Z" }, "account": { "id": "11", "channel": "WHATSAPP" } } } ``` | Field | Type | Description | | --- | --- | --- | | `id` | string | The event's id, the same on every retry and redelivery. Also the `webhook-id` header. | | `type` | string | The event's name. Also the `X-Chatwise-Event` header. Always `message.received`. | | `timestamp` | string | When the event happened. The same on every retry. ISO 8601, in UTC. | | `apiVersion` | string | The payload format, as a date. | | `workspaceId` | string | The workspace the event happened in. | | `data` | object | What happened. | | `data.message` | object | The message, as the API returns it. | | `data.message.id` | string | The message's id. | | `data.message.conversationId` | string | The conversation the message is in. | | `data.message.channel` | string | The channel the message is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data.message.direction` | string | `inbound` from the customer, `outbound` from the workspace. | | `data.message.type` | string | The message's type, such as `text`, `image`, `audio`, `interactive` or `whatsapp_template`. | | `data.message.text` | string or null | The text or caption. For other types, text that Chatwise makes of the message, such as JSON for a location or contacts. Null for WhatsApp authentication templates, so a one-time code is never returned. | | `data.message.sentAt` | string | When the message was sent. ISO 8601, in UTC. | | `data.message.ingestedAt` | string | When Chatwise stored the message. ISO 8601, in UTC. | | `data.message.replyToMessageId` | string or null | The message this one replies to, if any and still visible. | | `data.message.attachments` | array of objects | The message's attachments, at most 10. Always empty on Messenger and Website Chat, and for WhatsApp authentication templates. | | `data.message.attachments[].type` | string | The attachment's type, such as `image`, `video`, `audio` or `document`. | | `data.message.attachments[].mediaId` | string or null | The channel's id for the media, when Chatwise has it: usually on Instagram only. | | `data.conversation` | object | Its conversation, as the API returns it. | | `data.conversation.id` | string | The conversation's id. | | `data.conversation.channel` | string | The channel the conversation is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data.conversation.status` | string | Whether the conversation is open or resolved in the inbox. One of `open`, `resolved`. | | `data.conversation.participant` | object | The customer. | | `data.conversation.participant.name` | string or null | The customer's name. A placeholder, or on Website Chat their email, when Chatwise doesn't know it. | | `data.conversation.participant.channelId` | string or null | The customer's id on the channel: the WhatsApp number, or an Instagram or Messenger id. Null on Website Chat. | | `data.conversation.participant.phoneNumber` | string or null | The customer's phone number, digits only, on WhatsApp. Null on other channels, and when WhatsApp doesn't show it. | | `data.conversation.participant.instagramUsername` | string or null | The customer's Instagram username, when known. Null on WhatsApp. | | `data.conversation.createdAt` | string | When the conversation was created in Chatwise. ISO 8601, in UTC. | | `data.conversation.lastMessageAt` | string or null | When the latest message was sent. Null before the first one. ISO 8601, in UTC. | | `data.account` | object or null | The account the conversation is on, such as a WhatsApp number or an Instagram account. | | `data.account.id` | string | The account's id. The same as in `accountIds`. | | `data.account.channel` | string | The account's channel. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | Fields are only ever added within an `apiVersion`, so ignore the ones you don't know. `data.message` and `data.conversation` are the objects [get a message](https://chatwise.so/docs/api/get-message.md) and [get a conversation](https://chatwise.so/docs/api/get-conversation.md) return. ## Verify it Check the signature against the raw body before you trust the event. [Verify signatures](https://chatwise.so/docs/webhooks/verify-signatures.md) explains each step and has a complete server. **Node.js** `verify.mjs`: ```js import { createHmac, timingSafeEqual } from "node:crypto"; const FIVE_MINUTES = 5 * 60; // rawBody is the request body exactly as received (a Buffer or a string). // headers has lowercase names, as Node's request.headers does. export function verifyChatwiseWebhook(rawBody, headers, secret, now = Date.now() / 1000) { const id = headers["webhook-id"]; const timestamp = headers["webhook-timestamp"]; const signatures = headers["webhook-signature"]; if (!id || !timestamp || !signatures) return false; // Refuse old requests, so a captured one can't be sent again later. if (!(Math.abs(now - Number(timestamp)) <= FIVE_MINUTES)) return false; const key = Buffer.from(secret.slice("whsec_".length), "base64"); const expected = createHmac("sha256", key).update(`${id}.${timestamp}.`).update(rawBody).digest(); // While a secret is being rotated there are two signatures. One match is enough. return signatures.split(" ").some((signature) => { const [version, value = ""] = signature.split(","); const received = Buffer.from(value, "base64"); return version === "v1" && received.length === expected.length && timingSafeEqual(received, expected); }); } ``` **Python** `verify.py`: ```python import base64 import hashlib import hmac import time FIVE_MINUTES = 5 * 60 def verify_chatwise_webhook(raw_body, headers, secret, now=None): """raw_body is the request body exactly as received, as bytes. headers is a mapping with case-insensitive or lowercase names. """ message_id = headers.get("webhook-id") timestamp = headers.get("webhook-timestamp") signatures = headers.get("webhook-signature") if not message_id or not timestamp or not signatures: return False # Refuse old requests, so a captured one can't be sent again later. try: age = abs((time.time() if now is None else now) - int(timestamp)) except ValueError: return False if age > FIVE_MINUTES: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{message_id}.{timestamp}.".encode() + raw_body expected = "v1," + base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode() # While a secret is being rotated there are two signatures. One match is enough. return any( hmac.compare_digest(signature.encode(), expected.encode()) for signature in signatures.split(" ") ) ``` ## Answer it Answer with any 2xx status within 10 seconds, and do the work afterwards. The same event can arrive more than once, so skip a `webhook-id` you already handled. What other answers do is in [delivery and retries](https://chatwise.so/docs/webhooks/delivery.md). --- Source: https://chatwise.so/docs/webhooks/events/message-sent # message.sent Coming soon, not sent yet. The workspace sent a message: from the dashboard, the mobile app, the API, MCP, a flow, Comment to DM, or the native WhatsApp Business or Instagram app. > **Coming soon.** Endpoints can subscribe to this event, but nothing is sent for it yet. Its payload may change before it is. **Channels:** WhatsApp, Instagram, Messenger, and Website Chat. ## Headers | Header | Description | Example | | --- | --- | --- | | `webhook-id` | The event's id, the same on every retry and redelivery. Dedupe on it. | `evt_01JE2Z3QK4T8M6N2R5S7V9W1X3` | | `webhook-timestamp` | When this attempt was signed, in Unix seconds. | `1794475538` | | `webhook-signature` | One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `..`. | `v1,` | | `X-Chatwise-Event` | The event's name. | `message.sent` | | `X-Chatwise-Delivery` | The delivery's id. | `wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90` | | `User-Agent` | Always `Chatwise-Webhooks/1.0`. | `Chatwise-Webhooks/1.0` | ## Payload This payload isn't final, so don't build on it yet. ```json { "id": "evt_01JE2Z3QK4T8M6N2R5S7V9W1X3", "type": "message.sent", "timestamp": "2026-11-12T09:25:36.000Z", "apiVersion": "2026-12-01", "workspaceId": "42", "data": { "message": { "id": "5680", "conversationId": "1234", "channel": "WHATSAPP", "direction": "outbound", "type": "text", "text": "Yes, in two shades of blue.", "sentAt": "2026-11-12T09:31:02.000Z", "ingestedAt": "2026-11-12T09:31:02.350Z", "replyToMessageId": null, "attachments": [] }, "conversation": { "id": "1234", "channel": "WHATSAPP", "status": "open", "participant": { "name": "Jordan Example", "channelId": "12025550147", "phoneNumber": "12025550147", "instagramUsername": null }, "createdAt": "2026-11-01T09:12:00.000Z", "lastMessageAt": "2026-11-12T09:25:36.000Z" }, "account": { "id": "11", "channel": "WHATSAPP" } } } ``` | Field | Type | Description | | --- | --- | --- | | `id` | string | The event's id, the same on every retry and redelivery. Also the `webhook-id` header. | | `type` | string | The event's name. Also the `X-Chatwise-Event` header. Always `message.sent`. | | `timestamp` | string | When the event happened. The same on every retry. ISO 8601, in UTC. | | `apiVersion` | string | The payload format, as a date. | | `workspaceId` | string | The workspace the event happened in. | | `data` | object | What happened. | | `data.message` | object | The message, as the API returns it. | | `data.message.id` | string | The message's id. | | `data.message.conversationId` | string | The conversation the message is in. | | `data.message.channel` | string | The channel the message is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data.message.direction` | string | `inbound` from the customer, `outbound` from the workspace. | | `data.message.type` | string | The message's type, such as `text`, `image`, `audio`, `interactive` or `whatsapp_template`. | | `data.message.text` | string or null | The text or caption. For other types, text that Chatwise makes of the message, such as JSON for a location or contacts. Null for WhatsApp authentication templates, so a one-time code is never returned. | | `data.message.sentAt` | string | When the message was sent. ISO 8601, in UTC. | | `data.message.ingestedAt` | string | When Chatwise stored the message. ISO 8601, in UTC. | | `data.message.replyToMessageId` | string or null | The message this one replies to, if any and still visible. | | `data.message.attachments` | array of objects | The message's attachments, at most 10. Always empty on Messenger and Website Chat, and for WhatsApp authentication templates. | | `data.message.attachments[].type` | string | The attachment's type, such as `image`, `video`, `audio` or `document`. | | `data.message.attachments[].mediaId` | string or null | The channel's id for the media, when Chatwise has it: usually on Instagram only. | | `data.conversation` | object | Its conversation, as the API returns it. | | `data.conversation.id` | string | The conversation's id. | | `data.conversation.channel` | string | The channel the conversation is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data.conversation.status` | string | Whether the conversation is open or resolved in the inbox. One of `open`, `resolved`. | | `data.conversation.participant` | object | The customer. | | `data.conversation.participant.name` | string or null | The customer's name. A placeholder, or on Website Chat their email, when Chatwise doesn't know it. | | `data.conversation.participant.channelId` | string or null | The customer's id on the channel: the WhatsApp number, or an Instagram or Messenger id. Null on Website Chat. | | `data.conversation.participant.phoneNumber` | string or null | The customer's phone number, digits only, on WhatsApp. Null on other channels, and when WhatsApp doesn't show it. | | `data.conversation.participant.instagramUsername` | string or null | The customer's Instagram username, when known. Null on WhatsApp. | | `data.conversation.createdAt` | string | When the conversation was created in Chatwise. ISO 8601, in UTC. | | `data.conversation.lastMessageAt` | string or null | When the latest message was sent. Null before the first one. ISO 8601, in UTC. | | `data.account` | object or null | The account the conversation is on, such as a WhatsApp number or an Instagram account. | | `data.account.id` | string | The account's id. The same as in `accountIds`. | | `data.account.channel` | string | The account's channel. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | Fields are only ever added within an `apiVersion`, so ignore the ones you don't know. `data.message` and `data.conversation` are the objects [get a message](https://chatwise.so/docs/api/get-message.md) and [get a conversation](https://chatwise.so/docs/api/get-conversation.md) return. ## Verify it Check the signature against the raw body before you trust the event. [Verify signatures](https://chatwise.so/docs/webhooks/verify-signatures.md) explains each step and has a complete server. **Node.js** `verify.mjs`: ```js import { createHmac, timingSafeEqual } from "node:crypto"; const FIVE_MINUTES = 5 * 60; // rawBody is the request body exactly as received (a Buffer or a string). // headers has lowercase names, as Node's request.headers does. export function verifyChatwiseWebhook(rawBody, headers, secret, now = Date.now() / 1000) { const id = headers["webhook-id"]; const timestamp = headers["webhook-timestamp"]; const signatures = headers["webhook-signature"]; if (!id || !timestamp || !signatures) return false; // Refuse old requests, so a captured one can't be sent again later. if (!(Math.abs(now - Number(timestamp)) <= FIVE_MINUTES)) return false; const key = Buffer.from(secret.slice("whsec_".length), "base64"); const expected = createHmac("sha256", key).update(`${id}.${timestamp}.`).update(rawBody).digest(); // While a secret is being rotated there are two signatures. One match is enough. return signatures.split(" ").some((signature) => { const [version, value = ""] = signature.split(","); const received = Buffer.from(value, "base64"); return version === "v1" && received.length === expected.length && timingSafeEqual(received, expected); }); } ``` **Python** `verify.py`: ```python import base64 import hashlib import hmac import time FIVE_MINUTES = 5 * 60 def verify_chatwise_webhook(raw_body, headers, secret, now=None): """raw_body is the request body exactly as received, as bytes. headers is a mapping with case-insensitive or lowercase names. """ message_id = headers.get("webhook-id") timestamp = headers.get("webhook-timestamp") signatures = headers.get("webhook-signature") if not message_id or not timestamp or not signatures: return False # Refuse old requests, so a captured one can't be sent again later. try: age = abs((time.time() if now is None else now) - int(timestamp)) except ValueError: return False if age > FIVE_MINUTES: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{message_id}.{timestamp}.".encode() + raw_body expected = "v1," + base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode() # While a secret is being rotated there are two signatures. One match is enough. return any( hmac.compare_digest(signature.encode(), expected.encode()) for signature in signatures.split(" ") ) ``` ## Answer it Answer with any 2xx status within 10 seconds, and do the work afterwards. The same event can arrive more than once, so skip a `webhook-id` you already handled. What other answers do is in [delivery and retries](https://chatwise.so/docs/webhooks/delivery.md). --- Source: https://chatwise.so/docs/webhooks/events/message-delivered # message.delivered Coming soon, not sent yet. The channel reported an outgoing message was delivered. > **Coming soon.** Endpoints can subscribe to this event, but nothing is sent for it yet. Its payload may change before it is. **Channels:** WhatsApp and Messenger. ## Headers | Header | Description | Example | | --- | --- | --- | | `webhook-id` | The event's id, the same on every retry and redelivery. Dedupe on it. | `evt_01JE2Z3QK4T8M6N2R5S7V9W1X3` | | `webhook-timestamp` | When this attempt was signed, in Unix seconds. | `1794475538` | | `webhook-signature` | One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `..`. | `v1,` | | `X-Chatwise-Event` | The event's name. | `message.delivered` | | `X-Chatwise-Delivery` | The delivery's id. | `wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90` | | `User-Agent` | Always `Chatwise-Webhooks/1.0`. | `Chatwise-Webhooks/1.0` | ## Payload This payload isn't final, so don't build on it yet. ```json { "id": "evt_01JE2Z3QK4T8M6N2R5S7V9W1X3", "type": "message.delivered", "timestamp": "2026-11-12T09:25:36.000Z", "apiVersion": "2026-12-01", "workspaceId": "42", "data": { "message": { "id": "5680", "conversationId": "1234", "channel": "WHATSAPP", "direction": "outbound", "type": "text", "text": "Yes, in two shades of blue.", "sentAt": "2026-11-12T09:31:02.000Z", "ingestedAt": "2026-11-12T09:31:02.350Z", "replyToMessageId": null, "attachments": [] }, "conversation": { "id": "1234", "channel": "WHATSAPP", "status": "open", "participant": { "name": "Jordan Example", "channelId": "12025550147", "phoneNumber": "12025550147", "instagramUsername": null }, "createdAt": "2026-11-01T09:12:00.000Z", "lastMessageAt": "2026-11-12T09:25:36.000Z" }, "account": { "id": "11", "channel": "WHATSAPP" } } } ``` | Field | Type | Description | | --- | --- | --- | | `id` | string | The event's id, the same on every retry and redelivery. Also the `webhook-id` header. | | `type` | string | The event's name. Also the `X-Chatwise-Event` header. Always `message.delivered`. | | `timestamp` | string | When the event happened. The same on every retry. ISO 8601, in UTC. | | `apiVersion` | string | The payload format, as a date. | | `workspaceId` | string | The workspace the event happened in. | | `data` | object | What happened. | | `data.message` | object | The message, as the API returns it. | | `data.message.id` | string | The message's id. | | `data.message.conversationId` | string | The conversation the message is in. | | `data.message.channel` | string | The channel the message is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data.message.direction` | string | `inbound` from the customer, `outbound` from the workspace. | | `data.message.type` | string | The message's type, such as `text`, `image`, `audio`, `interactive` or `whatsapp_template`. | | `data.message.text` | string or null | The text or caption. For other types, text that Chatwise makes of the message, such as JSON for a location or contacts. Null for WhatsApp authentication templates, so a one-time code is never returned. | | `data.message.sentAt` | string | When the message was sent. ISO 8601, in UTC. | | `data.message.ingestedAt` | string | When Chatwise stored the message. ISO 8601, in UTC. | | `data.message.replyToMessageId` | string or null | The message this one replies to, if any and still visible. | | `data.message.attachments` | array of objects | The message's attachments, at most 10. Always empty on Messenger and Website Chat, and for WhatsApp authentication templates. | | `data.message.attachments[].type` | string | The attachment's type, such as `image`, `video`, `audio` or `document`. | | `data.message.attachments[].mediaId` | string or null | The channel's id for the media, when Chatwise has it: usually on Instagram only. | | `data.conversation` | object | Its conversation, as the API returns it. | | `data.conversation.id` | string | The conversation's id. | | `data.conversation.channel` | string | The channel the conversation is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data.conversation.status` | string | Whether the conversation is open or resolved in the inbox. One of `open`, `resolved`. | | `data.conversation.participant` | object | The customer. | | `data.conversation.participant.name` | string or null | The customer's name. A placeholder, or on Website Chat their email, when Chatwise doesn't know it. | | `data.conversation.participant.channelId` | string or null | The customer's id on the channel: the WhatsApp number, or an Instagram or Messenger id. Null on Website Chat. | | `data.conversation.participant.phoneNumber` | string or null | The customer's phone number, digits only, on WhatsApp. Null on other channels, and when WhatsApp doesn't show it. | | `data.conversation.participant.instagramUsername` | string or null | The customer's Instagram username, when known. Null on WhatsApp. | | `data.conversation.createdAt` | string | When the conversation was created in Chatwise. ISO 8601, in UTC. | | `data.conversation.lastMessageAt` | string or null | When the latest message was sent. Null before the first one. ISO 8601, in UTC. | | `data.account` | object or null | The account the conversation is on, such as a WhatsApp number or an Instagram account. | | `data.account.id` | string | The account's id. The same as in `accountIds`. | | `data.account.channel` | string | The account's channel. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | Fields are only ever added within an `apiVersion`, so ignore the ones you don't know. `data.message` and `data.conversation` are the objects [get a message](https://chatwise.so/docs/api/get-message.md) and [get a conversation](https://chatwise.so/docs/api/get-conversation.md) return. ## Verify it Check the signature against the raw body before you trust the event. [Verify signatures](https://chatwise.so/docs/webhooks/verify-signatures.md) explains each step and has a complete server. **Node.js** `verify.mjs`: ```js import { createHmac, timingSafeEqual } from "node:crypto"; const FIVE_MINUTES = 5 * 60; // rawBody is the request body exactly as received (a Buffer or a string). // headers has lowercase names, as Node's request.headers does. export function verifyChatwiseWebhook(rawBody, headers, secret, now = Date.now() / 1000) { const id = headers["webhook-id"]; const timestamp = headers["webhook-timestamp"]; const signatures = headers["webhook-signature"]; if (!id || !timestamp || !signatures) return false; // Refuse old requests, so a captured one can't be sent again later. if (!(Math.abs(now - Number(timestamp)) <= FIVE_MINUTES)) return false; const key = Buffer.from(secret.slice("whsec_".length), "base64"); const expected = createHmac("sha256", key).update(`${id}.${timestamp}.`).update(rawBody).digest(); // While a secret is being rotated there are two signatures. One match is enough. return signatures.split(" ").some((signature) => { const [version, value = ""] = signature.split(","); const received = Buffer.from(value, "base64"); return version === "v1" && received.length === expected.length && timingSafeEqual(received, expected); }); } ``` **Python** `verify.py`: ```python import base64 import hashlib import hmac import time FIVE_MINUTES = 5 * 60 def verify_chatwise_webhook(raw_body, headers, secret, now=None): """raw_body is the request body exactly as received, as bytes. headers is a mapping with case-insensitive or lowercase names. """ message_id = headers.get("webhook-id") timestamp = headers.get("webhook-timestamp") signatures = headers.get("webhook-signature") if not message_id or not timestamp or not signatures: return False # Refuse old requests, so a captured one can't be sent again later. try: age = abs((time.time() if now is None else now) - int(timestamp)) except ValueError: return False if age > FIVE_MINUTES: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{message_id}.{timestamp}.".encode() + raw_body expected = "v1," + base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode() # While a secret is being rotated there are two signatures. One match is enough. return any( hmac.compare_digest(signature.encode(), expected.encode()) for signature in signatures.split(" ") ) ``` ## Answer it Answer with any 2xx status within 10 seconds, and do the work afterwards. The same event can arrive more than once, so skip a `webhook-id` you already handled. What other answers do is in [delivery and retries](https://chatwise.so/docs/webhooks/delivery.md). --- Source: https://chatwise.so/docs/webhooks/events/message-read # message.read Coming soon, not sent yet. The channel reported the customer read an outgoing message. > **Coming soon.** Endpoints can subscribe to this event, but nothing is sent for it yet. Its payload may change before it is. **Channels:** WhatsApp, Instagram, and Messenger. ## Headers | Header | Description | Example | | --- | --- | --- | | `webhook-id` | The event's id, the same on every retry and redelivery. Dedupe on it. | `evt_01JE2Z3QK4T8M6N2R5S7V9W1X3` | | `webhook-timestamp` | When this attempt was signed, in Unix seconds. | `1794475538` | | `webhook-signature` | One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `..`. | `v1,` | | `X-Chatwise-Event` | The event's name. | `message.read` | | `X-Chatwise-Delivery` | The delivery's id. | `wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90` | | `User-Agent` | Always `Chatwise-Webhooks/1.0`. | `Chatwise-Webhooks/1.0` | ## Payload This payload isn't final, so don't build on it yet. ```json { "id": "evt_01JE2Z3QK4T8M6N2R5S7V9W1X3", "type": "message.read", "timestamp": "2026-11-12T09:25:36.000Z", "apiVersion": "2026-12-01", "workspaceId": "42", "data": { "message": { "id": "5680", "conversationId": "1234", "channel": "WHATSAPP", "direction": "outbound", "type": "text", "text": "Yes, in two shades of blue.", "sentAt": "2026-11-12T09:31:02.000Z", "ingestedAt": "2026-11-12T09:31:02.350Z", "replyToMessageId": null, "attachments": [] }, "conversation": { "id": "1234", "channel": "WHATSAPP", "status": "open", "participant": { "name": "Jordan Example", "channelId": "12025550147", "phoneNumber": "12025550147", "instagramUsername": null }, "createdAt": "2026-11-01T09:12:00.000Z", "lastMessageAt": "2026-11-12T09:25:36.000Z" }, "account": { "id": "11", "channel": "WHATSAPP" } } } ``` | Field | Type | Description | | --- | --- | --- | | `id` | string | The event's id, the same on every retry and redelivery. Also the `webhook-id` header. | | `type` | string | The event's name. Also the `X-Chatwise-Event` header. Always `message.read`. | | `timestamp` | string | When the event happened. The same on every retry. ISO 8601, in UTC. | | `apiVersion` | string | The payload format, as a date. | | `workspaceId` | string | The workspace the event happened in. | | `data` | object | What happened. | | `data.message` | object | The message, as the API returns it. | | `data.message.id` | string | The message's id. | | `data.message.conversationId` | string | The conversation the message is in. | | `data.message.channel` | string | The channel the message is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data.message.direction` | string | `inbound` from the customer, `outbound` from the workspace. | | `data.message.type` | string | The message's type, such as `text`, `image`, `audio`, `interactive` or `whatsapp_template`. | | `data.message.text` | string or null | The text or caption. For other types, text that Chatwise makes of the message, such as JSON for a location or contacts. Null for WhatsApp authentication templates, so a one-time code is never returned. | | `data.message.sentAt` | string | When the message was sent. ISO 8601, in UTC. | | `data.message.ingestedAt` | string | When Chatwise stored the message. ISO 8601, in UTC. | | `data.message.replyToMessageId` | string or null | The message this one replies to, if any and still visible. | | `data.message.attachments` | array of objects | The message's attachments, at most 10. Always empty on Messenger and Website Chat, and for WhatsApp authentication templates. | | `data.message.attachments[].type` | string | The attachment's type, such as `image`, `video`, `audio` or `document`. | | `data.message.attachments[].mediaId` | string or null | The channel's id for the media, when Chatwise has it: usually on Instagram only. | | `data.conversation` | object | Its conversation, as the API returns it. | | `data.conversation.id` | string | The conversation's id. | | `data.conversation.channel` | string | The channel the conversation is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data.conversation.status` | string | Whether the conversation is open or resolved in the inbox. One of `open`, `resolved`. | | `data.conversation.participant` | object | The customer. | | `data.conversation.participant.name` | string or null | The customer's name. A placeholder, or on Website Chat their email, when Chatwise doesn't know it. | | `data.conversation.participant.channelId` | string or null | The customer's id on the channel: the WhatsApp number, or an Instagram or Messenger id. Null on Website Chat. | | `data.conversation.participant.phoneNumber` | string or null | The customer's phone number, digits only, on WhatsApp. Null on other channels, and when WhatsApp doesn't show it. | | `data.conversation.participant.instagramUsername` | string or null | The customer's Instagram username, when known. Null on WhatsApp. | | `data.conversation.createdAt` | string | When the conversation was created in Chatwise. ISO 8601, in UTC. | | `data.conversation.lastMessageAt` | string or null | When the latest message was sent. Null before the first one. ISO 8601, in UTC. | | `data.account` | object or null | The account the conversation is on, such as a WhatsApp number or an Instagram account. | | `data.account.id` | string | The account's id. The same as in `accountIds`. | | `data.account.channel` | string | The account's channel. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | Fields are only ever added within an `apiVersion`, so ignore the ones you don't know. `data.message` and `data.conversation` are the objects [get a message](https://chatwise.so/docs/api/get-message.md) and [get a conversation](https://chatwise.so/docs/api/get-conversation.md) return. ## Verify it Check the signature against the raw body before you trust the event. [Verify signatures](https://chatwise.so/docs/webhooks/verify-signatures.md) explains each step and has a complete server. **Node.js** `verify.mjs`: ```js import { createHmac, timingSafeEqual } from "node:crypto"; const FIVE_MINUTES = 5 * 60; // rawBody is the request body exactly as received (a Buffer or a string). // headers has lowercase names, as Node's request.headers does. export function verifyChatwiseWebhook(rawBody, headers, secret, now = Date.now() / 1000) { const id = headers["webhook-id"]; const timestamp = headers["webhook-timestamp"]; const signatures = headers["webhook-signature"]; if (!id || !timestamp || !signatures) return false; // Refuse old requests, so a captured one can't be sent again later. if (!(Math.abs(now - Number(timestamp)) <= FIVE_MINUTES)) return false; const key = Buffer.from(secret.slice("whsec_".length), "base64"); const expected = createHmac("sha256", key).update(`${id}.${timestamp}.`).update(rawBody).digest(); // While a secret is being rotated there are two signatures. One match is enough. return signatures.split(" ").some((signature) => { const [version, value = ""] = signature.split(","); const received = Buffer.from(value, "base64"); return version === "v1" && received.length === expected.length && timingSafeEqual(received, expected); }); } ``` **Python** `verify.py`: ```python import base64 import hashlib import hmac import time FIVE_MINUTES = 5 * 60 def verify_chatwise_webhook(raw_body, headers, secret, now=None): """raw_body is the request body exactly as received, as bytes. headers is a mapping with case-insensitive or lowercase names. """ message_id = headers.get("webhook-id") timestamp = headers.get("webhook-timestamp") signatures = headers.get("webhook-signature") if not message_id or not timestamp or not signatures: return False # Refuse old requests, so a captured one can't be sent again later. try: age = abs((time.time() if now is None else now) - int(timestamp)) except ValueError: return False if age > FIVE_MINUTES: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{message_id}.{timestamp}.".encode() + raw_body expected = "v1," + base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode() # While a secret is being rotated there are two signatures. One match is enough. return any( hmac.compare_digest(signature.encode(), expected.encode()) for signature in signatures.split(" ") ) ``` ## Answer it Answer with any 2xx status within 10 seconds, and do the work afterwards. The same event can arrive more than once, so skip a `webhook-id` you already handled. What other answers do is in [delivery and retries](https://chatwise.so/docs/webhooks/delivery.md). --- Source: https://chatwise.so/docs/webhooks/events/message-failed # message.failed Coming soon, not sent yet. The channel reported an outgoing message could not be delivered. > **Coming soon.** Endpoints can subscribe to this event, but nothing is sent for it yet. Its payload may change before it is. **Channels:** WhatsApp. ## Headers | Header | Description | Example | | --- | --- | --- | | `webhook-id` | The event's id, the same on every retry and redelivery. Dedupe on it. | `evt_01JE2Z3QK4T8M6N2R5S7V9W1X3` | | `webhook-timestamp` | When this attempt was signed, in Unix seconds. | `1794475538` | | `webhook-signature` | One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `..`. | `v1,` | | `X-Chatwise-Event` | The event's name. | `message.failed` | | `X-Chatwise-Delivery` | The delivery's id. | `wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90` | | `User-Agent` | Always `Chatwise-Webhooks/1.0`. | `Chatwise-Webhooks/1.0` | ## Payload This payload isn't final, so don't build on it yet. ```json { "id": "evt_01JE2Z3QK4T8M6N2R5S7V9W1X3", "type": "message.failed", "timestamp": "2026-11-12T09:25:36.000Z", "apiVersion": "2026-12-01", "workspaceId": "42", "data": { "message": { "id": "5680", "conversationId": "1234", "channel": "WHATSAPP", "direction": "outbound", "type": "text", "text": "Yes, in two shades of blue.", "sentAt": "2026-11-12T09:31:02.000Z", "ingestedAt": "2026-11-12T09:31:02.350Z", "replyToMessageId": null, "attachments": [] }, "conversation": { "id": "1234", "channel": "WHATSAPP", "status": "open", "participant": { "name": "Jordan Example", "channelId": "12025550147", "phoneNumber": "12025550147", "instagramUsername": null }, "createdAt": "2026-11-01T09:12:00.000Z", "lastMessageAt": "2026-11-12T09:25:36.000Z" }, "account": { "id": "11", "channel": "WHATSAPP" } } } ``` | Field | Type | Description | | --- | --- | --- | | `id` | string | The event's id, the same on every retry and redelivery. Also the `webhook-id` header. | | `type` | string | The event's name. Also the `X-Chatwise-Event` header. Always `message.failed`. | | `timestamp` | string | When the event happened. The same on every retry. ISO 8601, in UTC. | | `apiVersion` | string | The payload format, as a date. | | `workspaceId` | string | The workspace the event happened in. | | `data` | object | What happened. | | `data.message` | object | The message, as the API returns it. | | `data.message.id` | string | The message's id. | | `data.message.conversationId` | string | The conversation the message is in. | | `data.message.channel` | string | The channel the message is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data.message.direction` | string | `inbound` from the customer, `outbound` from the workspace. | | `data.message.type` | string | The message's type, such as `text`, `image`, `audio`, `interactive` or `whatsapp_template`. | | `data.message.text` | string or null | The text or caption. For other types, text that Chatwise makes of the message, such as JSON for a location or contacts. Null for WhatsApp authentication templates, so a one-time code is never returned. | | `data.message.sentAt` | string | When the message was sent. ISO 8601, in UTC. | | `data.message.ingestedAt` | string | When Chatwise stored the message. ISO 8601, in UTC. | | `data.message.replyToMessageId` | string or null | The message this one replies to, if any and still visible. | | `data.message.attachments` | array of objects | The message's attachments, at most 10. Always empty on Messenger and Website Chat, and for WhatsApp authentication templates. | | `data.message.attachments[].type` | string | The attachment's type, such as `image`, `video`, `audio` or `document`. | | `data.message.attachments[].mediaId` | string or null | The channel's id for the media, when Chatwise has it: usually on Instagram only. | | `data.conversation` | object | Its conversation, as the API returns it. | | `data.conversation.id` | string | The conversation's id. | | `data.conversation.channel` | string | The channel the conversation is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data.conversation.status` | string | Whether the conversation is open or resolved in the inbox. One of `open`, `resolved`. | | `data.conversation.participant` | object | The customer. | | `data.conversation.participant.name` | string or null | The customer's name. A placeholder, or on Website Chat their email, when Chatwise doesn't know it. | | `data.conversation.participant.channelId` | string or null | The customer's id on the channel: the WhatsApp number, or an Instagram or Messenger id. Null on Website Chat. | | `data.conversation.participant.phoneNumber` | string or null | The customer's phone number, digits only, on WhatsApp. Null on other channels, and when WhatsApp doesn't show it. | | `data.conversation.participant.instagramUsername` | string or null | The customer's Instagram username, when known. Null on WhatsApp. | | `data.conversation.createdAt` | string | When the conversation was created in Chatwise. ISO 8601, in UTC. | | `data.conversation.lastMessageAt` | string or null | When the latest message was sent. Null before the first one. ISO 8601, in UTC. | | `data.account` | object or null | The account the conversation is on, such as a WhatsApp number or an Instagram account. | | `data.account.id` | string | The account's id. The same as in `accountIds`. | | `data.account.channel` | string | The account's channel. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | Fields are only ever added within an `apiVersion`, so ignore the ones you don't know. `data.message` and `data.conversation` are the objects [get a message](https://chatwise.so/docs/api/get-message.md) and [get a conversation](https://chatwise.so/docs/api/get-conversation.md) return. ## Verify it Check the signature against the raw body before you trust the event. [Verify signatures](https://chatwise.so/docs/webhooks/verify-signatures.md) explains each step and has a complete server. **Node.js** `verify.mjs`: ```js import { createHmac, timingSafeEqual } from "node:crypto"; const FIVE_MINUTES = 5 * 60; // rawBody is the request body exactly as received (a Buffer or a string). // headers has lowercase names, as Node's request.headers does. export function verifyChatwiseWebhook(rawBody, headers, secret, now = Date.now() / 1000) { const id = headers["webhook-id"]; const timestamp = headers["webhook-timestamp"]; const signatures = headers["webhook-signature"]; if (!id || !timestamp || !signatures) return false; // Refuse old requests, so a captured one can't be sent again later. if (!(Math.abs(now - Number(timestamp)) <= FIVE_MINUTES)) return false; const key = Buffer.from(secret.slice("whsec_".length), "base64"); const expected = createHmac("sha256", key).update(`${id}.${timestamp}.`).update(rawBody).digest(); // While a secret is being rotated there are two signatures. One match is enough. return signatures.split(" ").some((signature) => { const [version, value = ""] = signature.split(","); const received = Buffer.from(value, "base64"); return version === "v1" && received.length === expected.length && timingSafeEqual(received, expected); }); } ``` **Python** `verify.py`: ```python import base64 import hashlib import hmac import time FIVE_MINUTES = 5 * 60 def verify_chatwise_webhook(raw_body, headers, secret, now=None): """raw_body is the request body exactly as received, as bytes. headers is a mapping with case-insensitive or lowercase names. """ message_id = headers.get("webhook-id") timestamp = headers.get("webhook-timestamp") signatures = headers.get("webhook-signature") if not message_id or not timestamp or not signatures: return False # Refuse old requests, so a captured one can't be sent again later. try: age = abs((time.time() if now is None else now) - int(timestamp)) except ValueError: return False if age > FIVE_MINUTES: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{message_id}.{timestamp}.".encode() + raw_body expected = "v1," + base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode() # While a secret is being rotated there are two signatures. One match is enough. return any( hmac.compare_digest(signature.encode(), expected.encode()) for signature in signatures.split(" ") ) ``` ## Answer it Answer with any 2xx status within 10 seconds, and do the work afterwards. The same event can arrive more than once, so skip a `webhook-id` you already handled. What other answers do is in [delivery and retries](https://chatwise.so/docs/webhooks/delivery.md). --- Source: https://chatwise.so/docs/webhooks/events/comment-received # comment.received Coming soon, not sent yet. Someone commented on a post of a connected Instagram account. > **Coming soon.** Endpoints can subscribe to this event, but nothing is sent for it yet. Its payload may change before it is. **Channels:** Instagram. ## Headers | Header | Description | Example | | --- | --- | --- | | `webhook-id` | The event's id, the same on every retry and redelivery. Dedupe on it. | `evt_01JE2Z3QK4T8M6N2R5S7V9W1X3` | | `webhook-timestamp` | When this attempt was signed, in Unix seconds. | `1794475538` | | `webhook-signature` | One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `..`. | `v1,` | | `X-Chatwise-Event` | The event's name. | `comment.received` | | `X-Chatwise-Delivery` | The delivery's id. | `wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90` | | `User-Agent` | Always `Chatwise-Webhooks/1.0`. | `Chatwise-Webhooks/1.0` | ## Payload The contents of `data` aren't decided yet. The outer fields are the same as every event's. ```json { "id": "evt_01JE2Z3QK4T8M6N2R5S7V9W1X3", "type": "comment.received", "timestamp": "2026-11-12T09:25:36.000Z", "apiVersion": "2026-12-01", "workspaceId": "42", "data": {} } ``` | Field | Type | Description | | --- | --- | --- | | `id` | string | The event's id, the same on every retry and redelivery. Also the `webhook-id` header. | | `type` | string | The event's name. Also the `X-Chatwise-Event` header. Always `comment.received`. | | `timestamp` | string | When the event happened. The same on every retry. ISO 8601, in UTC. | | `apiVersion` | string | The payload format, as a date. | | `workspaceId` | string | The workspace the event happened in. | | `data` | object | What happened. | Fields are only ever added within an `apiVersion`, so ignore the ones you don't know. ## Verify it Check the signature against the raw body before you trust the event. [Verify signatures](https://chatwise.so/docs/webhooks/verify-signatures.md) explains each step and has a complete server. **Node.js** `verify.mjs`: ```js import { createHmac, timingSafeEqual } from "node:crypto"; const FIVE_MINUTES = 5 * 60; // rawBody is the request body exactly as received (a Buffer or a string). // headers has lowercase names, as Node's request.headers does. export function verifyChatwiseWebhook(rawBody, headers, secret, now = Date.now() / 1000) { const id = headers["webhook-id"]; const timestamp = headers["webhook-timestamp"]; const signatures = headers["webhook-signature"]; if (!id || !timestamp || !signatures) return false; // Refuse old requests, so a captured one can't be sent again later. if (!(Math.abs(now - Number(timestamp)) <= FIVE_MINUTES)) return false; const key = Buffer.from(secret.slice("whsec_".length), "base64"); const expected = createHmac("sha256", key).update(`${id}.${timestamp}.`).update(rawBody).digest(); // While a secret is being rotated there are two signatures. One match is enough. return signatures.split(" ").some((signature) => { const [version, value = ""] = signature.split(","); const received = Buffer.from(value, "base64"); return version === "v1" && received.length === expected.length && timingSafeEqual(received, expected); }); } ``` **Python** `verify.py`: ```python import base64 import hashlib import hmac import time FIVE_MINUTES = 5 * 60 def verify_chatwise_webhook(raw_body, headers, secret, now=None): """raw_body is the request body exactly as received, as bytes. headers is a mapping with case-insensitive or lowercase names. """ message_id = headers.get("webhook-id") timestamp = headers.get("webhook-timestamp") signatures = headers.get("webhook-signature") if not message_id or not timestamp or not signatures: return False # Refuse old requests, so a captured one can't be sent again later. try: age = abs((time.time() if now is None else now) - int(timestamp)) except ValueError: return False if age > FIVE_MINUTES: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{message_id}.{timestamp}.".encode() + raw_body expected = "v1," + base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode() # While a secret is being rotated there are two signatures. One match is enough. return any( hmac.compare_digest(signature.encode(), expected.encode()) for signature in signatures.split(" ") ) ``` ## Answer it Answer with any 2xx status within 10 seconds, and do the work afterwards. The same event can arrive more than once, so skip a `webhook-id` you already handled. What other answers do is in [delivery and retries](https://chatwise.so/docs/webhooks/delivery.md). --- Source: https://chatwise.so/docs/webhooks/events/webhook-test # webhook.test You sent a test event, from the dashboard or with the API. Sent when someone sends a test from the dashboard or calls [Send a test event](https://chatwise.so/docs/api/test-webhook-endpoint.md), also to a paused endpoint. Endpoints don't subscribe to it. It is signed like every event. It is sent once: it isn't retried, and it isn't in the delivery log. Its `X-Chatwise-Delivery` header is always `wd_test`. ## Headers | Header | Description | Example | | --- | --- | --- | | `webhook-id` | The event's id, the same on every retry and redelivery. Dedupe on it. | `evt_01JE2Z3QK4T8M6N2R5S7V9W1X3` | | `webhook-timestamp` | When this attempt was signed, in Unix seconds. | `1794475538` | | `webhook-signature` | One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `..`. | `v1,` | | `X-Chatwise-Event` | The event's name. | `webhook.test` | | `X-Chatwise-Delivery` | The delivery's id. | `wd_test` | | `User-Agent` | Always `Chatwise-Webhooks/1.0`. | `Chatwise-Webhooks/1.0` | ## Payload ```json { "id": "evt_01JE2Z3QK4T8M6N2R5S7V9W1X3", "type": "webhook.test", "timestamp": "2026-11-12T09:25:36.000Z", "apiVersion": "2026-12-01", "workspaceId": "42", "data": { "endpointId": "we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", "message": "This is a test event from Chatwise." } } ``` | Field | Type | Description | | --- | --- | --- | | `id` | string | The event's id, the same on every retry and redelivery. Also the `webhook-id` header. | | `type` | string | The event's name. Also the `X-Chatwise-Event` header. Always `webhook.test`. | | `timestamp` | string | When the event happened. The same on every retry. ISO 8601, in UTC. | | `apiVersion` | string | The payload format, as a date. | | `workspaceId` | string | The workspace the event happened in. | | `data` | object | What happened. | | `data.endpointId` | string | The endpoint the test was sent to. | | `data.message` | string | A fixed sentence. | ## Verify it Check the signature against the raw body before you trust the event. [Verify signatures](https://chatwise.so/docs/webhooks/verify-signatures.md) explains each step and has a complete server. **Node.js** `verify.mjs`: ```js import { createHmac, timingSafeEqual } from "node:crypto"; const FIVE_MINUTES = 5 * 60; // rawBody is the request body exactly as received (a Buffer or a string). // headers has lowercase names, as Node's request.headers does. export function verifyChatwiseWebhook(rawBody, headers, secret, now = Date.now() / 1000) { const id = headers["webhook-id"]; const timestamp = headers["webhook-timestamp"]; const signatures = headers["webhook-signature"]; if (!id || !timestamp || !signatures) return false; // Refuse old requests, so a captured one can't be sent again later. if (!(Math.abs(now - Number(timestamp)) <= FIVE_MINUTES)) return false; const key = Buffer.from(secret.slice("whsec_".length), "base64"); const expected = createHmac("sha256", key).update(`${id}.${timestamp}.`).update(rawBody).digest(); // While a secret is being rotated there are two signatures. One match is enough. return signatures.split(" ").some((signature) => { const [version, value = ""] = signature.split(","); const received = Buffer.from(value, "base64"); return version === "v1" && received.length === expected.length && timingSafeEqual(received, expected); }); } ``` **Python** `verify.py`: ```python import base64 import hashlib import hmac import time FIVE_MINUTES = 5 * 60 def verify_chatwise_webhook(raw_body, headers, secret, now=None): """raw_body is the request body exactly as received, as bytes. headers is a mapping with case-insensitive or lowercase names. """ message_id = headers.get("webhook-id") timestamp = headers.get("webhook-timestamp") signatures = headers.get("webhook-signature") if not message_id or not timestamp or not signatures: return False # Refuse old requests, so a captured one can't be sent again later. try: age = abs((time.time() if now is None else now) - int(timestamp)) except ValueError: return False if age > FIVE_MINUTES: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{message_id}.{timestamp}.".encode() + raw_body expected = "v1," + base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode() # While a secret is being rotated there are two signatures. One match is enough. return any( hmac.compare_digest(signature.encode(), expected.encode()) for signature in signatures.split(" ") ) ``` ## Answer it Answer with any 2xx status within 10 seconds. A test that fails isn't retried. --- Source: https://chatwise.so/docs/api # API reference Every route of the Chatwise API, with the scope it needs. The base URL is `https://api.chatwise.so`. Every route needs an API key: see [authentication and scopes](https://chatwise.so/docs/authentication.md). A machine-readable [OpenAPI 3.1 file](https://chatwise.so/docs/openapi.json) describes all of them. ## Conversations Read the conversations in the workspace's inbox. | Route | What it does | Scope | | --- | --- | --- | | `GET /v1/conversations` | [List conversations](https://chatwise.so/docs/api/list-conversations.md) | `conversations:read` | | `GET /v1/conversations/{conversationId}` | [Get a conversation](https://chatwise.so/docs/api/get-conversation.md) | `conversations:read` | ## Messages Read and search messages, and send approved WhatsApp templates. | Route | What it does | Scope | | --- | --- | --- | | `GET /v1/conversations/{conversationId}/messages` | [List a conversation's messages](https://chatwise.so/docs/api/list-conversation-messages.md) | `messages:read` | | `GET /v1/conversations/{conversationId}/messages/{messageId}` | [Get a message](https://chatwise.so/docs/api/get-message.md) | `messages:read` | | `GET /v1/messages` | [List or search messages](https://chatwise.so/docs/api/list-messages.md) | `messages:read` | | `POST /v1/messages` | [Send a template by id](https://chatwise.so/docs/api/send-message.md) | `messages:send` | | `POST /v1/template/whatsapp` | [Send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md) | `messages:send` | ## WhatsApp templates Find WhatsApp templates, and create new ones. | Route | What it does | Scope | | --- | --- | --- | | `GET /v1/whatsapp/templates` | [List WhatsApp templates](https://chatwise.so/docs/api/list-whatsapp-templates.md) | `templates:read` | | `POST /v1/whatsapp/templates` | [Create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md) | `templates:write` | | `GET /v1/whatsapp/templates/{templateId}` | [Get a WhatsApp template](https://chatwise.so/docs/api/get-whatsapp-template.md) | `templates:read` | ## Webhook endpoints Choose where Chatwise sends events. | Route | What it does | Scope | | --- | --- | --- | | `GET /v1/webhook-endpoints` | [List webhook endpoints](https://chatwise.so/docs/api/list-webhook-endpoints.md) | `webhooks:read` | | `POST /v1/webhook-endpoints` | [Create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md) | `webhooks:write` | | `GET /v1/webhook-endpoints/{endpointId}` | [Get a webhook endpoint](https://chatwise.so/docs/api/get-webhook-endpoint.md) | `webhooks:read` | | `PATCH /v1/webhook-endpoints/{endpointId}` | [Update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md) | `webhooks:write` | | `DELETE /v1/webhook-endpoints/{endpointId}` | [Delete a webhook endpoint](https://chatwise.so/docs/api/delete-webhook-endpoint.md) | `webhooks:write` | | `POST /v1/webhook-endpoints/{endpointId}/test` | [Send a test event](https://chatwise.so/docs/api/test-webhook-endpoint.md) | `webhooks:write` | | `POST /v1/webhook-endpoints/{endpointId}/rotate-secret` | [Rotate the signing secret](https://chatwise.so/docs/api/rotate-webhook-secret.md) | `webhooks:write` | | `GET /v1/webhook-event-types` | [List event types](https://chatwise.so/docs/api/list-webhook-event-types.md) | `webhooks:read` | ## Webhook deliveries See what was sent to an endpoint, and send it again. | Route | What it does | Scope | | --- | --- | --- | | `GET /v1/webhook-endpoints/{endpointId}/deliveries` | [List deliveries](https://chatwise.so/docs/api/list-webhook-deliveries.md) | `webhooks:read` | | `GET /v1/webhook-deliveries/{deliveryId}` | [Get a delivery](https://chatwise.so/docs/api/get-webhook-delivery.md) | `webhooks:read` | | `POST /v1/webhook-deliveries/{deliveryId}/redeliver` | [Redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md) | `webhooks:write` | --- Source: https://chatwise.so/docs/api/list-conversations # List conversations GET /v1/conversations. Lists the workspace's conversations, or finds them by customer. `GET https://api.chatwise.so/v1/conversations` Lists the workspace's conversations, or finds them by customer. The latest activity comes first; conversations without a message come last. A conversation that gets a message while you read the pages moves to the top, so you can miss it. `from` and `to` filter by `lastMessageAt`. The API key needs the `conversations:read` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl 'https://api.chatwise.so/v1/conversations?limit=25&channel=WHATSAPP&status=open' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/conversations?limit=25&channel=WHATSAPP&status=open", { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/conversations?limit=25&channel=WHATSAPP&status=open", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Query parameters | Name | Type | Description | | --- | --- | --- | | `limit` | integer | How many to return, from 1 to 100. Default: `50`. | | `cursor` | string | The previous page's `pagination.nextCursor`. Repeat the same filters and order with it. At most 512 characters. | | `from` | string | Only conversations with a latest message at or after this time. ISO 8601 with a time zone, at most milliseconds. | | `to` | string | Only conversations with a latest message before this time, which must be after `from`. ISO 8601 with a time zone, at most milliseconds. | | `channel` | string | Only conversations on this channel. Without it, every channel, Website Chat included. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`. | | `status` | string | Only open or only resolved conversations. Leave out for both. One of `open`, `resolved`. | | `q` | string | Text in the customer's name, WhatsApp number or Instagram username (with or without `@`), in any case. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 200 characters. | Unknown query parameters are refused with a 400. ## Response **200.** A page of conversations. ```json { "data": [ { "id": "1234", "channel": "WHATSAPP", "status": "open", "participant": { "name": "Jordan Example", "channelId": "12025550147", "phoneNumber": "12025550147", "instagramUsername": null }, "createdAt": "2026-11-01T09:12:00.000Z", "lastMessageAt": "2026-11-12T09:25:36.000Z" } ], "pagination": { "nextCursor": "eyJ2IjoxLCJiaW5kaW5nIjoiZXhhbXBsZSJ9" } } ``` | Field | Type | Description | | --- | --- | --- | | `data[].id` | string | The conversation's id. | | `data[].channel` | string | The channel the conversation is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data[].status` | string | Whether the conversation is open or resolved in the inbox. One of `open`, `resolved`. | | `data[].participant` | object | The customer. | | `data[].participant.name` | string or null | The customer's name. A placeholder, or on Website Chat their email, when Chatwise doesn't know it. | | `data[].participant.channelId` | string or null | The customer's id on the channel: the WhatsApp number, or an Instagram or Messenger id. Null on Website Chat. | | `data[].participant.phoneNumber` | string or null | The customer's phone number, digits only, on WhatsApp. Null on other channels, and when WhatsApp doesn't show it. | | `data[].participant.instagramUsername` | string or null | The customer's Instagram username, when known. Null on WhatsApp. | | `data[].createdAt` | string | When the conversation was created in Chatwise. ISO 8601, in UTC. | | `data[].lastMessageAt` | string or null | When the latest message was sent. Null before the first one. ISO 8601, in UTC. | | `pagination.nextCursor` | string or null | Send it as `cursor` for the next page. Null on the last page. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 400 | Invalid cursor or cursor does not match this request | The cursor isn't one this route returned, or the filters or order changed since. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: conversations:read | The key lacks the route's scope. Create a key that has it. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/get-conversation # Get a conversation GET /v1/conversations/{conversationId}. Reads one conversation: its channel, status and customer. `GET https://api.chatwise.so/v1/conversations/{conversationId}` Reads one conversation: its channel, status and customer. The API key needs the `conversations:read` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl 'https://api.chatwise.so/v1/conversations/1234' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/conversations/1234", { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/conversations/1234", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Path parameters | Name | Type | Description | | --- | --- | --- | | `conversationId` | string | **Required.** The conversation's id. | ## Response **200.** The conversation. ```json { "data": { "id": "1234", "channel": "WHATSAPP", "status": "open", "participant": { "name": "Jordan Example", "channelId": "12025550147", "phoneNumber": "12025550147", "instagramUsername": null }, "createdAt": "2026-11-01T09:12:00.000Z", "lastMessageAt": "2026-11-12T09:25:36.000Z" } } ``` | Field | Type | Description | | --- | --- | --- | | `data.id` | string | The conversation's id. | | `data.channel` | string | The channel the conversation is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data.status` | string | Whether the conversation is open or resolved in the inbox. One of `open`, `resolved`. | | `data.participant` | object | The customer. | | `data.participant.name` | string or null | The customer's name. A placeholder, or on Website Chat their email, when Chatwise doesn't know it. | | `data.participant.channelId` | string or null | The customer's id on the channel: the WhatsApp number, or an Instagram or Messenger id. Null on Website Chat. | | `data.participant.phoneNumber` | string or null | The customer's phone number, digits only, on WhatsApp. Null on other channels, and when WhatsApp doesn't show it. | | `data.participant.instagramUsername` | string or null | The customer's Instagram username, when known. Null on WhatsApp. | | `data.createdAt` | string | When the conversation was created in Chatwise. ISO 8601, in UTC. | | `data.lastMessageAt` | string or null | When the latest message was sent. Null before the first one. ISO 8601, in UTC. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: conversations:read | The key lacks the route's scope. Create a key that has it. | | 404 | Conversation not found | No conversation with this id in the key's workspace. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/list-conversation-messages # List a conversation's messages GET /v1/conversations/{conversationId}/messages. Lists one conversation's messages. `GET https://api.chatwise.so/v1/conversations/{conversationId}/messages` Lists one conversation's messages. Deleted and hidden messages are left out. The API key needs the `messages:read` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl 'https://api.chatwise.so/v1/conversations/1234/messages?limit=25&from=2026-11-12T00%3A00%3A00Z&order=asc' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/conversations/1234/messages?limit=25&from=2026-11-12T00%3A00%3A00Z&order=asc", { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/conversations/1234/messages?limit=25&from=2026-11-12T00%3A00%3A00Z&order=asc", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Path parameters | Name | Type | Description | | --- | --- | --- | | `conversationId` | string | **Required.** The conversation's id. | ## Query parameters | Name | Type | Description | | --- | --- | --- | | `limit` | integer | How many to return, from 1 to 100. Default: `50`. | | `cursor` | string | The previous page's `pagination.nextCursor`. Repeat the same filters and order with it. At most 512 characters. | | `from` | string | Only messages at or after this time. ISO 8601 with a time zone, at most milliseconds. | | `to` | string | Only messages before this time, which must be after `from`. ISO 8601 with a time zone, at most milliseconds. | | `direction` | string | `inbound` from the customer, `outbound` from the workspace. Leave out for both. | | `timeField` | string | The time to filter and sort by: `sentAt`, or `ingestedAt` for when Chatwise stored the message. Default: `sentAt`. | | `order` | string | `desc` for newest first, `asc` for oldest first. Default: `desc`. | Unknown query parameters are refused with a 400. ## Response **200.** A page of messages. ```json { "data": [ { "id": "5678", "conversationId": "1234", "channel": "WHATSAPP", "direction": "inbound", "type": "text", "text": "Is this available in blue?", "sentAt": "2026-11-12T09:25:36.000Z", "ingestedAt": "2026-11-12T09:25:36.412Z", "replyToMessageId": null, "attachments": [] }, { "id": "5680", "conversationId": "1234", "channel": "WHATSAPP", "direction": "outbound", "type": "text", "text": "Yes, in two shades of blue.", "sentAt": "2026-11-12T09:31:02.000Z", "ingestedAt": "2026-11-12T09:31:02.350Z", "replyToMessageId": null, "attachments": [] } ], "pagination": { "nextCursor": null } } ``` | Field | Type | Description | | --- | --- | --- | | `data[].id` | string | The message's id. | | `data[].conversationId` | string | The conversation the message is in. | | `data[].channel` | string | The channel the message is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data[].direction` | string | `inbound` from the customer, `outbound` from the workspace. | | `data[].type` | string | The message's type, such as `text`, `image`, `audio`, `interactive` or `whatsapp_template`. | | `data[].text` | string or null | The text or caption. For other types, text that Chatwise makes of the message, such as JSON for a location or contacts. Null for WhatsApp authentication templates, so a one-time code is never returned. | | `data[].sentAt` | string | When the message was sent. ISO 8601, in UTC. | | `data[].ingestedAt` | string | When Chatwise stored the message. ISO 8601, in UTC. | | `data[].replyToMessageId` | string or null | The message this one replies to, if any and still visible. | | `data[].attachments` | array of objects | The message's attachments, at most 10. Always empty on Messenger and Website Chat, and for WhatsApp authentication templates. | | `data[].attachments[].type` | string | The attachment's type, such as `image`, `video`, `audio` or `document`. | | `data[].attachments[].mediaId` | string or null | The channel's id for the media, when Chatwise has it: usually on Instagram only. | | `pagination.nextCursor` | string or null | Send it as `cursor` for the next page. Null on the last page. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 400 | Invalid cursor or cursor does not match this request | The cursor isn't one this route returned, or the filters or order changed since. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: messages:read | The key lacks the route's scope. Create a key that has it. | | 404 | Conversation not found | No conversation with this id in the key's workspace. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/get-message # Get a message GET /v1/conversations/{conversationId}/messages/{messageId}. Reads one message. `GET https://api.chatwise.so/v1/conversations/{conversationId}/messages/{messageId}` Reads one message. A deleted or hidden message is not found. The API key needs the `messages:read` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl 'https://api.chatwise.so/v1/conversations/1234/messages/5678' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/conversations/1234/messages/5678", { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/conversations/1234/messages/5678", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Path parameters | Name | Type | Description | | --- | --- | --- | | `conversationId` | string | **Required.** The conversation's id. | | `messageId` | string | **Required.** The message's id. | ## Response **200.** The message. ```json { "data": { "id": "5678", "conversationId": "1234", "channel": "WHATSAPP", "direction": "inbound", "type": "text", "text": "Is this available in blue?", "sentAt": "2026-11-12T09:25:36.000Z", "ingestedAt": "2026-11-12T09:25:36.412Z", "replyToMessageId": null, "attachments": [] } } ``` | Field | Type | Description | | --- | --- | --- | | `data.id` | string | The message's id. | | `data.conversationId` | string | The conversation the message is in. | | `data.channel` | string | The channel the message is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data.direction` | string | `inbound` from the customer, `outbound` from the workspace. | | `data.type` | string | The message's type, such as `text`, `image`, `audio`, `interactive` or `whatsapp_template`. | | `data.text` | string or null | The text or caption. For other types, text that Chatwise makes of the message, such as JSON for a location or contacts. Null for WhatsApp authentication templates, so a one-time code is never returned. | | `data.sentAt` | string | When the message was sent. ISO 8601, in UTC. | | `data.ingestedAt` | string | When Chatwise stored the message. ISO 8601, in UTC. | | `data.replyToMessageId` | string or null | The message this one replies to, if any and still visible. | | `data.attachments` | array of objects | The message's attachments, at most 10. Always empty on Messenger and Website Chat, and for WhatsApp authentication templates. | | `data.attachments[].type` | string | The attachment's type, such as `image`, `video`, `audio` or `document`. | | `data.attachments[].mediaId` | string or null | The channel's id for the media, when Chatwise has it: usually on Instagram only. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: messages:read | The key lacks the route's scope. Create a key that has it. | | 404 | Message not found | No visible message with this id in this conversation. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/list-messages # List or search messages GET /v1/messages. Lists messages across the workspace, or searches their text. `GET https://api.chatwise.so/v1/messages` Lists messages across the workspace, or searches their text. Deleted and hidden messages are left out, and a search skips WhatsApp authentication templates. To pull new messages on a schedule, use `timeField=ingestedAt` and `order=asc`. To get them as they arrive, use [webhooks](https://chatwise.so/docs/webhooks.md). The API key needs the `messages:read` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl 'https://api.chatwise.so/v1/messages?limit=25&q=blue&channel=WHATSAPP' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/messages?limit=25&q=blue&channel=WHATSAPP", { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/messages?limit=25&q=blue&channel=WHATSAPP", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Query parameters | Name | Type | Description | | --- | --- | --- | | `limit` | integer | How many to return, from 1 to 100. Default: `50`. | | `cursor` | string | The previous page's `pagination.nextCursor`. Repeat the same filters and order with it. At most 512 characters. | | `from` | string | Only messages at or after this time. ISO 8601 with a time zone, at most milliseconds. | | `to` | string | Only messages before this time, which must be after `from`. ISO 8601 with a time zone, at most milliseconds. | | `direction` | string | `inbound` from the customer, `outbound` from the workspace. Leave out for both. | | `timeField` | string | The time to filter and sort by: `sentAt`, or `ingestedAt` for when Chatwise stored the message. Default: `sentAt`. | | `order` | string | `desc` for newest first, `asc` for oldest first. Default: `desc`. | | `q` | string | Text the message contains, in any case. Every character counts as itself: there are no wildcards. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 200 characters. | | `conversationId` | string | Only messages in this conversation. | | `channel` | string | Only messages on this channel. Without it, every channel, Website Chat included. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`. | Unknown query parameters are refused with a 400. ## Response **200.** A page of messages. ```json { "data": [ { "id": "5678", "conversationId": "1234", "channel": "WHATSAPP", "direction": "inbound", "type": "text", "text": "Is this available in blue?", "sentAt": "2026-11-12T09:25:36.000Z", "ingestedAt": "2026-11-12T09:25:36.412Z", "replyToMessageId": null, "attachments": [] } ], "pagination": { "nextCursor": null } } ``` | Field | Type | Description | | --- | --- | --- | | `data[].id` | string | The message's id. | | `data[].conversationId` | string | The conversation the message is in. | | `data[].channel` | string | The channel the message is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | | `data[].direction` | string | `inbound` from the customer, `outbound` from the workspace. | | `data[].type` | string | The message's type, such as `text`, `image`, `audio`, `interactive` or `whatsapp_template`. | | `data[].text` | string or null | The text or caption. For other types, text that Chatwise makes of the message, such as JSON for a location or contacts. Null for WhatsApp authentication templates, so a one-time code is never returned. | | `data[].sentAt` | string | When the message was sent. ISO 8601, in UTC. | | `data[].ingestedAt` | string | When Chatwise stored the message. ISO 8601, in UTC. | | `data[].replyToMessageId` | string or null | The message this one replies to, if any and still visible. | | `data[].attachments` | array of objects | The message's attachments, at most 10. Always empty on Messenger and Website Chat, and for WhatsApp authentication templates. | | `data[].attachments[].type` | string | The attachment's type, such as `image`, `video`, `audio` or `document`. | | `data[].attachments[].mediaId` | string or null | The channel's id for the media, when Chatwise has it: usually on Instagram only. | | `pagination.nextCursor` | string or null | Send it as `cursor` for the next page. Null on the last page. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 400 | Invalid cursor or cursor does not match this request | The cursor isn't one this route returned, or the filters or order changed since. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: messages:read | The key lacks the route's scope. Create a key that has it. | | 404 | Conversation not found | No conversation with this id in the key's workspace. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/send-message # Send a template by id POST /v1/messages. Sends an approved WhatsApp template by its id. `POST https://api.chatwise.so/v1/messages` Sends an approved WhatsApp template by its id. The answer means WhatsApp accepted the message, not that it was delivered. This route only sends WhatsApp templates. With another `channel`, or without `templateId`, it answers 201 and sends nothing. Sending twice sends two messages. After a timeout or a 500 the message may have been sent, so check before you retry. The API key needs the `messages:send` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl -X POST 'https://api.chatwise.so/v1/messages' \ -H "Authorization: Bearer $CHATWISE_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "to": "12025550147", "channel": "WHATSAPP", "templateId": "123456789012345", "templateParams": [ { "parameter_name": "order_number", "text": "A-1042" } ] }' ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/messages", { method: "POST", headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ "to": "12025550147", "channel": "WHATSAPP", "templateId": "123456789012345", "templateParams": [ { "parameter_name": "order_number", "text": "A-1042" } ] }), }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/messages", method="POST", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", "Content-Type": "application/json", }, data=json.dumps({ "to": "12025550147", "channel": "WHATSAPP", "templateId": "123456789012345", "templateParams": [ { "parameter_name": "order_number", "text": "A-1042" } ] }).encode(), ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Body JSON. Unknown fields are refused with a 400. | Field | Type | Description | | --- | --- | --- | | `to` | string | **Required.** The customer's phone number with its country code. | | `templateId` | string | The template's `id`. Needed to send. | | `templateParams` | array of objects | Values for the body's variables. A template with a variable or media in its header, a dynamic URL button or a copy code button takes `templateComponents` instead. Keys other than `parameter_name` and `text` are ignored. | | `templateParams[].parameter_name` | string | **Required.** The variable's name, its number (`1`, `2`, …), or `otp` for the code of an authentication template. | | `templateParams[].text` | string | **Required.** The variable's value. | | `templateLanguage` | string | The language code to send it in, such as `en_US`. Without it, the template's own. Spaces around it are ignored. | | `templateComponents` | array of objects | Values for the header, body and buttons, up to 12 components. Used instead of `templateParams`, except for authentication templates. At most one header and one body, and no two buttons with the same `subType` and `index`. | | `templateComponents[].type` | string | **Required.** `header`, `body` or `button`. | | `templateComponents[].parameters` | array of objects | **Required.** The component's values: one for a header or a button, one or more for a body. | | `templateComponents[].parameters[].type` | string | **Required.** The kind of value. One of `text`, `image`, `video`, `document`, `currency`, `date_time`, `payload`, `coupon_code`. | | `templateComponents[].parameters[].text` | string | **Required when `type` is `text`.** The text. | | `templateComponents[].parameters[].parameterName` | string | Only when `type` is `text`, `currency`, or `date_time`. The variable's name, for templates with named variables. Spaces around it are ignored. Can't be blank. At most 64 characters. | | `templateComponents[].parameters[].image` | object | **Required when `type` is `image` and `templateComponents[].type` is `header`.** An image, by `link` or Meta media `id`. Needs `link` or `id`. | | `templateComponents[].parameters[].image.link` | string | The image's public URL. | | `templateComponents[].parameters[].image.id` | string | The image's Meta media id. Spaces around it are ignored. Can't be blank. | | `templateComponents[].parameters[].video` | object | **Required when `type` is `video` and `templateComponents[].type` is `header`.** A video, by `link` or Meta media `id`. Needs `link` or `id`. | | `templateComponents[].parameters[].video.link` | string | The video's public URL. | | `templateComponents[].parameters[].video.id` | string | The video's Meta media id. Spaces around it are ignored. Can't be blank. | | `templateComponents[].parameters[].document` | object | **Required when `type` is `document` and `templateComponents[].type` is `header`.** A document, by `link` or Meta media `id`. Needs `link` or `id`. | | `templateComponents[].parameters[].document.link` | string | The document's public URL. | | `templateComponents[].parameters[].document.id` | string | The document's Meta media id. Spaces around it are ignored. Can't be blank. | | `templateComponents[].parameters[].document.filename` | string | The file name the customer sees. At most 240 characters. | | `templateComponents[].parameters[].currency` | object | **Required when `type` is `currency` and `templateComponents[].type` is `body`.** An amount of money. | | `templateComponents[].parameters[].currency.fallbackValue` | string | **Required.** The amount as text, such as `$12.50`. | | `templateComponents[].parameters[].currency.code` | string | **Required.** The ISO 4217 currency code. Spaces around it are ignored. | | `templateComponents[].parameters[].currency.amount1000` | integer | **Required.** The amount times 1000. | | `templateComponents[].parameters[].dateTime` | object | **Required when `type` is `date_time` and `templateComponents[].type` is `body`.** A date or time. | | `templateComponents[].parameters[].dateTime.fallbackValue` | string | **Required.** The date or time as text. | | `templateComponents[].subType` | string | **Required when `type` is `button`.** The button's kind: `url` takes a `text` parameter, `quick_reply` a `payload`, `copy_code` a `coupon_code`. | | `templateComponents[].index` | integer | **Required when `type` is `button`.** The button's position, from 0. | | `templateComponents[].parameters[].payload` | string | **Required when `type` is `payload` and `templateComponents[].type` is `button`.** What a quick reply button sends back. At most 256 characters. | | `templateComponents[].parameters[].couponCode` | string | **Required when `type` is `coupon_code` and `templateComponents[].type` is `button`.** The code a copy code button copies. At most 15 characters. | | `channel` | string | **Required.** Use `WHATSAPP`. One of `WHATSAPP`, `INSTAGRAM`. | | `from` | string | The connected WhatsApp number to send from, digits only. Without it: the number on the template's WhatsApp Business Account the customer last wrote to, else the oldest number there. | ## Response **201.** WhatsApp accepted the message. ```json { "data": { "message": "Message accepted", "from": "+1 202-555-0199" } } ``` | Field | Type | Description | | --- | --- | --- | | `data.message` | string | A confirmation. | | `data.from` | string | The WhatsApp number it was sent from. Absent when nothing was sent. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Expected property name or '}' in JSON at position 1 (line 1 column 2) | The request body isn't valid JSON. The message says where. | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 400 | Template must be approved to send messages | Meta hasn't approved the template, or paused or rejected it. | | 400 | This template is on a different WhatsApp Business Account from the number in from | Use a `from` number on the template's WhatsApp Business Account. | | 400 | An OTP code is required for authentication templates | Send the code as `templateParams` with `parameter_name` set to `otp`. | | 400 | Numbered template variables must start at 1 and include each position once | Number the variables from `1`, each once. | | 400 | That WhatsApp number is not connected to this workspace | Use one of the workspace's connected numbers, digits only. `data.accounts` lists them. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 402 | `ADMIN_SERVICES_BLOCKED`: Chatwise services have been paused for this workspace by an administrator. Contact support to restore service. | Sending is paused for the workspace. Contact support. | | 403 | API key does not have the required scope: messages:send | The key lacks the route's scope. Create a key that has it. | | 403 | `WHATSAPP_REAUTH_REQUIRED`: WhatsApp authorization has expired. Ask an administrator to reconnect WhatsApp in Settings. | Meta no longer accepts Chatwise's access to the number. Reconnect it in the dashboard. `reason` is `expired`, `revoked` or `missing`, and the message depends on it. | | 404 | Template not found | No such template in the key's workspace. Sending by name finds approved templates only. | | 404 | Whatsapp account not found | The workspace has no connected WhatsApp number. | | 404 | No connected WhatsApp number on this template's business account | Connect a number on the template's WhatsApp Business Account. | | 413 | request entity too large | The request body is larger than 100 KB. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error: WhatsApp send failed: 400 {"error":{"message":"(#132000) Number of parameters does not match the expected number of params"}} | WhatsApp didn't accept the message. The number is Meta's HTTP status, and after it comes Meta's answer when that was JSON. A 429 can be tried later, after a 5xx check first, and for other statuses fix what the answer names. | | 500 | Internal server error | Something failed in Chatwise. The message may have been sent, even if it isn't in the conversation. Quote `errorId` to support. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/send-whatsapp-template # Send a template by name POST /v1/template/whatsapp. Sends an approved WhatsApp template by its name. `POST https://api.chatwise.so/v1/template/whatsapp` Sends an approved WhatsApp template by its name. The answer means WhatsApp accepted the message, not that it was delivered. Sending twice sends two messages. After a timeout or a 500 the message may have been sent, so check before you retry. The API key needs the `messages:send` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl -X POST 'https://api.chatwise.so/v1/template/whatsapp' \ -H "Authorization: Bearer $CHATWISE_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "phoneNumber": "12025550147", "templateName": "order_ready", "templateLanguage": "en_US", "templateParams": [ { "parameter_name": "order_number", "text": "A-1042" } ] }' ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/template/whatsapp", { method: "POST", headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ "phoneNumber": "12025550147", "templateName": "order_ready", "templateLanguage": "en_US", "templateParams": [ { "parameter_name": "order_number", "text": "A-1042" } ] }), }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/template/whatsapp", method="POST", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", "Content-Type": "application/json", }, data=json.dumps({ "phoneNumber": "12025550147", "templateName": "order_ready", "templateLanguage": "en_US", "templateParams": [ { "parameter_name": "order_number", "text": "A-1042" } ] }).encode(), ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Body JSON. Unknown fields are refused with a 400. | Field | Type | Description | | --- | --- | --- | | `phoneNumber` | string | **Required.** The customer's phone number with its country code, digits only, at least 8. | | `templateName` | string | **Required.** The template's exact name. | | `templateParams` | array of objects | Values for the body's variables. A template with a variable or media in its header, a dynamic URL button or a copy code button takes `templateComponents` instead. Keys other than `parameter_name` and `text` are ignored. | | `templateParams[].parameter_name` | string | **Required.** The variable's name, its number (`1`, `2`, …), or `otp` for the code of an authentication template. | | `templateParams[].text` | string | **Required.** The variable's value. | | `templateLanguage` | string | The translation to send, such as `en_US`. Without it, the oldest approved template with this name, in its own language. If Chatwise doesn't have the translation, it asks WhatsApp to send the oldest one in this language. Spaces around it are ignored. | | `templateComponents` | array of objects | Values for the header, body and buttons, up to 12 components. Used instead of `templateParams`, except for authentication templates. At most one header and one body, and no two buttons with the same `subType` and `index`. | | `templateComponents[].type` | string | **Required.** `header`, `body` or `button`. | | `templateComponents[].parameters` | array of objects | **Required.** The component's values: one for a header or a button, one or more for a body. | | `templateComponents[].parameters[].type` | string | **Required.** The kind of value. One of `text`, `image`, `video`, `document`, `currency`, `date_time`, `payload`, `coupon_code`. | | `templateComponents[].parameters[].text` | string | **Required when `type` is `text`.** The text. | | `templateComponents[].parameters[].parameterName` | string | Only when `type` is `text`, `currency`, or `date_time`. The variable's name, for templates with named variables. Spaces around it are ignored. Can't be blank. At most 64 characters. | | `templateComponents[].parameters[].image` | object | **Required when `type` is `image` and `templateComponents[].type` is `header`.** An image, by `link` or Meta media `id`. Needs `link` or `id`. | | `templateComponents[].parameters[].image.link` | string | The image's public URL. | | `templateComponents[].parameters[].image.id` | string | The image's Meta media id. Spaces around it are ignored. Can't be blank. | | `templateComponents[].parameters[].video` | object | **Required when `type` is `video` and `templateComponents[].type` is `header`.** A video, by `link` or Meta media `id`. Needs `link` or `id`. | | `templateComponents[].parameters[].video.link` | string | The video's public URL. | | `templateComponents[].parameters[].video.id` | string | The video's Meta media id. Spaces around it are ignored. Can't be blank. | | `templateComponents[].parameters[].document` | object | **Required when `type` is `document` and `templateComponents[].type` is `header`.** A document, by `link` or Meta media `id`. Needs `link` or `id`. | | `templateComponents[].parameters[].document.link` | string | The document's public URL. | | `templateComponents[].parameters[].document.id` | string | The document's Meta media id. Spaces around it are ignored. Can't be blank. | | `templateComponents[].parameters[].document.filename` | string | The file name the customer sees. At most 240 characters. | | `templateComponents[].parameters[].currency` | object | **Required when `type` is `currency` and `templateComponents[].type` is `body`.** An amount of money. | | `templateComponents[].parameters[].currency.fallbackValue` | string | **Required.** The amount as text, such as `$12.50`. | | `templateComponents[].parameters[].currency.code` | string | **Required.** The ISO 4217 currency code. Spaces around it are ignored. | | `templateComponents[].parameters[].currency.amount1000` | integer | **Required.** The amount times 1000. | | `templateComponents[].parameters[].dateTime` | object | **Required when `type` is `date_time` and `templateComponents[].type` is `body`.** A date or time. | | `templateComponents[].parameters[].dateTime.fallbackValue` | string | **Required.** The date or time as text. | | `templateComponents[].subType` | string | **Required when `type` is `button`.** The button's kind: `url` takes a `text` parameter, `quick_reply` a `payload`, `copy_code` a `coupon_code`. | | `templateComponents[].index` | integer | **Required when `type` is `button`.** The button's position, from 0. | | `templateComponents[].parameters[].payload` | string | **Required when `type` is `payload` and `templateComponents[].type` is `button`.** What a quick reply button sends back. At most 256 characters. | | `templateComponents[].parameters[].couponCode` | string | **Required when `type` is `coupon_code` and `templateComponents[].type` is `button`.** The code a copy code button copies. At most 15 characters. | | `from` | string | The connected WhatsApp number to send from, digits only. Without it: the number on the template's WhatsApp Business Account the customer last wrote to, else the oldest number there. | ## Response **201.** WhatsApp accepted the message. ```json { "data": { "message": "Send whatsapp template message successfully", "from": "+1 202-555-0199" } } ``` | Field | Type | Description | | --- | --- | --- | | `data.message` | string | A confirmation. | | `data.from` | string | The WhatsApp number it was sent from. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Expected property name or '}' in JSON at position 1 (line 1 column 2) | The request body isn't valid JSON. The message says where. | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 400 | An OTP code is required for authentication templates | Send the code as `templateParams` with `parameter_name` set to `otp`. | | 400 | Numbered template variables must start at 1 and include each position once | Number the variables from `1`, each once. | | 400 | That WhatsApp number is not connected to this workspace | Use one of the workspace's connected numbers, digits only. `data.accounts` lists them. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 402 | `ADMIN_SERVICES_BLOCKED`: Chatwise services have been paused for this workspace by an administrator. Contact support to restore service. | Sending is paused for the workspace. Contact support. | | 403 | API key does not have the required scope: messages:send | The key lacks the route's scope. Create a key that has it. | | 403 | `WHATSAPP_REAUTH_REQUIRED`: WhatsApp authorization has expired. Ask an administrator to reconnect WhatsApp in Settings. | Meta no longer accepts Chatwise's access to the number. Reconnect it in the dashboard. `reason` is `expired`, `revoked` or `missing`, and the message depends on it. | | 404 | WhatsApp ID not found | The workspace has no WhatsApp number. | | 404 | Template not found | No such template in the key's workspace. Sending by name finds approved templates only. | | 404 | Whatsapp account not found | The workspace has no connected WhatsApp number. | | 404 | No connected WhatsApp number on this template's business account | Connect a number on the template's WhatsApp Business Account. | | 413 | request entity too large | The request body is larger than 100 KB. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error: WhatsApp send failed: 400 {"error":{"message":"(#132000) Number of parameters does not match the expected number of params"}} | WhatsApp didn't accept the message. The number is Meta's HTTP status, and after it comes Meta's answer when that was JSON. A 429 can be tried later, after a 5xx check first, and for other statuses fix what the answer names. | | 500 | Internal server error | Something failed in Chatwise. The message may have been sent, even if it isn't in the conversation. Quote `errorId` to support. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/list-whatsapp-templates # List WhatsApp templates GET /v1/whatsapp/templates. Lists the workspace's WhatsApp templates, newest first, with the variables and buttons each takes. `GET https://api.chatwise.so/v1/whatsapp/templates` Lists the workspace's WhatsApp templates, newest first, with the variables and buttons each takes. The API key needs the `templates:read` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl 'https://api.chatwise.so/v1/whatsapp/templates?limit=25&language=en_US&sendable=true' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/whatsapp/templates?limit=25&language=en_US&sendable=true", { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/whatsapp/templates?limit=25&language=en_US&sendable=true", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Query parameters | Name | Type | Description | | --- | --- | --- | | `limit` | integer | How many to return, from 1 to 100. Default: `50`. | | `cursor` | string | The previous page's `pagination.nextCursor`. Repeat the same filters and order with it. At most 512 characters. | | `q` | string | Text in the template's name, in any case. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 200 characters. | | `name` | string | The exact name, in any case. Finds every translation of a template. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 100 characters. | | `language` | string | The language code, such as `en_US`. Spaces around it are ignored. | | `category` | string | Only templates in this category. One of `UTILITY`, `MARKETING`, `AUTHENTICATION`. | | `status` | string | Meta's review status, such as `APPROVED` or `PENDING`, in any case. Spaces around it are ignored. | | `sendable` | string | `true` for templates the send routes can send, `false` for the others. Leave out for both. | Unknown query parameters are refused with a 400. ## Response **200.** A page of templates. ```json { "data": [ { "id": "123456789012345", "name": "order_ready", "language": "en_US", "category": "UTILITY", "status": "APPROVED", "rejectionReason": null, "sendable": true, "parameterFormat": "NAMED", "requiresOtp": false, "authentication": null, "components": { "header": null, "body": { "text": "Your order {{order_number}} is ready to collect.", "variables": [ "order_number" ] }, "footer": null, "buttons": [] }, "unsupportedReason": null, "createdAt": "2026-11-19T09:00:00.000Z", "updatedAt": "2026-11-19T09:05:00.000Z" } ], "pagination": { "nextCursor": null } } ``` | Field | Type | Description | | --- | --- | --- | | `data[].id` | string | The template's id: Meta's, or Chatwise's for an older template without one. Send it as `templateId`. | | `data[].name` | string | The template's name. | | `data[].language` | string | The template's language code, such as `en_US`. | | `data[].category` | string or null | The template's category. | | `data[].status` | string or null | Meta's review status, such as `APPROVED`, `PENDING`, `REJECTED` or `PAUSED`. | | `data[].rejectionReason` | string or null | Why Meta rejected it, when it is rejected. | | `data[].sendable` | boolean | Whether the send routes can send it: approved, with a layout they support. | | `data[].parameterFormat` | string or null | How its variables are written. Null without variables. | | `data[].requiresOtp` | boolean | Whether sending it needs a one-time code, as the `otp` value in `templateParams`. | | `data[].authentication` | object or null | Settings of an authentication template. Otherwise null. | | `data[].authentication.addSecurityRecommendation` | boolean or null | Whether it tells the customer not to share the code. | | `data[].authentication.codeExpirationMinutes` | number or null | How long it says the code is valid. | | `data[].components` | object | What the template contains. | | `data[].components.header` | object or null | The header, if any. | | `data[].components.header.format` | string | `TEXT`, `IMAGE`, `VIDEO` or `DOCUMENT`. | | `data[].components.header.text` | string or null | The text of a text header. | | `data[].components.header.variables` | array of strings | The header's variables. | | `data[].components.body` | object | The body. | | `data[].components.body.text` | string or null | The body's text. | | `data[].components.body.variables` | array of strings | The body's variables. | | `data[].components.footer` | string or null | The footer's text, if any. | | `data[].components.buttons` | array of objects | The buttons. | | `data[].components.buttons[].index` | integer | The button's position, from 0. Use it as `index` when sending. | | `data[].components.buttons[].type` | string | The button's type, such as `URL`, `QUICK_REPLY`, `PHONE_NUMBER`, `COPY_CODE` or `OTP`. | | `data[].components.buttons[].text` | string or null | The button's label. | | `data[].components.buttons[].url` | string or null | The URL of a `URL` button. | | `data[].components.buttons[].phoneNumber` | string or null | The phone number of a `PHONE_NUMBER` button. | | `data[].components.buttons[].variable` | string or null | The variable at the end of a dynamic URL, if any. | | `data[].components.buttons[].parameterType` | string or null | The parameter the button takes when sending, if any. | | `data[].components.buttons[].otpType` | string or null | The kind of one-time code button, on authentication templates. | | `data[].unsupportedReason` | string or null | Why the send routes can't send it, if they can't because of its layout. | | `data[].createdAt` | string | When Chatwise stored the template. ISO 8601, in UTC. | | `data[].updatedAt` | string | When the template last changed in Chatwise. ISO 8601, in UTC. | | `pagination.nextCursor` | string or null | Send it as `cursor` for the next page. Null on the last page. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 400 | Invalid cursor or cursor does not match this request | The cursor isn't one this route returned, or the filters or order changed since. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: templates:read | The key lacks the route's scope. Create a key that has it. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/create-whatsapp-template # Create a WhatsApp template POST /v1/whatsapp/templates. Creates a WhatsApp template and submits it to Meta for review, on the WhatsApp Business Account of the workspace's oldest connected number. `POST https://api.chatwise.so/v1/whatsapp/templates` Creates a WhatsApp template and submits it to Meta for review, on the WhatsApp Business Account of the workspace's oldest connected number. Send an `Idempotency-Key` with each new template and reuse it, with the same body, when you retry. A repeat answers 200 with the same template. Without the header, two identical submissions count as a repeat too. The API key needs the `templates:write` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl -X POST 'https://api.chatwise.so/v1/whatsapp/templates' \ -H "Authorization: Bearer $CHATWISE_API_KEY" \ -H 'Idempotency-Key: order-ready-en-us-v1' \ -H 'Content-Type: application/json' \ -d '{ "name": "order_ready", "language": "en_US", "category": "UTILITY", "parameterFormat": "NAMED", "components": { "body": { "text": "Your order {{order_number}} is ready to collect.", "examples": { "order_number": "A-1042" } } } }' ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/whatsapp/templates", { method: "POST", headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, "Idempotency-Key": "order-ready-en-us-v1", "Content-Type": "application/json", }, body: JSON.stringify({ "name": "order_ready", "language": "en_US", "category": "UTILITY", "parameterFormat": "NAMED", "components": { "body": { "text": "Your order {{order_number}} is ready to collect.", "examples": { "order_number": "A-1042" } } } }), }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/whatsapp/templates", method="POST", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", "Idempotency-Key": "order-ready-en-us-v1", "Content-Type": "application/json", }, data=json.dumps({ "name": "order_ready", "language": "en_US", "category": "UTILITY", "parameterFormat": "NAMED", "components": { "body": { "text": "Your order {{order_number}} is ready to collect.", "examples": { "order_number": "A-1042" } } } }).encode(), ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Headers | Name | Type | Description | | --- | --- | --- | | `Idempotency-Key` | string | A key you choose for this template: 1 to 128 letters, digits, dots, underscores, hyphens or colons. | ## Body JSON. Unknown fields are refused with a 400. | Field | Type | Description | | --- | --- | --- | | `name` | string | **Required.** Lowercase letters, digits and underscores, up to 100 characters. Spaces around it are ignored. | | `language` | string | **Required.** The language code, such as `en_US`. Each translation is a template of its own. Spaces around it are ignored. | | `category` | string | **Required.** `UTILITY`, `MARKETING` or `AUTHENTICATION`. | | `parameterFormat` | string | Only when `category` is `UTILITY` or `MARKETING`. How variables are written: `NAMED` (`{{order_number}}`) or `POSITIONAL` (`{{1}}`). Default: `NAMED`. | | `components` | object | **Required when `category` is `UTILITY` or `MARKETING`.** What the template contains. | | `components.header` | object | A text header, or a media header with a sample. | | `components.header.format` | string | **Required.** The header's kind. One of `TEXT`, `IMAGE`, `VIDEO`, `DOCUMENT`. | | `components.header.text` | string | **Required when `format` is `TEXT`.** The text, with at most one variable, which can't be at its start or end. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 60 characters. | | `components.header.examples` | object | Only when `format` is `TEXT`. A sample value for the variable, by its name or number. At most 100 entries. | | `components.header.exampleMediaHandle` | string | **Required when `format` is `IMAGE`, `VIDEO`, or `DOCUMENT`.** Meta's handle for a sample file. This API can't create one. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 2048 characters. | | `components.body` | object | **Required.** The message. | | `components.body.text` | string | **Required.** The text. Variables must be inside it, not at its start or end. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 1024 characters. | | `components.body.examples` | object | A sample value for each variable, by its name or number. At most 100 entries. | | `components.footer` | string | Fixed text below the body. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 60 characters. | | `components.buttons` | array of objects | Up to 10 buttons. | | `components.buttons[].type` | string | **Required.** The button's kind. One of `QUICK_REPLY`, `PHONE_NUMBER`, `URL`. | | `components.buttons[].text` | string | **Required.** The button's label. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 25 characters. | | `components.buttons[].phoneNumber` | string | **Required when `type` is `PHONE_NUMBER`.** The number to call: 8 to 15 digits, with or without a `+`. | | `components.buttons[].url` | string | **Required when `type` is `URL`.** The page to open. It may end with one variable. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 2000 characters. | | `components.buttons[].exampleUrl` | string | Only when `type` is `URL`. A complete sample URL, when the URL has a variable. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 2000 characters. | | `authentication` | object | **Required when `category` is `AUTHENTICATION`.** Settings of an authentication template. Its text and copy code button are WhatsApp's own. | | `authentication.codeExpirationMinutes` | integer | **Required.** How long the code is valid, from 1 to 90. | | `authentication.addSecurityRecommendation` | boolean | Whether to tell the customer not to share the code. Default: `false`. | | `authentication.buttonText` | string | The copy button's label. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 25 characters. Default: `Copy Code`. | ## Response **201.** Submitted to Meta. ```json { "data": { "id": "123456789012345", "name": "order_ready", "language": "en_US", "category": "UTILITY", "status": "PENDING", "rejectionReason": null, "sendable": false, "parameterFormat": "NAMED", "requiresOtp": false, "authentication": null, "components": { "header": null, "body": { "text": "Your order {{order_number}} is ready to collect.", "variables": [ "order_number" ] }, "footer": null, "buttons": [] }, "unsupportedReason": null, "createdAt": "2026-11-19T09:00:00.000Z", "updatedAt": "2026-11-19T09:00:00.000Z" } } ``` | Field | Type | Description | | --- | --- | --- | | `data.id` | string | The template's id: Meta's, or Chatwise's for an older template without one. Send it as `templateId`. | | `data.name` | string | The template's name. | | `data.language` | string | The template's language code, such as `en_US`. | | `data.category` | string or null | The template's category. | | `data.status` | string or null | Meta's review status, such as `APPROVED`, `PENDING`, `REJECTED` or `PAUSED`. | | `data.rejectionReason` | string or null | Why Meta rejected it, when it is rejected. | | `data.sendable` | boolean | Whether the send routes can send it: approved, with a layout they support. | | `data.parameterFormat` | string or null | How its variables are written. Null without variables. | | `data.requiresOtp` | boolean | Whether sending it needs a one-time code, as the `otp` value in `templateParams`. | | `data.authentication` | object or null | Settings of an authentication template. Otherwise null. | | `data.authentication.addSecurityRecommendation` | boolean or null | Whether it tells the customer not to share the code. | | `data.authentication.codeExpirationMinutes` | number or null | How long it says the code is valid. | | `data.components` | object | What the template contains. | | `data.components.header` | object or null | The header, if any. | | `data.components.header.format` | string | `TEXT`, `IMAGE`, `VIDEO` or `DOCUMENT`. | | `data.components.header.text` | string or null | The text of a text header. | | `data.components.header.variables` | array of strings | The header's variables. | | `data.components.body` | object | The body. | | `data.components.body.text` | string or null | The body's text. | | `data.components.body.variables` | array of strings | The body's variables. | | `data.components.footer` | string or null | The footer's text, if any. | | `data.components.buttons` | array of objects | The buttons. | | `data.components.buttons[].index` | integer | The button's position, from 0. Use it as `index` when sending. | | `data.components.buttons[].type` | string | The button's type, such as `URL`, `QUICK_REPLY`, `PHONE_NUMBER`, `COPY_CODE` or `OTP`. | | `data.components.buttons[].text` | string or null | The button's label. | | `data.components.buttons[].url` | string or null | The URL of a `URL` button. | | `data.components.buttons[].phoneNumber` | string or null | The phone number of a `PHONE_NUMBER` button. | | `data.components.buttons[].variable` | string or null | The variable at the end of a dynamic URL, if any. | | `data.components.buttons[].parameterType` | string or null | The parameter the button takes when sending, if any. | | `data.components.buttons[].otpType` | string or null | The kind of one-time code button, on authentication templates. | | `data.unsupportedReason` | string or null | Why the send routes can't send it, if they can't because of its layout. | | `data.createdAt` | string | When Chatwise stored the template. ISO 8601, in UTC. | | `data.updatedAt` | string | When the template last changed in Chatwise. ISO 8601, in UTC. | **200.** A repeat of an earlier submission, with the template as it is now. ```json { "data": { "id": "123456789012345", "name": "order_ready", "language": "en_US", "category": "UTILITY", "status": "APPROVED", "rejectionReason": null, "sendable": true, "parameterFormat": "NAMED", "requiresOtp": false, "authentication": null, "components": { "header": null, "body": { "text": "Your order {{order_number}} is ready to collect.", "variables": [ "order_number" ] }, "footer": null, "buttons": [] }, "unsupportedReason": null, "createdAt": "2026-11-19T09:00:00.000Z", "updatedAt": "2026-11-19T09:05:00.000Z" } } ``` ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Expected property name or '}' in JSON at position 1 (line 1 column 2) | The request body isn't valid JSON. The message says where. | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 400 | Provide one sample value for each placeholder | The definition breaks one of WhatsApp's template rules. `field` and `message` say which. | | 400 | Meta rejected the template submission. Check the template details and try again | Meta refused the submission. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: templates:write | The key lacks the route's scope. Create a key that has it. | | 403 | The connected WhatsApp account is not authorized to create templates | The connected WhatsApp account can't create templates. | | 403 | `WHATSAPP_REAUTH_REQUIRED`: WhatsApp authorization has expired. Ask an administrator to reconnect WhatsApp in Settings. | Meta no longer accepts Chatwise's access to the number. Reconnect it in the dashboard. `reason` is `expired`, `revoked` or `missing`, and the message depends on it. | | 404 | Active WhatsApp connection not found | Connect a WhatsApp number in the dashboard first. | | 404 | Template not found | The template this submission created was deleted since. Use a new `Idempotency-Key`. | | 409 | `TEMPLATE_EXISTS`: A WhatsApp template with this name and language already exists | Use another name, or read the existing template. | | 409 | `IDEMPOTENCY_KEY_REUSED`: This Idempotency-Key was already used with different template details | Use a new key for a new template. | | 409 | `TEMPLATE_SUBMISSION_IN_PROGRESS`: A submission for this template name and language is already in progress | A submission of this name and language, with this key or another, is running or unconfirmed. Wait, then repeat the request with the key it was made with. | | 409 | `TEMPLATE_SUBMISSION_UNCONFIRMED`: Meta has not confirmed this submission. Retry using the same Idempotency-Key | Repeat the request later with the same key and body. If it keeps answering this, Meta doesn't have the template: submit it under another name. | | 409 | `WHATSAPP_CONNECTION_CHANGED`: The WhatsApp connection changed after this template was submitted | The workspace connected another WhatsApp Business Account since. Submit again with a new key. | | 413 | request entity too large | The request body is larger than 100 KB. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Repeat the request with the same key and body. | | 502 | `WHATSAPP_LOOKUP_FAILED`: Could not check the WhatsApp template submission | Repeat the request with the same key and body. | | 502 | `TEMPLATE_SUBMISSION_UNCONFIRMED`: The WhatsApp template submission could not be confirmed. Retry using the same Idempotency-Key | Repeat the request with the same key and body. | | 503 | `WHATSAPP_RATE_LIMITED`: WhatsApp is rate limiting template submissions. Retry with the same Idempotency-Key | Wait, then repeat the request with the same key and body. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/get-whatsapp-template # Get a WhatsApp template GET /v1/whatsapp/templates/{templateId}. Reads one WhatsApp template. `GET https://api.chatwise.so/v1/whatsapp/templates/{templateId}` Reads one WhatsApp template. After creating one, poll it until `status` is no longer `PENDING`. `sendable` then says whether the send routes can send it. The API key needs the `templates:read` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl 'https://api.chatwise.so/v1/whatsapp/templates/123456789012345' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/whatsapp/templates/123456789012345", { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/whatsapp/templates/123456789012345", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Path parameters | Name | Type | Description | | --- | --- | --- | | `templateId` | string | **Required.** The template's id: Meta's, or Chatwise's own numeric id. Not `.` or `..`, which a URL can't carry. At most 128 characters. | ## Response **200.** The template. ```json { "data": { "id": "123456789012345", "name": "order_ready", "language": "en_US", "category": "UTILITY", "status": "APPROVED", "rejectionReason": null, "sendable": true, "parameterFormat": "NAMED", "requiresOtp": false, "authentication": null, "components": { "header": null, "body": { "text": "Your order {{order_number}} is ready to collect.", "variables": [ "order_number" ] }, "footer": null, "buttons": [] }, "unsupportedReason": null, "createdAt": "2026-11-19T09:00:00.000Z", "updatedAt": "2026-11-19T09:05:00.000Z" } } ``` | Field | Type | Description | | --- | --- | --- | | `data.id` | string | The template's id: Meta's, or Chatwise's for an older template without one. Send it as `templateId`. | | `data.name` | string | The template's name. | | `data.language` | string | The template's language code, such as `en_US`. | | `data.category` | string or null | The template's category. | | `data.status` | string or null | Meta's review status, such as `APPROVED`, `PENDING`, `REJECTED` or `PAUSED`. | | `data.rejectionReason` | string or null | Why Meta rejected it, when it is rejected. | | `data.sendable` | boolean | Whether the send routes can send it: approved, with a layout they support. | | `data.parameterFormat` | string or null | How its variables are written. Null without variables. | | `data.requiresOtp` | boolean | Whether sending it needs a one-time code, as the `otp` value in `templateParams`. | | `data.authentication` | object or null | Settings of an authentication template. Otherwise null. | | `data.authentication.addSecurityRecommendation` | boolean or null | Whether it tells the customer not to share the code. | | `data.authentication.codeExpirationMinutes` | number or null | How long it says the code is valid. | | `data.components` | object | What the template contains. | | `data.components.header` | object or null | The header, if any. | | `data.components.header.format` | string | `TEXT`, `IMAGE`, `VIDEO` or `DOCUMENT`. | | `data.components.header.text` | string or null | The text of a text header. | | `data.components.header.variables` | array of strings | The header's variables. | | `data.components.body` | object | The body. | | `data.components.body.text` | string or null | The body's text. | | `data.components.body.variables` | array of strings | The body's variables. | | `data.components.footer` | string or null | The footer's text, if any. | | `data.components.buttons` | array of objects | The buttons. | | `data.components.buttons[].index` | integer | The button's position, from 0. Use it as `index` when sending. | | `data.components.buttons[].type` | string | The button's type, such as `URL`, `QUICK_REPLY`, `PHONE_NUMBER`, `COPY_CODE` or `OTP`. | | `data.components.buttons[].text` | string or null | The button's label. | | `data.components.buttons[].url` | string or null | The URL of a `URL` button. | | `data.components.buttons[].phoneNumber` | string or null | The phone number of a `PHONE_NUMBER` button. | | `data.components.buttons[].variable` | string or null | The variable at the end of a dynamic URL, if any. | | `data.components.buttons[].parameterType` | string or null | The parameter the button takes when sending, if any. | | `data.components.buttons[].otpType` | string or null | The kind of one-time code button, on authentication templates. | | `data.unsupportedReason` | string or null | Why the send routes can't send it, if they can't because of its layout. | | `data.createdAt` | string | When Chatwise stored the template. ISO 8601, in UTC. | | `data.updatedAt` | string | When the template last changed in Chatwise. ISO 8601, in UTC. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: templates:read | The key lacks the route's scope. Create a key that has it. | | 404 | Template not found | No such template in the key's workspace. Sending by name finds approved templates only. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/list-webhook-endpoints # List webhook endpoints GET /v1/webhook-endpoints. Lists the workspace's webhook endpoints, oldest first. `GET https://api.chatwise.so/v1/webhook-endpoints` Lists the workspace's webhook endpoints, oldest first. There are at most 10, so there are no pages. Signing secrets are never listed. The API key needs the `webhooks:read` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl 'https://api.chatwise.so/v1/webhook-endpoints' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/webhook-endpoints", { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/webhook-endpoints", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Response **200.** The endpoints. ```json { "data": [ { "id": "we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", "name": "Order support", "url": "https://example.com/webhooks/chatwise", "events": [ "message.received" ], "accountIds": [], "status": "ACTIVE", "apiVersion": "2026-12-01", "health": { "lastSuccessAt": "2026-11-12T09:21:08.000Z", "lastFailureAt": null, "consecutiveFailures": 0, "disabledAt": null, "disabledReason": null }, "createdAt": "2026-11-02T10:00:00.000Z", "updatedAt": "2026-11-12T09:21:08.000Z" } ] } ``` | Field | Type | Description | | --- | --- | --- | | `data[].id` | string | The endpoint's id. | | `data[].name` | string | The endpoint's name. | | `data[].url` | string | Where events are sent. | | `data[].events` | array of strings | The events it receives. Each one of `message.received`, `message.sent`, `message.delivered`, `message.read`, `message.failed`, `comment.received`. | | `data[].accountIds` | array of strings | The accounts it receives events for. Empty means every account. | | `data[].status` | string | `ACTIVE`, `PAUSED` by the workspace, or `DISABLED` by Chatwise (see `health.disabledReason`). | | `data[].apiVersion` | string | The payload format it receives, as a date. | | `data[].health` | object | How its deliveries are going. | | `data[].health.lastSuccessAt` | string or null | When an attempt last succeeded. ISO 8601, in UTC. | | `data[].health.lastFailureAt` | string or null | When an attempt last failed. ISO 8601, in UTC. | | `data[].health.consecutiveFailures` | integer | Failed attempts since the last success. | | `data[].health.disabledAt` | string or null | When Chatwise disabled it. ISO 8601, in UTC. | | `data[].health.disabledReason` | string or null | Why Chatwise disabled it. | | `data[].createdAt` | string | When it was created. ISO 8601, in UTC. | | `data[].updatedAt` | string | When it, or its health, last changed. ISO 8601, in UTC. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: webhooks:read | The key lacks the route's scope. Create a key that has it. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/create-webhook-endpoint # Create a webhook endpoint POST /v1/webhook-endpoints. Creates an endpoint that receives events. `POST https://api.chatwise.so/v1/webhook-endpoints` Creates an endpoint that receives events. The response is the only time `signingSecret` is returned, so store it right away. The endpoint receives events that happen after it was created. A workspace can have 10 endpoints. The API key needs the `webhooks:write` scope. It also needs `messages:read` when you subscribe to `message.*` events. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl -X POST 'https://api.chatwise.so/v1/webhook-endpoints' \ -H "Authorization: Bearer $CHATWISE_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "name": "Order support", "url": "https://example.com/webhooks/chatwise", "events": [ "message.received" ] }' ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/webhook-endpoints", { method: "POST", headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ "name": "Order support", "url": "https://example.com/webhooks/chatwise", "events": [ "message.received" ] }), }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/webhook-endpoints", method="POST", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", "Content-Type": "application/json", }, data=json.dumps({ "name": "Order support", "url": "https://example.com/webhooks/chatwise", "events": [ "message.received" ] }).encode(), ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Body JSON. Unknown fields are refused with a 400. | Field | Type | Description | | --- | --- | --- | | `name` | string | **Required.** A name for the endpoint, 1 to 80 characters. Spaces around it are ignored. Can't be blank, or contain control characters or unpaired surrogates. | | `url` | string | **Required.** Where to send events: a public `https://` URL on port 443, without a username, password or `#fragment`. Spaces around it are ignored. At most 2048 characters. | | `events` | array of strings | **Required.** The events to receive. `message.*` events also need the `messages:read` scope. Each one of `message.received`, `message.sent`, `message.delivered`, `message.read`, `message.failed`, `comment.received`. | | `accountIds` | array of strings | Only send events for these accounts. Leave out, or send an empty list, for every account. At most 50. | ## Response **201.** The endpoint, with its signing secret. ```json { "data": { "id": "we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", "name": "Order support", "url": "https://example.com/webhooks/chatwise", "events": [ "message.received" ], "accountIds": [], "status": "ACTIVE", "apiVersion": "2026-12-01", "health": { "lastSuccessAt": null, "lastFailureAt": null, "consecutiveFailures": 0, "disabledAt": null, "disabledReason": null }, "createdAt": "2026-11-02T10:00:00.000Z", "updatedAt": "2026-11-02T10:00:00.000Z", "signingSecret": "whsec_ZXhhbXBsZS1zZWNyZXQtZG8tbm90LXVzZS0wMDAwMDA=" } } ``` | Field | Type | Description | | --- | --- | --- | | `data.id` | string | The endpoint's id. | | `data.name` | string | The endpoint's name. | | `data.url` | string | Where events are sent. | | `data.events` | array of strings | The events it receives. Each one of `message.received`, `message.sent`, `message.delivered`, `message.read`, `message.failed`, `comment.received`. | | `data.accountIds` | array of strings | The accounts it receives events for. Empty means every account. | | `data.status` | string | `ACTIVE`, `PAUSED` by the workspace, or `DISABLED` by Chatwise (see `health.disabledReason`). | | `data.apiVersion` | string | The payload format it receives, as a date. | | `data.health` | object | How its deliveries are going. | | `data.health.lastSuccessAt` | string or null | When an attempt last succeeded. ISO 8601, in UTC. | | `data.health.lastFailureAt` | string or null | When an attempt last failed. ISO 8601, in UTC. | | `data.health.consecutiveFailures` | integer | Failed attempts since the last success. | | `data.health.disabledAt` | string or null | When Chatwise disabled it. ISO 8601, in UTC. | | `data.health.disabledReason` | string or null | Why Chatwise disabled it. | | `data.createdAt` | string | When it was created. ISO 8601, in UTC. | | `data.updatedAt` | string | When it, or its health, last changed. ISO 8601, in UTC. | | `data.signingSecret` | string | The secret that signs its deliveries: `whsec_` and 32 random bytes in base64. Shown only here; store it safely. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Expected property name or '}' in JSON at position 1 (line 1 column 2) | The request body isn't valid JSON. The message says where. | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 400 | Use a public https:// URL on port 443, without a username, password or #fragment. | The URL can't receive webhooks. | | 400 | Every account id must be one of this workspace's connected accounts. | An id in `accountIds` isn't one of the workspace's accounts. | | 400 | A workspace can have at most 10 webhook endpoints. | Delete an endpoint you no longer use. | | 400 | Message events need an API key with the messages:read scope too. | The key lacks `messages:read`, which `message.*` events need. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: webhooks:write | The key lacks the route's scope. Create a key that has it. | | 413 | request entity too large | The request body is larger than 100 KB. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/get-webhook-endpoint # Get a webhook endpoint GET /v1/webhook-endpoints/{endpointId}. Reads one endpoint and how its deliveries are going. `GET https://api.chatwise.so/v1/webhook-endpoints/{endpointId}` Reads one endpoint and how its deliveries are going. The API key needs the `webhooks:read` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl 'https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Path parameters | Name | Type | Description | | --- | --- | --- | | `endpointId` | string | **Required.** The endpoint's id (`we_…`). | ## Response **200.** The endpoint. ```json { "data": { "id": "we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", "name": "Order support", "url": "https://example.com/webhooks/chatwise", "events": [ "message.received" ], "accountIds": [], "status": "ACTIVE", "apiVersion": "2026-12-01", "health": { "lastSuccessAt": "2026-11-12T09:21:08.000Z", "lastFailureAt": null, "consecutiveFailures": 0, "disabledAt": null, "disabledReason": null }, "createdAt": "2026-11-02T10:00:00.000Z", "updatedAt": "2026-11-12T09:21:08.000Z" } } ``` | Field | Type | Description | | --- | --- | --- | | `data.id` | string | The endpoint's id. | | `data.name` | string | The endpoint's name. | | `data.url` | string | Where events are sent. | | `data.events` | array of strings | The events it receives. Each one of `message.received`, `message.sent`, `message.delivered`, `message.read`, `message.failed`, `comment.received`. | | `data.accountIds` | array of strings | The accounts it receives events for. Empty means every account. | | `data.status` | string | `ACTIVE`, `PAUSED` by the workspace, or `DISABLED` by Chatwise (see `health.disabledReason`). | | `data.apiVersion` | string | The payload format it receives, as a date. | | `data.health` | object | How its deliveries are going. | | `data.health.lastSuccessAt` | string or null | When an attempt last succeeded. ISO 8601, in UTC. | | `data.health.lastFailureAt` | string or null | When an attempt last failed. ISO 8601, in UTC. | | `data.health.consecutiveFailures` | integer | Failed attempts since the last success. | | `data.health.disabledAt` | string or null | When Chatwise disabled it. ISO 8601, in UTC. | | `data.health.disabledReason` | string or null | Why Chatwise disabled it. | | `data.createdAt` | string | When it was created. ISO 8601, in UTC. | | `data.updatedAt` | string | When it, or its health, last changed. ISO 8601, in UTC. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: webhooks:read | The key lacks the route's scope. Create a key that has it. | | 404 | Webhook endpoint not found | No endpoint with this id in the key's workspace. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/update-webhook-endpoint # Update a webhook endpoint PATCH /v1/webhook-endpoints/{endpointId}. Changes an endpoint. `PATCH https://api.chatwise.so/v1/webhook-endpoints/{endpointId}` Changes an endpoint. Send only the fields to change, at least one. - `status: PAUSED` stops new deliveries: what happens while it is paused isn't sent. Deliveries already waiting are sent once it is active again. - `status: ACTIVE` resumes it, also after Chatwise disabled it, and clears its failure count. - Removing an event cancels its deliveries that weren't sent yet. Changing `accountIds` cancels none. - A new `url` also receives the deliveries that were already waiting. The API key needs the `webhooks:write` scope. It also needs `messages:read` when the endpoint has `message.*` events, before or after the change. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl -X PATCH 'https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C' \ -H "Authorization: Bearer $CHATWISE_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "status": "PAUSED" }' ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", { method: "PATCH", headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ "status": "PAUSED" }), }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", method="PATCH", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", "Content-Type": "application/json", }, data=json.dumps({ "status": "PAUSED" }).encode(), ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Path parameters | Name | Type | Description | | --- | --- | --- | | `endpointId` | string | **Required.** The endpoint's id (`we_…`). | ## Body JSON. Unknown fields are refused with a 400. | Field | Type | Description | | --- | --- | --- | | `name` | string | A name for the endpoint, 1 to 80 characters. Spaces around it are ignored. Can't be blank, or contain control characters or unpaired surrogates. | | `url` | string | Where to send events: a public `https://` URL on port 443, without a username, password or `#fragment`. Spaces around it are ignored. At most 2048 characters. | | `events` | array of strings | The events to receive. `message.*` events also need the `messages:read` scope. Each one of `message.received`, `message.sent`, `message.delivered`, `message.read`, `message.failed`, `comment.received`. | | `accountIds` | array of strings | The accounts to send events for, instead of the ones it has. An empty list means every account. Leave out to keep them. At most 50. | | `status` | string | `PAUSED` to stop deliveries, `ACTIVE` to resume them. | ## Response **200.** The endpoint after the change. ```json { "data": { "id": "we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", "name": "Order support", "url": "https://example.com/webhooks/chatwise", "events": [ "message.received" ], "accountIds": [], "status": "PAUSED", "apiVersion": "2026-12-01", "health": { "lastSuccessAt": "2026-11-12T09:21:08.000Z", "lastFailureAt": null, "consecutiveFailures": 0, "disabledAt": null, "disabledReason": null }, "createdAt": "2026-11-02T10:00:00.000Z", "updatedAt": "2026-11-13T11:20:00.000Z" } } ``` | Field | Type | Description | | --- | --- | --- | | `data.id` | string | The endpoint's id. | | `data.name` | string | The endpoint's name. | | `data.url` | string | Where events are sent. | | `data.events` | array of strings | The events it receives. Each one of `message.received`, `message.sent`, `message.delivered`, `message.read`, `message.failed`, `comment.received`. | | `data.accountIds` | array of strings | The accounts it receives events for. Empty means every account. | | `data.status` | string | `ACTIVE`, `PAUSED` by the workspace, or `DISABLED` by Chatwise (see `health.disabledReason`). | | `data.apiVersion` | string | The payload format it receives, as a date. | | `data.health` | object | How its deliveries are going. | | `data.health.lastSuccessAt` | string or null | When an attempt last succeeded. ISO 8601, in UTC. | | `data.health.lastFailureAt` | string or null | When an attempt last failed. ISO 8601, in UTC. | | `data.health.consecutiveFailures` | integer | Failed attempts since the last success. | | `data.health.disabledAt` | string or null | When Chatwise disabled it. ISO 8601, in UTC. | | `data.health.disabledReason` | string or null | Why Chatwise disabled it. | | `data.createdAt` | string | When it was created. ISO 8601, in UTC. | | `data.updatedAt` | string | When it, or its health, last changed. ISO 8601, in UTC. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Expected property name or '}' in JSON at position 1 (line 1 column 2) | The request body isn't valid JSON. The message says where. | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 400 | Use a public https:// URL on port 443, without a username, password or #fragment. | The URL can't receive webhooks. | | 400 | Every account id must be one of this workspace's connected accounts. | An id in `accountIds` isn't one of the workspace's accounts. | | 400 | Message events need an API key with the messages:read scope too. | The key lacks `messages:read`, which `message.*` events need. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: webhooks:write | The key lacks the route's scope. Create a key that has it. | | 403 | Changing an endpoint that receives message events needs an API key with the messages:read scope too. | The endpoint has `message.*` events and the key lacks `messages:read`. | | 404 | Webhook endpoint not found | No endpoint with this id in the key's workspace. | | 413 | request entity too large | The request body is larger than 100 KB. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/delete-webhook-endpoint # Delete a webhook endpoint DELETE /v1/webhook-endpoints/{endpointId}. Deletes an endpoint and cancels its deliveries that weren't sent yet. `DELETE https://api.chatwise.so/v1/webhook-endpoints/{endpointId}` Deletes an endpoint and cancels its deliveries that weren't sent yet. Its delivery log can no longer be read. The API key needs the `webhooks:write` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl -X DELETE 'https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", { method: "DELETE", headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", method="DELETE", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Path parameters | Name | Type | Description | | --- | --- | --- | | `endpointId` | string | **Required.** The endpoint's id (`we_…`). | ## Response **200.** Deleted. ```json { "data": { "id": "we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", "deleted": true } } ``` | Field | Type | Description | | --- | --- | --- | | `data.id` | string | The deleted endpoint's id. | | `data.deleted` | boolean | Always `true`. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: webhooks:write | The key lacks the route's scope. Create a key that has it. | | 404 | Webhook endpoint not found | No endpoint with this id in the key's workspace. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/test-webhook-endpoint # Send a test event POST /v1/webhook-endpoints/{endpointId}/test. Sends a signed `webhook.test` event now and answers with what your endpoint did. `POST https://api.chatwise.so/v1/webhook-endpoints/{endpointId}/test` Sends a signed [`webhook.test`](https://chatwise.so/docs/webhooks/events/webhook-test.md) event now and answers with what your endpoint did. It also works while the endpoint is paused. Tests aren't retried and don't appear in the delivery log. The API key needs the `webhooks:write` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl -X POST 'https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/test' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/test", { method: "POST", headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/test", method="POST", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Path parameters | Name | Type | Description | | --- | --- | --- | | `endpointId` | string | **Required.** The endpoint's id (`we_…`). | ## Response **200.** What your endpoint answered. Check `delivered`: this is 200 even when your endpoint failed. ```json { "data": { "delivered": true, "statusCode": 204, "durationMs": 182, "error": null } } ``` | Field | Type | Description | | --- | --- | --- | | `data.delivered` | boolean | Whether your endpoint answered with a 2xx status. | | `data.statusCode` | integer or null | The HTTP status it answered, if it did. | | `data.durationMs` | integer | How long it took, in milliseconds. | | `data.error` | string or null | Why it failed, such as `http_500` or `timeout`. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: webhooks:write | The key lacks the route's scope. Create a key that has it. | | 404 | Webhook endpoint not found | No endpoint with this id in the key's workspace. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/rotate-webhook-secret # Rotate the signing secret POST /v1/webhook-endpoints/{endpointId}/rotate-secret. Replaces the endpoint's signing secret and returns the new one, the only time it is returned. `POST https://api.chatwise.so/v1/webhook-endpoints/{endpointId}/rotate-secret` Replaces the endpoint's signing secret and returns the new one, the only time it is returned. For 24 hours every delivery carries two signatures, made with the new secret and the previous one, so you can switch without missing any. The API key needs the `webhooks:write` scope. It also needs `messages:read` when the endpoint has `message.*` events. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl -X POST 'https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/rotate-secret' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/rotate-secret", { method: "POST", headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/rotate-secret", method="POST", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Path parameters | Name | Type | Description | | --- | --- | --- | | `endpointId` | string | **Required.** The endpoint's id (`we_…`). | ## Response **200.** The new secret. ```json { "data": { "signingSecret": "whsec_ZXhhbXBsZS1zZWNyZXQtZG8tbm90LXVzZS0wMDAwMDA=", "previousSecretExpiresAt": "2026-12-01T10:00:00.000Z" } } ``` | Field | Type | Description | | --- | --- | --- | | `data.signingSecret` | string | The secret that signs its deliveries: `whsec_` and 32 random bytes in base64. Shown only here; store it safely. | | `data.previousSecretExpiresAt` | string | Until when deliveries are signed with the previous secret too. ISO 8601, in UTC. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: webhooks:write | The key lacks the route's scope. Create a key that has it. | | 403 | Changing an endpoint that receives message events needs an API key with the messages:read scope too. | The endpoint has `message.*` events and the key lacks `messages:read`. | | 404 | Webhook endpoint not found | No endpoint with this id in the key's workspace. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/list-webhook-event-types # List event types GET /v1/webhook-event-types. Lists the events an endpoint can subscribe to and the channels each covers. `GET https://api.chatwise.so/v1/webhook-event-types` Lists the events an endpoint can subscribe to and the channels each covers. Some are listed before they are sent: see [events](https://chatwise.so/docs/webhooks/events.md). The API key needs the `webhooks:read` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl 'https://api.chatwise.so/v1/webhook-event-types' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/webhook-event-types", { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/webhook-event-types", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Response **200.** The events. ```json { "data": [ { "type": "message.received", "description": "A customer sent a message.", "channels": [ "WHATSAPP", "INSTAGRAM", "MESSENGER", "WEBSITE_CHAT" ] }, { "type": "message.sent", "description": "The workspace sent a message: from the dashboard, the mobile app, the API, MCP, a flow, Comment to DM, or the native WhatsApp Business or Instagram app.", "channels": [ "WHATSAPP", "INSTAGRAM", "MESSENGER", "WEBSITE_CHAT" ] }, { "type": "message.delivered", "description": "The channel reported an outgoing message was delivered.", "channels": [ "WHATSAPP", "MESSENGER" ] }, { "type": "message.read", "description": "The channel reported the customer read an outgoing message.", "channels": [ "WHATSAPP", "INSTAGRAM", "MESSENGER" ] }, { "type": "message.failed", "description": "The channel reported an outgoing message could not be delivered.", "channels": [ "WHATSAPP" ] }, { "type": "comment.received", "description": "Someone commented on a post of a connected Instagram account.", "channels": [ "INSTAGRAM" ] } ] } ``` | Field | Type | Description | | --- | --- | --- | | `data[].type` | string | The event's name. One of `message.received`, `message.sent`, `message.delivered`, `message.read`, `message.failed`, `comment.received`. | | `data[].description` | string | When it happens. | | `data[].channels` | array of strings | The channels it covers. Each one of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: webhooks:read | The key lacks the route's scope. Create a key that has it. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/list-webhook-deliveries # List deliveries GET /v1/webhook-endpoints/{endpointId}/deliveries. Lists an endpoint's deliveries, newest first. `GET https://api.chatwise.so/v1/webhook-endpoints/{endpointId}/deliveries` Lists an endpoint's deliveries, newest first. Deliveries are kept for 30 days. The API key needs the `webhooks:read` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl 'https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/deliveries?limit=25&status=RETRY' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/deliveries?limit=25&status=RETRY", { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/deliveries?limit=25&status=RETRY", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Path parameters | Name | Type | Description | | --- | --- | --- | | `endpointId` | string | **Required.** The endpoint's id (`we_…`). | ## Query parameters | Name | Type | Description | | --- | --- | --- | | `limit` | integer | How many to return, from 1 to 100. Default: `50`. | | `cursor` | string | The previous page's `pagination.nextCursor`. Repeat the same filters and order with it. At most 512 characters. | | `status` | string | Only deliveries with this status. One of `PENDING`, `PROCESSING`, `RETRY`, `DELIVERED`, `FAILED`, `CANCELLED`. | | `eventType` | string | Only deliveries of this event. One of `message.received`, `message.sent`, `message.delivered`, `message.read`, `message.failed`, `comment.received`. | Unknown query parameters are refused with a 400. ## Response **200.** A page of deliveries. ```json { "data": [ { "id": "wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90", "eventId": "evt_01JE2Z3QK4T8M6N2R5S7V9W1X3", "eventType": "message.received", "occurredAt": "2026-11-12T09:25:36.000Z", "status": "RETRY", "attempts": 1, "lastStatusCode": 503, "lastError": "http_503", "lastDurationMs": 214, "nextAttemptAt": "2026-11-12T09:25:47.000Z", "deliveredAt": null, "createdAt": "2026-11-12T09:25:37.000Z" } ], "pagination": { "nextCursor": null } } ``` | Field | Type | Description | | --- | --- | --- | | `data[].id` | string | The delivery's id, also sent as the `X-Chatwise-Delivery` header. | | `data[].eventId` | string | The event's id, also sent as the `webhook-id` header. | | `data[].eventType` | string | The event's name. One of `message.received`, `message.sent`, `message.delivered`, `message.read`, `message.failed`, `comment.received`. | | `data[].occurredAt` | string | When the event happened. ISO 8601, in UTC. | | `data[].status` | string | `PENDING` (waiting), `PROCESSING` (being sent), `RETRY` (waiting for its next attempt), `DELIVERED`, `FAILED` or `CANCELLED`. | | `data[].attempts` | integer | Attempts so far. Redelivering starts again from 0. | | `data[].lastStatusCode` | integer or null | The HTTP status the last attempt got. Null when there was no answer. | | `data[].lastError` | string or null | Why the last attempt failed, such as `http_500` or `timeout`. `retry_exhausted` once the last of all attempts failed. | | `data[].lastDurationMs` | integer or null | How long the last attempt took, in milliseconds. | | `data[].nextAttemptAt` | string or null | When it is next due to be sent, while it is `PENDING` or `RETRY`. Otherwise null. ISO 8601, in UTC. | | `data[].deliveredAt` | string or null | When it was delivered. ISO 8601, in UTC. | | `data[].createdAt` | string | When the delivery was created. ISO 8601, in UTC. | | `pagination.nextCursor` | string or null | Send it as `cursor` for the next page. Null on the last page. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 400 | Invalid cursor or cursor does not match this request | The cursor isn't one this route returned, or the filters or order changed since. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: webhooks:read | The key lacks the route's scope. Create a key that has it. | | 404 | Webhook endpoint not found | No endpoint with this id in the key's workspace. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/get-webhook-delivery # Get a delivery GET /v1/webhook-deliveries/{deliveryId}. Reads one delivery, with the payload it sends and its attempts. `GET https://api.chatwise.so/v1/webhook-deliveries/{deliveryId}` Reads one delivery, with the payload it sends and its attempts. Deliveries are kept for 30 days. The API key needs the `webhooks:read` scope. It also needs `messages:read` when the delivery is for a `message.*` event. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl 'https://api.chatwise.so/v1/webhook-deliveries/wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/webhook-deliveries/wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90", { headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/webhook-deliveries/wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Path parameters | Name | Type | Description | | --- | --- | --- | | `deliveryId` | string | **Required.** The delivery's id (`wd_…`). | ## Response **200.** The delivery. ```json { "data": { "id": "wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90", "eventId": "evt_01JE2Z3QK4T8M6N2R5S7V9W1X3", "eventType": "message.received", "occurredAt": "2026-11-12T09:25:36.000Z", "status": "RETRY", "attempts": 1, "lastStatusCode": 503, "lastError": "http_503", "lastDurationMs": 214, "nextAttemptAt": "2026-11-12T09:25:47.000Z", "deliveredAt": null, "createdAt": "2026-11-12T09:25:37.000Z", "endpointId": "we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", "payload": { "message": { "id": "5678", "conversationId": "1234", "channel": "WHATSAPP", "direction": "inbound", "type": "text", "text": "Is this available in blue?", "sentAt": "2026-11-12T09:25:36.000Z", "ingestedAt": "2026-11-12T09:25:36.412Z", "replyToMessageId": null, "attachments": [] }, "conversation": { "id": "1234", "channel": "WHATSAPP", "status": "open", "participant": { "name": "Jordan Example", "channelId": "12025550147", "phoneNumber": "12025550147", "instagramUsername": null }, "createdAt": "2026-11-01T09:12:00.000Z", "lastMessageAt": "2026-11-12T09:25:36.000Z" }, "account": { "id": "11", "channel": "WHATSAPP" } }, "attemptLog": [ { "attemptNumber": 1, "startedAt": "2026-11-12T09:25:37.120Z", "durationMs": 214, "statusCode": 503, "error": "http_503" } ] } } ``` | Field | Type | Description | | --- | --- | --- | | `data.id` | string | The delivery's id, also sent as the `X-Chatwise-Delivery` header. | | `data.eventId` | string | The event's id, also sent as the `webhook-id` header. | | `data.eventType` | string | The event's name. One of `message.received`, `message.sent`, `message.delivered`, `message.read`, `message.failed`, `comment.received`. | | `data.occurredAt` | string | When the event happened. ISO 8601, in UTC. | | `data.status` | string | `PENDING` (waiting), `PROCESSING` (being sent), `RETRY` (waiting for its next attempt), `DELIVERED`, `FAILED` or `CANCELLED`. | | `data.attempts` | integer | Attempts so far. Redelivering starts again from 0. | | `data.lastStatusCode` | integer or null | The HTTP status the last attempt got. Null when there was no answer. | | `data.lastError` | string or null | Why the last attempt failed, such as `http_500` or `timeout`. `retry_exhausted` once the last of all attempts failed. | | `data.lastDurationMs` | integer or null | How long the last attempt took, in milliseconds. | | `data.nextAttemptAt` | string or null | When it is next due to be sent, while it is `PENDING` or `RETRY`. Otherwise null. ISO 8601, in UTC. | | `data.deliveredAt` | string or null | When it was delivered. ISO 8601, in UTC. | | `data.createdAt` | string | When the delivery was created. ISO 8601, in UTC. | | `data.endpointId` | string | The endpoint it is for. | | `data.payload` | object or null | The event's `data`. Null until the event is prepared, and once its message was unsent, deleted or hidden. | | `data.attemptLog` | array of objects | The attempts that were recorded: all but a success on the first try. After a redelivery the numbers start again and the earlier attempts stay, so sort by `startedAt`. | | `data.attemptLog[].attemptNumber` | integer | The attempt's number, from 1. | | `data.attemptLog[].startedAt` | string | When it started. ISO 8601, in UTC. | | `data.attemptLog[].durationMs` | integer or null | How long it took, in milliseconds. | | `data.attemptLog[].statusCode` | integer or null | The HTTP status your endpoint answered. | | `data.attemptLog[].error` | string or null | Why it failed. Null when it succeeded. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: webhooks:read | The key lacks the route's scope. Create a key that has it. | | 403 | Reading a message event's delivery needs an API key with the messages:read scope too. | The delivery is for a `message.*` event and the key lacks `messages:read`. | | 404 | Webhook delivery not found | No delivery with this id, or its endpoint was deleted, or it is older than 30 days. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/redeliver-webhook-delivery # Redeliver POST /v1/webhook-deliveries/{deliveryId}/redeliver. Sends a delivery again, with the same event id, starting from its first attempt. `POST https://api.chatwise.so/v1/webhook-deliveries/{deliveryId}/redeliver` Sends a delivery again, with the same event id, starting from its first attempt. It can be delivered, failed, cancelled or waiting for a retry. A delivery to a paused or disabled endpoint waits until the endpoint is active. The API key needs the `webhooks:write` scope. It also needs `messages:read` when the delivery is for a `message.*` event. See [authentication and scopes](https://chatwise.so/docs/authentication.md). ## Example **curl**: ```bash curl -X POST 'https://api.chatwise.so/v1/webhook-deliveries/wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90/redeliver' \ -H "Authorization: Bearer $CHATWISE_API_KEY" ``` **Node.js**: ```js const response = await fetch("https://api.chatwise.so/v1/webhook-deliveries/wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90/redeliver", { method: "POST", headers: { Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`, }, }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status}: ${body.message}`); console.log(body.data); ``` **Python**: ```python import json import os import urllib.request request = urllib.request.Request( "https://api.chatwise.so/v1/webhook-deliveries/wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90/redeliver", method="POST", headers={ "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}", }, ) with urllib.request.urlopen(request) as response: print(json.load(response)["data"]) ``` ## Path parameters | Name | Type | Description | | --- | --- | --- | | `deliveryId` | string | **Required.** The delivery's id (`wd_…`). | ## Response **200.** The delivery, waiting to be sent. ```json { "data": { "id": "wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90", "eventId": "evt_01JE2Z3QK4T8M6N2R5S7V9W1X3", "eventType": "message.received", "occurredAt": "2026-11-12T09:25:36.000Z", "status": "PENDING", "attempts": 0, "lastStatusCode": 503, "lastError": null, "lastDurationMs": 214, "nextAttemptAt": "2026-11-12T10:02:11.000Z", "deliveredAt": null, "createdAt": "2026-11-12T09:25:37.000Z", "endpointId": "we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", "payload": { "message": { "id": "5678", "conversationId": "1234", "channel": "WHATSAPP", "direction": "inbound", "type": "text", "text": "Is this available in blue?", "sentAt": "2026-11-12T09:25:36.000Z", "ingestedAt": "2026-11-12T09:25:36.412Z", "replyToMessageId": null, "attachments": [] }, "conversation": { "id": "1234", "channel": "WHATSAPP", "status": "open", "participant": { "name": "Jordan Example", "channelId": "12025550147", "phoneNumber": "12025550147", "instagramUsername": null }, "createdAt": "2026-11-01T09:12:00.000Z", "lastMessageAt": "2026-11-12T09:25:36.000Z" }, "account": { "id": "11", "channel": "WHATSAPP" } }, "attemptLog": [ { "attemptNumber": 1, "startedAt": "2026-11-12T09:25:37.120Z", "durationMs": 214, "statusCode": 503, "error": "http_503" } ] } } ``` | Field | Type | Description | | --- | --- | --- | | `data.id` | string | The delivery's id, also sent as the `X-Chatwise-Delivery` header. | | `data.eventId` | string | The event's id, also sent as the `webhook-id` header. | | `data.eventType` | string | The event's name. One of `message.received`, `message.sent`, `message.delivered`, `message.read`, `message.failed`, `comment.received`. | | `data.occurredAt` | string | When the event happened. ISO 8601, in UTC. | | `data.status` | string | `PENDING` (waiting), `PROCESSING` (being sent), `RETRY` (waiting for its next attempt), `DELIVERED`, `FAILED` or `CANCELLED`. | | `data.attempts` | integer | Attempts so far. Redelivering starts again from 0. | | `data.lastStatusCode` | integer or null | The HTTP status the last attempt got. Null when there was no answer. | | `data.lastError` | string or null | Why the last attempt failed, such as `http_500` or `timeout`. `retry_exhausted` once the last of all attempts failed. | | `data.lastDurationMs` | integer or null | How long the last attempt took, in milliseconds. | | `data.nextAttemptAt` | string or null | When it is next due to be sent, while it is `PENDING` or `RETRY`. Otherwise null. ISO 8601, in UTC. | | `data.deliveredAt` | string or null | When it was delivered. ISO 8601, in UTC. | | `data.createdAt` | string | When the delivery was created. ISO 8601, in UTC. | | `data.endpointId` | string | The endpoint it is for. | | `data.payload` | object or null | The event's `data`. Null until the event is prepared, and once its message was unsent, deleted or hidden. | | `data.attemptLog` | array of objects | The attempts that were recorded: all but a success on the first try. After a redelivery the numbers start again and the earlier attempts stay, so sort by `startedAt`. | | `data.attemptLog[].attemptNumber` | integer | The attempt's number, from 1. | | `data.attemptLog[].startedAt` | string | When it started. ISO 8601, in UTC. | | `data.attemptLog[].durationMs` | integer or null | How long it took, in milliseconds. | | `data.attemptLog[].statusCode` | integer or null | The HTTP status your endpoint answered. | | `data.attemptLog[].error` | string or null | Why it failed. Null when it succeeded. | ## Errors | Status | Message | What it means | | --- | --- | --- | | 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. | | 400 | This delivery is already waiting to be sent. | It is `PENDING` or `PROCESSING`. | | 400 | The endpoint no longer subscribes to message.received. | Subscribe the endpoint to the event again first. | | 400 | The message was unsent, deleted or hidden, so it can't be sent again. | The message is no longer visible through the API either. | | 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer `. | | 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. | | 401 | Invalid API key | Chatwise couldn't check the key. Try again. | | 403 | API key does not have the required scope: webhooks:write | The key lacks the route's scope. Create a key that has it. | | 403 | Reading a message event's delivery needs an API key with the messages:read scope too. | The delivery is for a `message.*` event and the key lacks `messages:read`. | | 404 | Webhook delivery not found | No delivery with this id, or its endpoint was deleted, or it is older than 30 days. | | 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. | | 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. | The body of an error is described in [errors](https://chatwise.so/docs/errors.md). --- Source: https://chatwise.so/docs/api/all-errors # Every error Every error the Chatwise API answers on purpose, by status, with its body and what to do. How errors are shaped, and which to retry, is in [errors](https://chatwise.so/docs/errors.md). ## 400 ### Validation failed A parameter or body field is missing, unknown or malformed. `errors` lists each one. ```json { "message": "Validation failed", "errors": [ { "path": "query.limit", "message": "Limit must be an integer between 1 and 100" } ] } ``` From [list conversations](https://chatwise.so/docs/api/list-conversations.md), [get a conversation](https://chatwise.so/docs/api/get-conversation.md), [list a conversation's messages](https://chatwise.so/docs/api/list-conversation-messages.md), [get a message](https://chatwise.so/docs/api/get-message.md), [list or search messages](https://chatwise.so/docs/api/list-messages.md), [send a template by id](https://chatwise.so/docs/api/send-message.md), [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md), [list WhatsApp templates](https://chatwise.so/docs/api/list-whatsapp-templates.md), [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md), [get a WhatsApp template](https://chatwise.so/docs/api/get-whatsapp-template.md), [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md), [get a webhook endpoint](https://chatwise.so/docs/api/get-webhook-endpoint.md), [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md), [delete a webhook endpoint](https://chatwise.so/docs/api/delete-webhook-endpoint.md), [send a test event](https://chatwise.so/docs/api/test-webhook-endpoint.md), [rotate the signing secret](https://chatwise.so/docs/api/rotate-webhook-secret.md), [list deliveries](https://chatwise.so/docs/api/list-webhook-deliveries.md), [get a delivery](https://chatwise.so/docs/api/get-webhook-delivery.md), and [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md). ### Invalid cursor or cursor does not match this request The cursor isn't one this route returned, or the filters or order changed since. ```json { "object": "Pagination", "field": "cursor", "message": "Invalid cursor or cursor does not match this request" } ``` From [list conversations](https://chatwise.so/docs/api/list-conversations.md), [list a conversation's messages](https://chatwise.so/docs/api/list-conversation-messages.md), [list or search messages](https://chatwise.so/docs/api/list-messages.md), [list WhatsApp templates](https://chatwise.so/docs/api/list-whatsapp-templates.md), and [list deliveries](https://chatwise.so/docs/api/list-webhook-deliveries.md). ### Malformed JSON The request body isn't valid JSON. The message says where. ```json { "message": "Expected property name or '}' in JSON at position 1 (line 1 column 2)" } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md), [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md), [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md), [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md), and [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md). ### Template must be approved to send messages Meta hasn't approved the template, or paused or rejected it. ```json { "object": "Template", "field": "status", "message": "Template must be approved to send messages" } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md). ### This template is on a different WhatsApp Business Account from the number in from Use a `from` number on the template's WhatsApp Business Account. ```json { "object": "Template", "field": "templateId", "message": "This template is on a different WhatsApp Business Account from the number in from" } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md). ### An OTP code is required for authentication templates Send the code as `templateParams` with `parameter_name` set to `otp`. ```json { "object": "Template", "field": "templateParams", "message": "An OTP code is required for authentication templates" } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md). ### Numbered template variables must start at 1 and include each position once Number the variables from `1`, each once. ```json { "object": "Template", "field": "templateParams", "message": "Numbered template variables must start at 1 and include each position once" } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md). ### That WhatsApp number is not connected to this workspace Use one of the workspace's connected numbers, digits only. `data.accounts` lists them. ```json { "object": "channelAccount", "field": "from", "message": "That WhatsApp number is not connected to this workspace", "data": { "accounts": [ { "id": "11", "channel": "WHATSAPP", "connected": true, "needsReconnect": false, "phoneNumber": "+1 202-555-0199", "name": "Example Store", "waBusinessId": "100200300400500", "username": null, "pageId": null, "websiteId": null } ] } } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md). ### Provide one sample value for each placeholder The definition breaks one of WhatsApp's template rules. `field` and `message` say which. ```json { "object": "WhatsApp template", "field": "components.body.examples", "message": "Provide one sample value for each placeholder" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ### Meta rejected the template submission. Check the template details and try again Meta refused the submission. ```json { "object": "WhatsApp template", "field": "body", "message": "Meta rejected the template submission. Check the template details and try again" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ### Use a public https:// URL on port 443, without a username, password or #fragment The URL can't receive webhooks. ```json { "object": "Webhook endpoint", "field": "url", "message": "Use a public https:// URL on port 443, without a username, password or #fragment." } ``` From [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md) and [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md). ### Every account id must be one of this workspace's connected accounts An id in `accountIds` isn't one of the workspace's accounts. ```json { "object": "Webhook endpoint", "field": "accountIds", "message": "Every account id must be one of this workspace's connected accounts." } ``` From [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md) and [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md). ### A workspace can have at most 10 webhook endpoints Delete an endpoint you no longer use. ```json { "object": "Webhook endpoint", "field": "url", "message": "A workspace can have at most 10 webhook endpoints." } ``` From [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md). ### Message events need an API key with the messages:read scope too The key lacks `messages:read`, which `message.*` events need. ```json { "object": "Webhook endpoint", "field": "events", "message": "Message events need an API key with the messages:read scope too." } ``` From [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md) and [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md). ### This delivery is already waiting to be sent It is `PENDING` or `PROCESSING`. ```json { "object": "Webhook delivery", "field": "id", "message": "This delivery is already waiting to be sent." } ``` From [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md). ### The endpoint no longer subscribes Subscribe the endpoint to the event again first. ```json { "object": "Webhook delivery", "field": "id", "message": "The endpoint no longer subscribes to message.received." } ``` From [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md). ### The message was unsent, deleted or hidden, so it can't be sent again The message is no longer visible through the API either. ```json { "object": "Webhook delivery", "field": "id", "message": "The message was unsent, deleted or hidden, so it can't be sent again." } ``` From [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md). ## 401 ### A valid Bearer API key is required The `Authorization` header is missing or isn't `Bearer `. ```json { "message": "A valid Bearer API key is required" } ``` Any route. ### Invalid or revoked API key The key doesn't exist, was revoked, or has expired. ```json { "message": "Invalid or revoked API key" } ``` Any route. ### Invalid API key Chatwise couldn't check the key. Try again. ```json { "message": "Invalid API key" } ``` Any route. ## 402 ### ADMIN_SERVICES_BLOCKED Sending is paused for the workspace. Contact support. ```json { "code": "ADMIN_SERVICES_BLOCKED", "message": "Chatwise services have been paused for this workspace by an administrator. Contact support to restore service." } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md). ## 403 ### API key does not have the required scope The key lacks the route's scope. Create a key that has it. ```json { "message": "API key does not have the required scope: conversations:read" } ``` Any route. ### WHATSAPP_REAUTH_REQUIRED Meta no longer accepts Chatwise's access to the number. Reconnect it in the dashboard. `reason` is `expired`, `revoked` or `missing`, and the message depends on it. ```json { "code": "WHATSAPP_REAUTH_REQUIRED", "message": "WhatsApp authorization has expired. Ask an administrator to reconnect WhatsApp in Settings.", "reason": "expired" } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md), [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md), and [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ### The connected WhatsApp account is not authorized to create templates The connected WhatsApp account can't create templates. ```json { "message": "The connected WhatsApp account is not authorized to create templates" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ### Changing an endpoint that receives message events needs an API key with the messages:read scope too The endpoint has `message.*` events and the key lacks `messages:read`. ```json { "message": "Changing an endpoint that receives message events needs an API key with the messages:read scope too." } ``` From [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md) and [rotate the signing secret](https://chatwise.so/docs/api/rotate-webhook-secret.md). ### Reading a message event's delivery needs an API key with the messages:read scope too The delivery is for a `message.*` event and the key lacks `messages:read`. ```json { "message": "Reading a message event's delivery needs an API key with the messages:read scope too." } ``` From [get a delivery](https://chatwise.so/docs/api/get-webhook-delivery.md) and [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md). ## 404 ### Conversation not found No conversation with this id in the key's workspace. ```json { "message": "Conversation not found" } ``` From [get a conversation](https://chatwise.so/docs/api/get-conversation.md), [list a conversation's messages](https://chatwise.so/docs/api/list-conversation-messages.md), and [list or search messages](https://chatwise.so/docs/api/list-messages.md). ### Message not found No visible message with this id in this conversation. ```json { "message": "Message not found" } ``` From [get a message](https://chatwise.so/docs/api/get-message.md). ### Template not found No such template in the key's workspace. Sending by name finds approved templates only. ```json { "message": "Template not found" } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md), [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md), and [get a WhatsApp template](https://chatwise.so/docs/api/get-whatsapp-template.md). ### Whatsapp account not found The workspace has no connected WhatsApp number. ```json { "message": "Whatsapp account not found" } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md). ### No connected WhatsApp number on this template's business account Connect a number on the template's WhatsApp Business Account. ```json { "message": "No connected WhatsApp number on this template's business account" } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md). ### WhatsApp ID not found The workspace has no WhatsApp number. ```json { "message": "WhatsApp ID not found" } ``` From [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md). ### Active WhatsApp connection not found Connect a WhatsApp number in the dashboard first. ```json { "message": "Active WhatsApp connection not found" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ### Template not found The template this submission created was deleted since. Use a new `Idempotency-Key`. ```json { "message": "Template not found" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ### Webhook endpoint not found No endpoint with this id in the key's workspace. ```json { "message": "Webhook endpoint not found" } ``` From [get a webhook endpoint](https://chatwise.so/docs/api/get-webhook-endpoint.md), [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md), [delete a webhook endpoint](https://chatwise.so/docs/api/delete-webhook-endpoint.md), [send a test event](https://chatwise.so/docs/api/test-webhook-endpoint.md), [rotate the signing secret](https://chatwise.so/docs/api/rotate-webhook-secret.md), and [list deliveries](https://chatwise.so/docs/api/list-webhook-deliveries.md). ### Webhook delivery not found No delivery with this id, or its endpoint was deleted, or it is older than 30 days. ```json { "message": "Webhook delivery not found" } ``` From [get a delivery](https://chatwise.so/docs/api/get-webhook-delivery.md) and [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md). ## 409 ### TEMPLATE_EXISTS Use another name, or read the existing template. ```json { "code": "TEMPLATE_EXISTS", "message": "A WhatsApp template with this name and language already exists" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ### IDEMPOTENCY_KEY_REUSED Use a new key for a new template. ```json { "code": "IDEMPOTENCY_KEY_REUSED", "message": "This Idempotency-Key was already used with different template details" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ### TEMPLATE_SUBMISSION_IN_PROGRESS A submission of this name and language, with this key or another, is running or unconfirmed. Wait, then repeat the request with the key it was made with. ```json { "code": "TEMPLATE_SUBMISSION_IN_PROGRESS", "message": "A submission for this template name and language is already in progress" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ### TEMPLATE_SUBMISSION_UNCONFIRMED Repeat the request later with the same key and body. If it keeps answering this, Meta doesn't have the template: submit it under another name. ```json { "code": "TEMPLATE_SUBMISSION_UNCONFIRMED", "message": "Meta has not confirmed this submission. Retry using the same Idempotency-Key" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ### WHATSAPP_CONNECTION_CHANGED The workspace connected another WhatsApp Business Account since. Submit again with a new key. ```json { "code": "WHATSAPP_CONNECTION_CHANGED", "message": "The WhatsApp connection changed after this template was submitted" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ## 413 ### request entity too large The request body is larger than 100 KB. ```json { "message": "request entity too large" } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md), [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md), [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md), [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md), and [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md). ## 429 ### API key rate limit exceeded Wait the number of seconds in the `Retry-After` header. ```json { "message": "API key rate limit exceeded" } ``` Any route. ## 500 ### Internal server error Something failed in Chatwise. Retry reads with backoff. ```json { "message": "Internal server error" } ``` From [list conversations](https://chatwise.so/docs/api/list-conversations.md), [get a conversation](https://chatwise.so/docs/api/get-conversation.md), [list a conversation's messages](https://chatwise.so/docs/api/list-conversation-messages.md), [get a message](https://chatwise.so/docs/api/get-message.md), [list or search messages](https://chatwise.so/docs/api/list-messages.md), [list WhatsApp templates](https://chatwise.so/docs/api/list-whatsapp-templates.md), [get a WhatsApp template](https://chatwise.so/docs/api/get-whatsapp-template.md), [list webhook endpoints](https://chatwise.so/docs/api/list-webhook-endpoints.md), [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md), [get a webhook endpoint](https://chatwise.so/docs/api/get-webhook-endpoint.md), [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md), [delete a webhook endpoint](https://chatwise.so/docs/api/delete-webhook-endpoint.md), [send a test event](https://chatwise.so/docs/api/test-webhook-endpoint.md), [rotate the signing secret](https://chatwise.so/docs/api/rotate-webhook-secret.md), [list deliveries](https://chatwise.so/docs/api/list-webhook-deliveries.md), [get a delivery](https://chatwise.so/docs/api/get-webhook-delivery.md), [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md), and [list event types](https://chatwise.so/docs/api/list-webhook-event-types.md). ### WhatsApp send failed WhatsApp didn't accept the message. The number is Meta's HTTP status, and after it comes Meta's answer when that was JSON. A 429 can be tried later, after a 5xx check first, and for other statuses fix what the answer names. ```json { "message": "Internal server error: WhatsApp send failed: 400 {\"error\":{\"message\":\"(#132000) Number of parameters does not match the expected number of params\"}}", "errorId": "7b0c7f5e-2f0a-4c55-9a3e-0d8f4c1b2a6d" } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md). ### Internal server error Something failed in Chatwise. The message may have been sent, even if it isn't in the conversation. Quote `errorId` to support. ```json { "message": "Internal server error", "errorId": "7b0c7f5e-2f0a-4c55-9a3e-0d8f4c1b2a6d" } ``` From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md). ### Internal server error Something failed in Chatwise. Repeat the request with the same key and body. ```json { "message": "Internal server error" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ## 502 ### WHATSAPP_LOOKUP_FAILED Repeat the request with the same key and body. ```json { "code": "WHATSAPP_LOOKUP_FAILED", "message": "Could not check the WhatsApp template submission" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ### TEMPLATE_SUBMISSION_UNCONFIRMED Repeat the request with the same key and body. ```json { "code": "TEMPLATE_SUBMISSION_UNCONFIRMED", "message": "The WhatsApp template submission could not be confirmed. Retry using the same Idempotency-Key" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md). ## 503 ### WHATSAPP_RATE_LIMITED Wait, then repeat the request with the same key and body. ```json { "code": "WHATSAPP_RATE_LIMITED", "message": "WhatsApp is rate limiting template submissions. Retry with the same Idempotency-Key" } ``` From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).