> ## Documentation Index
> Fetch the complete documentation index at: https://docs.magne.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks Overview

> Send messages to Magne channels from external services using webhooks.

# Webhooks

Webhooks allow external services to send messages to Magne channels without a bot account.

## How It Works

1. **Create a webhook** on a channel (requires `MANAGE_WEBHOOKS` permission)
2. Receive a **webhook URL** with an embedded token: `/v1/webhooks/:id/:token`
3. **POST messages** to the URL — no authentication header needed

## Creating a Webhook

```bash theme={null}
POST /v1/servers/:server_id/webhooks
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "channelId": "channel-uuid",
  "name": "GitHub Notifications",
  "avatarUrl": "https://example.com/github-avatar.png"
}
```

The response includes a one-time `token` field. **Store it securely** — it won't be shown again.

## Executing a Webhook

```bash theme={null}
POST /v1/webhooks/:webhook_id/:token
Content-Type: application/json

{
  "content": "New commit pushed to main branch"
}
```

* No `Authorization` header required — the token in the URL is the credential
* Content must be 1–4,000 characters
* Messages appear in the channel with the webhook's name and avatar
* Rate limited to **30 requests per 60 seconds** per webhook

## Management

| Endpoint                   | Method   | Description                    |
| -------------------------- | -------- | ------------------------------ |
| `/v1/servers/:id/webhooks` | `GET`    | List all webhooks for a server |
| `/v1/servers/:id/webhooks` | `POST`   | Create a new webhook           |
| `/v1/webhooks/:id`         | `GET`    | Get webhook details            |
| `/v1/webhooks/:id`         | `DELETE` | Delete a webhook               |
| `/v1/webhooks/:id/:token`  | `POST`   | Execute (send message)         |
