Delete a message
Delete a specific message by its ID.
Authentication Required
Login to swap the placeholders with your real Instance ID and Access Token.
Log InNo query parameters required
This endpoint doesn't expect data in the URL.
Best practices
Store the message timestamp locally to check if 'Delete for Everyone' is still feasible.
Use deletion to maintain group safety by removing spam or inappropriate content automatically.
Always handle the 'message.revoked' webhook to keep your external CRM in sync with deletions.
Controlled Erasure: Mastering the Message Deletion Lifecycle
In a professional messaging ecosystem, the ability to remove content is just as important as the ability to send it. The /v2/messages/delete endpoint provides a programmatic way to invoke WhatsApp's deletion protocols. However, deletion is not a simple "remove" command; it is a complex negotiation between your instance, the WhatsApp network, and the recipient's device states.
🏗️ Technical Logic: "Delete for Everyone" vs. "Delete for Me"
WhatsApp distinguishes between local and network-wide deletion. Wawp attempts to execute the most effective deletion based on the context:
- Delete for Everyone (Network-Wide):
- The Signature: The original message is replaced by a system placeholder: "This message was deleted".
- The Handshake: Your instance sends a "Revocation" packet. The WhatsApp server then broadcasts this to all active recipients.
- Constraint: This only works if the message was sent by your instance and is within the ~48-hour window.
- Delete for Me (Local Cleanup):
- If the time limit has passed, or if you are deleting a message sent by someone else (and you are not a group admin), the deletion is local. The message disappears from your Wawp instance and linked devices, but remains visible to the sender and other recipients.
🚀 Strategic Use Cases for Deletion
1. Compliance and Data Privacy (GDPR)
If a customer exercises their "Right to Erasure," you must remove their messages.
- Workflow: Identify all
messageIdstrings associated with the customer's JID in your local database and iterate through them using this endpoint to ensure they are removed from the Wawp engine's storage.
2. Correcting Bot Hallucinations
If an AI bot sends incorrect information (e.g., a wrong price or private data):
- Immediate Action: Call the delete endpoint for that
messageIdwithin seconds. Even if the user saw the notification, removing the content prevents it from being archived or used as a reference point later.
3. Group Moderation
As a Group Admin, your Wawp instance has the power to "Delete for Everyone" regardless of who sent the message.
- Implementation: Build a "Profanity Filter." When a webhook detects a message with blacklisted words, automatically trigger a deletion to keep the group professional and safe.
🛡️ Best Practices for Effective Cleanup
- The 48-Hour Threshold: Always log the
timestampof outgoing messages. Do not attempt a "Delete for Everyone" UI action if the message is older than 48 hours, as the API will likely fallback to a local delete, which might confuse your agents. - Handle "Ghost" Messages: Occasionally, a deletion packet might reach a recipient's phone while it's offline. When they reconnect, the message might briefly appear before being deleted. This is a network-level behavior; your system should handle the
message.revokedwebhook to update your local CRM UI. - Media Persistence: Deleting a message that contained media typically removes the pointer to that media. However, if the recipient has "Auto-Download to Gallery" enabled on their phone, the file may still exist in their physical phone storage even after being "deleted for everyone."
🧩 Advanced Use Case: The "Secret" Handover
In high-security support scenarios, you might need to send a temporary credential or link.
- Logic: Send the message, wait for the
message.ack(blue tick), and then automatically call the delete endpoint after 60 seconds. This ensures the data is only available during the active interaction window.
⚠️ Important Considerations
- Admin Requirements: You MUST be an admin to delete messages sent by others in a group. Use
/v2/groups/participantsto verify your status. - Linked Devices Sync: Deletions are high-priority sync events. They will propagate to your WhatsApp Web and Mobile instances almost instantly.
- No "Undo": Once a message is deleted for everyone, there is no "undelete" action. Always implement a "Confirm Deletion" step in your human-agent UI.
Summary of Capabilities:
- Programmatic "Delete for Everyone" (within the WhatsApp time window).
- Local "Delete for Me" for history management and hygiene.
- Administrative deletion of participant messages in group chats.
- Full integration with Webhooks to track revocation status.
Request Parameters
Configure the parameters required to interact with this endpoint. All query and body arguments are listed below with their details.
Request Body
Sent as a JSON objectstring | WhatsApp Instance ID Example: | ||
string | API Access Token Example: | ||
string | Target Chat ID (phone@c.us or group@g.us) Example: | ||
string | Unique ID of the message Example: |
Request Samples
Use these ready-to-go code snippets to integrate our API into your project quickly and efficiently. Choose your preferred language and library.
Expected Responses
Explore all possible responses and outcomes from the server. We have documented each status code with data examples to make success and error handling easier.
Example
{
"success": true,
"message": "Operation completed successfully"
}Command Palette
Search for a command to run...