githubEditar

webhookWebhooks

Webhooks are a low-effort way to post messages to channels in Discord. They do not require a bot user or authentication to use.

Used to represent a webhook.

Webhook Structure

Field
Type
Description

id

snowflake

The ID of the webhook

type

integer

guild_id?

?snowflake

The guild ID this webhook is for, if any

channel_id

?snowflake

The channel ID this webhook is for, if any

user?

?partial userarrow-up-right object

The user this webhook was created by

name

?string

The default name of the webhook (1-80 characters)

avatar

?string

The default avatar hasharrow-up-right of the webhook

token? 1

string

The secure token of the webhook (returned for INCOMING webhooks)

application_id

?snowflake

The application that created this webhook

source_guild? 2

The guild of the channel that this webhook is following (returned for CHANNEL_FOLLOWER webhooks)

source_channel? 2

The channel that this webhook is following (returned for CHANNEL_FOLLOWER webhooks)

url? 1

string

The URL used for executing the webhook (returned for INCOMING webhooks)

1 For application-owned webhooks, this field is only returned to the application that created the webhook.

2 These fields will not be included if the webhook creator has since lost access to the followed channel's guild.

Webhook Types

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 to post new messages into channels

3

APPLICATION

Application webhooks are webhooks used with interactions

Webhook Channel Structure

Field
Type
Description

id

snowflake

The ID of the channel

name

string

The name of the channel (1-100 characters)

Example Incoming Webhook

Example Channel Follower Webhook

Example Application Webhook

POST/channels/{channel.id}/webhooks

Creates a new webhook. Requires the permission. Returns a webhook object on success. Fires a Webhooks Updatearrow-up-right Gateway event.

JSON Params

Field
Type
Description

name

string

The default name of the webhook (1-80 characters)

avatar?

The default avatar of the webhook

GET/channels/{channel.id}/webhooks

Returns a list of channel webhook objects. Requires the permission.

GET/guilds/{guild.id}/webhooks

Returns a list of guild webhook objects. Requires the permission.

GET/webhooks/{webhook.id}

Returns a webhook object for the given webhook ID. Requires the permission unless the application making the request owns the webhook.

GET/webhooks/{webhook.id}/{webhook.token}

Same as above, except this call does not require authentication.

PATCH/webhooks/{webhook.id}

Modifies a webhook. Requires the permission. Returns the updated webhook object on success. Fires a Webhooks Updatearrow-up-right Gateway event.

JSON Params

Field
Type
Description

name?

string

The default name of the webhook (1-80 characters)

avatar?

The default avatar of the webhook

channel_id?

snowflake

The channel ID this webhook should be moved to

PATCH/webhooks/{webhook.id}/{webhook.token}

Same as above, except this call does not require authentication and does not accept a parameter.

JSON Params

Field
Type
Description

name?

string

The default name of the webhook (1-80 characters)

avatar?

The default avatar of the webhook

DELETE/webhooks/{webhook.id}

Deletes a webhook permanently. Requires the permission. Returns a 204 empty response on success. Fires a Webhooks Updatearrow-up-right Gateway event.

DELETE/webhooks/{webhook.id}/{webhook.token}

Same as above, except this call does not require authentication.

POST/webhooks/{webhook.id}/{webhook.token}

Posts a message to the webhook's channel. Returns a messagearrow-up-right object or 204 empty response, depending on . Fires a Message Createarrow-up-right Gateway event. See message formattingarrow-up-right for more information on how to properly format messages.

Files must be attached using a body (or pre-uploaded to Discord's GCP bucket) as described in Uploading Filesarrow-up-right.

Limitations

  • When executing on a forum channel, one of or must be provided.

  • The maximum request size when sending a message is 100 MiB.

  • For the embed object, you can set every field except (it will be regardless of if you try to set it), , , and any , , or values for images.

Query String Params

Field
Type
Description

wait?

boolean

Waits for confirmation of message send before response, and returns the created message body (default false; when false a message that is not saved does not return an error)

thread_id?

snowflake

Send a message to the specified thread within a webhook's channel; the thread will automatically be unarchived

JSON/Form Params

Field
Type
Description

username?

string

The name to override the default username of the webhook with (1-80 characters)

avatar_url?

string

The avatar URL to override the default avatar of the webhook with

thread_name?

string

The name for the thread to create (requires the webhook channel to be a thread-only channel, 1-100 characters)

applied_tags?

array[snowflake]

The IDs of the tags that are applied to the thread (requires the webhook channel to be a thread-only channel, max 5)

content?

string

The message contents (up to 2000 characters)

tts?

boolean

Whether this is a TTS message

embeds?

array[embedarrow-up-right object]

Embedded rich content (max 6000 characters, max 10)

allowed_mentions?

Allowed mentions for the message

components? 2

The components to include with the message

flags?

integer

The message's flagsarrow-up-right (only SUPPRESS_EMBEDS, SUPPRESS_NOTIFICATIONS, and VOICE_MESSAGE can be set)

files[n]? 1

file contents

Contents of the file being sent (max 10)

payload_json? 1

string

JSON-encoded body of non-file params

attachments? 1

array[partial attachmentarrow-up-right object]

Partial attachment objects with filename and description (max 10)

1 See Uploading Filesarrow-up-right for details.

2 Requires query parameter. Interactions only work with an application-owned webhook.

POST/webhooks/{webhook.id}/{webhook.token}/slack

Refer to Slack's documentationarrow-up-right for more information. We do not support Slack's , , , or properties.

Query String Params

Field
Type
Description
Required

wait?

boolean

Waits for confirmation of message send before response, and returns the created message body (default false; when false a message that is not saved does not return an error)

thread_id?

snowflake

Send a message to the specified thread within a webhook's channel; the thread will automatically be unarchived

POST/webhooks/{webhook.id}/{webhook.token}/github

Add a new webhookarrow-up-right to your GitHub repo (in the repo's settings), and use this endpoint as the "Payload URL". You can choose what events your Discord channel receives by choosing the "Let me select individual events" option and selecting individual events for the new webhook you're configuring. The supported eventsarrow-up-right are , , , , , , , , , , , , , , , , , and .

Query String Params

Field
Type
Description
Required

wait?

boolean

Waits for confirmation of message send before response, and returns the created message body (default false; when false a message that is not saved does not return an error)

thread_id?

snowflake

Send a message to the specified thread within a webhook's channel; the thread will automatically be unarchived

GET/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}

Returns a previously-sent webhook messagearrow-up-right object from the same token.

PATCH/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}

Edits a previously-sent webhook message from the same token. Returns the updated messagearrow-up-right object on success. Fires a Message Updatearrow-up-right Gateway event.

When the field is edited, the array in the message object will be reconstructed from scratch based on the new content. The field of the edit request controls how this happens. If there is no explicit in the edit request, the content will be parsed with default allowances, that is, without regard to whether or not an was present in the request that originally created the message.

Refer to Uploading Filesarrow-up-right for details on attachments and requests. Any provided files will be appended to the message. To remove or replace files you will have to supply the field which specifies the files to retain on the message after edit.

JSON/Form Params

Field
Type
Description

content?

string

The message contents (up to 2000 characters)

tts?

boolean

Whether this is a TTS message

embeds?

array[embedarrow-up-right object]

Embedded rich content (max 6000 characters, max 10)

allowed_mentions?

Allowed mentions for the message

components? 2

The components to include with the message

flags?

integer

The message's flagsarrow-up-right (only SUPPRESS_EMBEDS, SUPPRESS_NOTIFICATIONS, and VOICE_MESSAGE can be set)

files[n]? 1

file contents

Contents of the file being sent (max 10)

payload_json? 1

string

JSON-encoded body of non-file params

attachments? 1

array[partial attachmentarrow-up-right object]

Partial attachment objects with filename and description (max 10)

1 See Uploading Filesarrow-up-right for details.

2 Requires an application-owned webhook.

DELETE/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}

Deletes a message that was created by the webhook. Returns a 204 empty response on success. Fires a Message Deletearrow-up-right Gateway event.