You need to edit or delete a message sent by a Discord webhook, but the normal edit and delete buttons are missing. Discord webhooks are automated bots that post messages to channels, and they do not appear in the chat history like regular user messages. This article explains the exact methods to edit and delete webhook messages using the Discord API and cURL commands. You will learn how to find the required IDs and execute the correct HTTP requests.
Key Takeaways: Editing and Deleting Discord Webhook Messages
- Discord API PATCH /webhooks/{webhook.id}/{webhook.token}/messages/{message.id}: Edits the content, embeds, or components of a webhook message.
- Discord API DELETE /webhooks/{webhook.id}/{webhook.token}/messages/{message.id}: Permanently removes a webhook message from the channel.
- Developer Mode in User Settings > Advanced: Enables right-click copy of User ID, Channel ID, and Message ID for API calls.
How Discord Webhook Messages Work
A Discord webhook is a simple way to send automated messages to a text channel. When you create a webhook in Server Settings > Integrations, Discord generates a unique URL that includes a webhook ID and a webhook token. Any application can send an HTTP POST request to that URL to post a message. The message appears as a bot user with the webhook’s name and avatar.
Webhook messages are not tied to a real Discord user account. The Discord client does not show the standard edit or delete buttons on these messages because the webhook is not a logged-in user. To edit or delete a webhook message, you must use the Discord API directly with the correct HTTP methods and IDs.
The API requires the webhook ID, webhook token, and message ID. The webhook ID and token are part of the webhook URL. The message ID is the unique identifier of the webhook message in the channel. You can obtain these IDs by enabling Developer Mode in Discord.
Prerequisites for Editing or Deleting a Webhook Message
Before you can edit or delete a webhook message, you need three pieces of information:
- Webhook ID and Token: Found in the webhook URL. The URL format is
https://discord.com/api/webhooks/{webhook.id}/{webhook.token}. You can also find these in Server Settings > Integrations > Webhooks by clicking the webhook name and then revealing the token. - Message ID: The unique identifier of the specific webhook message. Enable Developer Mode in User Settings > Advanced > Developer Mode. Then right-click the webhook message and select Copy Message ID.
- A tool to send HTTP requests: This guide uses cURL, which is built into Windows 10 and Windows 11. You can also use Postman or any programming language that supports HTTP requests.
Steps to Edit a Discord Webhook Message
- Enable Developer Mode in Discord
Open Discord. Go to User Settings by clicking the gear icon next to your username. Select Advanced from the left sidebar. Toggle Developer Mode to On. This allows you to copy IDs by right-clicking messages, channels, and users. - Copy the Webhook Message ID
Navigate to the channel where the webhook message is posted. Right-click the webhook message. From the context menu, select Copy Message ID. Store this ID in a text file for later use. - Get the Webhook ID and Token
Go to your server. Click the server name at the top-left. Select Server Settings > Integrations. Find the webhook that sent the message. Click on the webhook name. The webhook ID is the long number in the URL after/webhooks/. Click Reveal Token to see the webhook token. Copy both the ID and token. - Open Command Prompt or Terminal
Press the Windows key, type cmd, and press Enter. Alternatively, you can use PowerShell or any terminal that supports cURL. - Run the cURL Command to Edit the Message
Type the following command, replacing the placeholders with your actual values. This command sends a PATCH request to the Discord API.curl -X PATCH https://discord.com/api/webhooks/WEBHOOK_ID/WEBHOOK_TOKEN/messages/MESSAGE_ID -H "Content-Type: application/json" -d "{\"content\": \"This is the edited webhook message.\"}"
Replace WEBHOOK_ID, WEBHOOK_TOKEN, and MESSAGE_ID with the values you copied. The content field contains the new text for the message. Press Enter to execute the command. - Verify the Edit
Return to your Discord channel. The webhook message should now display the new content. If you see an error, double-check that all IDs are correct and that the webhook token has not been regenerated.
Steps to Delete a Discord Webhook Message
- Enable Developer Mode and Copy IDs
Follow steps 1 through 3 from the edit section to enable Developer Mode and copy the webhook ID, webhook token, and message ID. - Open Command Prompt or Terminal
Press the Windows key, type cmd, and press Enter. - Run the cURL Command to Delete the Message
Type the following command, replacing the placeholders with your actual values. This command sends a DELETE request to the Discord API.curl -X DELETE https://discord.com/api/webhooks/WEBHOOK_ID/WEBHOOK_TOKEN/messages/MESSAGE_ID
Replace WEBHOOK_ID, WEBHOOK_TOKEN, and MESSAGE_ID with the values you copied. Press Enter to execute the command. - Verify the Deletion
Return to your Discord channel. The webhook message should be gone. Discord does not send a confirmation; the message simply disappears. If you get a 404 error, the message ID may be incorrect or the message was already deleted.
Common Errors and Issues When Editing or Deleting Webhook Messages
“404 Not Found” Error
This error means the API cannot find the webhook or message. Check that the webhook ID, webhook token, and message ID are all correct. The webhook token is case-sensitive. Also confirm the message was sent by the same webhook. You cannot edit or delete messages sent by a different webhook or a regular user.
“403 Forbidden” Error
This error means the webhook does not have permission to edit or delete the message. Ensure the webhook has the correct permissions in the server. The webhook must have the Manage Webhooks permission or be the owner of the webhook. Only the webhook that created the message can edit or delete it.
Webhook Token Changed
If you regenerate the webhook token in Server Settings, the old token becomes invalid. You must use the new token in your API calls. Copy the new token from the webhook settings page before running cURL commands.
Message Too Old
Discord does not impose a time limit on editing or deleting webhook messages. However, if the webhook was deleted from the server, you cannot edit or delete its messages. The webhook must still exist in the server’s integrations.
Discord Webhook API Methods: Edit vs Delete
| Item | Edit (PATCH) | Delete (DELETE) |
|---|---|---|
| HTTP Method | PATCH | DELETE |
| API Endpoint | /webhooks/{webhook.id}/{webhook.token}/messages/{message.id} | /webhooks/{webhook.id}/{webhook.token}/messages/{message.id} |
| Request Body | JSON with fields like content, embeds, components | No request body needed |
| Result | Message content is updated in the channel | Message is permanently removed from the channel |
| Permissions Required | Webhook must own the message and have Manage Webhooks permission | Webhook must own the message and have Manage Webhooks permission |
Editing and deleting Discord webhook messages requires using the Discord API with the correct IDs and HTTP methods. Enable Developer Mode in User Settings to copy message IDs easily. Use cURL or any HTTP client to send PATCH requests for edits and DELETE requests for removals. Always verify that the webhook token is current and the webhook still exists in the server. If you need to update multiple webhook messages, consider writing a script that loops through message IDs and applies the same edit.