Webhook object
Used to represent a webhook.Webhook structure
The id of the webhook.
The guild id this webhook is for, if any.
The channel id this webhook is for, if any.
The user this webhook was created by. Not returned when getting a webhook with its token.
The default name of the webhook.
The secure token of the webhook. Returned for Incoming Webhooks only.
The bot/OAuth2 application that created this webhook.
The guild of the channel that this webhook is following. Returned for Channel Follower Webhooks. Absent if the webhook creator has since lost access to the guild where the followed channel resides.
The channel that this webhook is following. Returned for Channel Follower Webhooks. Absent if the webhook creator has since lost access to the guild where the followed channel resides.
Webhook types
These types don’t include webhook events, which are outgoing webhooks sent to your app by Discord. See Webhook Events for details.
| Value | Name | Description |
|---|---|---|
1 | Incoming | Incoming Webhooks can post messages to channels with a generated token |
2 | Channel Follower | Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels |
3 | Application | Application webhooks are webhooks used with Interactions |
Example incoming webhook
Example channel follower webhook
Example application webhook
Create webhook
POST
/channels/{channel.id}/webhooksMANAGE_WEBHOOKS permission. Fires a Webhooks Update Gateway event.
A webhook name is valid if:
- It does not contain the substrings
clydeordiscord(case-insensitive) - It follows the nickname guidelines in the Usernames and Nicknames documentation, with an exception that webhook names can be up to 80 characters
This endpoint supports the
X-Audit-Log-Reason header.JSON params
Name of the webhook (1–80 characters).
Image for the default webhook avatar. See image data.
Get channel webhooks
GET
/channels/{channel.id}/webhooksMANAGE_WEBHOOKS permission.
Get guild webhooks
GET
/guilds/{guild.id}/webhooksMANAGE_WEBHOOKS permission.
Get webhook
GET
/webhooks/{webhook.id}This request requires the
MANAGE_WEBHOOKS permission unless the application making the request owns the webhook.Get webhook with token
GET
/webhooks/{webhook.id}/{webhook.token}Modify webhook
PATCH
/webhooks/{webhook.id}MANAGE_WEBHOOKS permission. Returns the updated webhook object on success. Fires a Webhooks Update Gateway event.
All parameters to this endpoint are optional.
This endpoint supports the
X-Audit-Log-Reason header.JSON params
The default name of the webhook.
Image for the default webhook avatar. See image data.
The new channel id this webhook should be moved to.
Modify webhook with token
PATCH
/webhooks/{webhook.id}/{webhook.token}channel_id parameter in the body, and does not return a user in the webhook object.
Delete webhook
DELETE
/webhooks/{webhook.id}MANAGE_WEBHOOKS permission. Returns a 204 No Content response on success. Fires a Webhooks Update Gateway event.
This endpoint supports the
X-Audit-Log-Reason header.Delete webhook with token
DELETE
/webhooks/{webhook.id}/{webhook.token}Execute webhook
POST
/webhooks/{webhook.id}/{webhook.token}multipart/form-data requests. Returns a message or 204 No Content depending on the wait query parameter.
When sending a message, you must provide a value for at least one of
content, embeds, components, file, or poll.If the webhook channel is a forum or media channel, you must provide either
thread_id in the query string params or thread_name in the JSON/form params. If thread_id is provided, the message will send in that thread. If thread_name is provided, a thread with that name will be created in the channel.Query string params
Waits for server confirmation of message send before responding. When
false, a message that is not saved does not return an error.Send a message to the specified thread within a webhook’s channel. The thread will automatically be unarchived.
Whether to respect the
components field of the request. When enabled, allows application-owned webhooks to use all components and non-owned webhooks to use non-interactive components.JSON/form params
The message contents (up to 2000 characters). Required if
file, embeds, and poll are not provided.Override the default username of the webhook.
Override the default avatar of the webhook.
true if this is a TTS message.Embedded
rich content (up to 10 embeds). Required if content, file, and poll are not provided.Allowed mentions for the message.
The components to include with the message. Application-owned webhooks can always send components. Non-application-owned webhooks cannot send interactive components unless
with_components is set.The contents of the file being sent. Required if
content, embeds, and poll are not provided. See Uploading Files for details.JSON encoded body of non-file params. Only for
multipart/form-data requests.Attachment objects with filename and description. See Uploading Files for details.
Message flags combined as a bitfield. Only
SUPPRESS_EMBEDS, SUPPRESS_NOTIFICATIONS, and IS_COMPONENTS_V2 can be set. When IS_COMPONENTS_V2 is set, the webhook message can only contain components — providing content, embeds, files[n], or poll will fail with a 400 BAD REQUEST.Name of thread to create. Requires the webhook channel to be a forum or media channel.
Array of tag ids to apply to the thread. Requires the webhook channel to be a forum or media channel.
A poll. Required if
content, file, and embeds are not provided. See poll create request object.For webhook embed objects, you can set every field except
type (it will be rich regardless), provider, video, and any height, width, or proxy_url values for images.Execute Slack-compatible webhook
POST
/webhooks/{webhook.id}/{webhook.token}/slackchannel, icon_emoji, mrkdwn, or mrkdwn_in properties.
Query string params
Id of the thread to send the message in.
Waits for server confirmation of message send before responding. When
false, a message that is not saved does not return an error.Execute GitHub-compatible webhook
POST
/webhooks/{webhook.id}/{webhook.token}/githubcommit_comment, create, delete, fork, issue_comment, issues, member, public, pull_request, pull_request_review, pull_request_review_comment, push, release, watch, check_run, check_suite, discussion, and discussion_comment.
Query string params
Id of the thread to send the message in.
Waits for server confirmation of message send before responding. When
false, a message that is not saved does not return an error.Get webhook message
GET
/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}Query string params
Id of the thread the message is in.
Edit webhook message
PATCH
/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}content field is edited, the mentions, mention_roles, and mention_everyone fields in the message object will be reconstructed from scratch based on the new content. The allowed_mentions field of the edit request controls how this happens. If there is no explicit allowed_mentions in the edit request, the content will be parsed with default allowances, without regard to whether or not an allowed_mentions was present in the original request.
Any provided files will be appended to the message. To remove or replace files you will need to supply the attachments field, which specifies the files to retain on the message after edit.
All parameters to this endpoint are optional and nullable.
Query string params
Id of the thread the message is in.
Whether to respect the
components field of the request. When enabled, allows application-owned webhooks to use all components and non-owned webhooks to use non-interactive components.JSON/form params
The message contents (up to 2000 characters).
Embedded
rich content (up to 10 embeds).Message flags combined as a bitfield. Only
SUPPRESS_EMBEDS and IS_COMPONENTS_V2 can be set. SUPPRESS_EMBEDS can be both set and unset, while IS_COMPONENTS_V2 can only be set. When IS_COMPONENTS_V2 is set, any content, embeds, files[n], or poll values in the initial message must be set to null first, otherwise it will fail with a 400 BAD REQUEST.Allowed mentions for the message.
The components to include with the message. Application-owned webhooks can always send components. Non-application-owned webhooks cannot send interactive components unless
with_components is set.The contents of the file being sent/edited. See Uploading Files for details.
JSON encoded body of non-file params. Only for
multipart/form-data requests.Attached files to keep and possible descriptions for new files. See Uploading Files for details.
A poll. Polls can only be added when editing a deferred interaction response.
Delete webhook message
DELETE
/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}204 No Content response on success.
Query string params
Id of the thread the message is in.