Skip to main content
A Webhook is a way to post messages in a channel under any name. You get one from channel.createWebhook(), channel.fetchWebhooks() or guild.fetchWebhooks().
What a message can hold is in Messages; what send() takes here is WebhookMessageOptions.
The token of a webhook lets anyone post with it. It never appears when you log a webhook or call toJSON(), and the bot never gives it to your code.

Properties

Snowflake
The unique id Discord gave it.
Date
When it was created: a Discord id contains its creation date.
string | null
The default name the webhook posts with.
Snowflake | null
The id of the channel the webhook posts in.
Snowflake | null
The id of the server of the webhook.
boolean
Whether the bot can post with it: only webhooks it created.

Helpers

These read what the bot remembers: they never send a request.

toJSON()

The data of the webhook, without its token: a token is a secret.

Actions

send()

Posts a message with the webhook. A text alone is its content; see WebhookMessageOptions for the rest. Only the bot that created a webhook can post with it (canSend). Otherwise send() throws:
Discord documentation

edit()

Changes the name, the avatar or the channel of the webhook. See webhook edit options. Discord documentation

delete()

Deletes the webhook. Discord documentation

Types

Webhook edit options

What edit() takes. Every field can be left out: only what you pass changes.
string
The default name of the webhook.
string | null
The image of the default avatar of the webhook, as a data URI (data:image/png;base64,...); null removes it.
Snowflake
The id of the channel to move the webhook to.
Discord documentation WebhookMessageOptions is in Message options.