Skip to content
Webhooks & Integrations webhookDelete

$webhookDelete

The $webhookDelete function allows you to delete an existing Discord webhook using its ID and token.

Syntax

bdfd
$webhookDelete[webhookID;webhookToken]

Syntax

$webhookDelete[webhookID;webhookToken]

Parameters

Parameter Description
webhookID The ID of the webhook (first part of the URL after /webhooks/).
webhookToken The token of the webhook (second part after the ID).

Return Value

This function does not return a value. The deletion is performed silently.

Behavior

  • The bot must have the MANAGE_WEBHOOKS permission or be the creator of the webhook.
  • Once deleted, the webhook can no longer be used.
  • Remaining URLs pointing to this webhook will become invalid.

Examples

Deletion of a webhook

$var[hookID;123456789]
$var[hookToken;abcdefghijklmnop]
$webhookDelete[$var[hookID];$var[hookToken]]
$sendMessage[Webhook deleted.]

Extraction from a stored URL

$var[url;$getUserVar[tempHook]]
$var[parts;$splitText[$var[url];/]]
$var[hookID;$getTextSplitIndex[$var[parts];5]]
$var[hookToken;$getTextSplitIndex[$var[parts];6]]
$webhookDelete[$var[hookID];$var[hookToken]]
$sendMessage[Webhook cleaned up.]

Notes

  • Webhooks created via the Discord interface can only be deleted by an administrator.
  • Webhooks created by the bot can be deleted by it.
  • Delete temporary webhooks after use to avoid accumulation.