webhook_create
Create an inbound webhook for a channel. An outside service, such as a CI system, can then post messages to that channel over HTTP without an account.
Request
Section titled “Request”{ "cmd": "webhook_create", "channel": "general", "name": "Build reports"}| Field | Type | Required | Description |
|---|---|---|---|
channel |
string | Yes | Name of a text or voice channel. |
name |
string | Yes | Display name for messages the webhook posts. Surrounding spaces are trimmed; it can’t be blank. |
Response
Section titled “Response”{ "cmd": "webhook_create", "webhook": { "id": "3f2b8c1e-5d4a-4b7e-9c61-2a8f0e7d9b34", "channel": "general", "name": "Build reports", "token": "8c9e2f4a-7b1d-4e3c-a5f6-0d2b9e8c1a47f3a9c2e1b0d4f5a6", "created_by": "<alice's user ID>", "created_at": 1758700000.123, "avatar": null }}| Field | Description |
|---|---|
id |
Webhook ID. Use it with the other webhook commands. |
channel |
The channel it posts to. |
name |
Default display name for its messages. |
token |
The secret that authorizes posting. |
created_by |
User ID of the account that created it. |
created_at |
Creation time in Unix seconds. May include a fraction. |
avatar |
Default avatar URL, or null. Set it with webhook_update. |
Nobody else receives a broadcast. The creation is recorded in the audit log.
To post, send JSON to /webhooks?token=<token>. See webhook delivery.
Permissions
Section titled “Permissions”Requires manage_server. It is blocked while you are timed out.
Errors
Section titled “Errors”val |
When |
|---|---|
Channel not found |
No channel has that name. |
Webhooks can only be created for text or voice channels |
The channel is another type, such as a forum. |
Failed to create webhook '<name>' in channel '<channel>' |
The server couldn’t save webhooks.json. |
| Validation message | channel or name is missing or blank, for example name: Expected length at least 1. |
