# 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 <API key>`. |
| 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).
