Message Revoked
Triggered when a user deletes a message for everyone.
Best practices
Update your UI to show 'This message was deleted' on the corresponding message ID.
In groups, check the sender ID to know who revoked the message.
The Erasure Event: Mastering Message Revocations (Delete for Everyone)
In the dynamic landscape of real-time messaging, data is not always permanent. The "Delete for Everyone" feature—technically known as a Revocation—allows users to retract a message after it has been sent. Within the Wawp platform, the [message.revoked] webhook provides your infrastructure with the immediate notification that a specific interaction has been invalidated by the sender.
Handling revocations is not just a technical requirement for database synchronization; it is a fundamental pillar of Conversational Integrity and Privacy Compliance. This guide provides an architectural deep-dive into the strategic management of revoked content, moving beyond "Simple Deletion" into the realm of State Governance and User Trust.
🏗️ Architectural Philosophy: The Volatile Nature of Text
To master the Revocation API, one must first recognize the philosophical shift from "Archive-First" to "User-First" data priority. A revocation is a user's explicit command to purge a specific data point from the shared conversational record.
1. The ID Mapping Strategy
The [message.revoked] payload does not contain the original message text; it contains the unique Message ID of the item being removed and the JID of the person who revoked it.
- Individuals (@c.us): In 1-on-1 chats, only the sender or the receiver (on their own side) can revoke.
- Groups (@g.us): In a group environment, the [
revokedBy] field is critical. It identifies if the original sender deleted their own message or if a group administrator used their elevated privileges to remove a participant's message for the entire group.
2. The Relationship Between Event and Entity
Your architecture must maintain a robust index of Message IDs. When a revocation arrives, your system must perform a "Reverse Lookup" to find the corresponding record in your CRM or database. The speed and accuracy of this lookup define the "Sync Quality" of your integration. An enterprise-grade system ensures that the revoked content "Vanishes" from the agent's view within milliseconds of the event firing.
🚀 Strategic Use Cases: Powering Clean Conversational States
Webhooks for revocation ensure your internal systems remain in perfect harmony with the customer's actual experience.
1. Maintaining the "Service Truth" (Anti-Ghosting)
There is nothing more unprofessional than a human agent or an AI bot responding to a message that the user has already deleted.
The Strategic Workflow: When a message arrives, your system starts its processing logic. If the [message.revoked] webhook arrives before the bot's response is sent, the system should instantly abort the response generation. This prevents "Ghost Interactions" where your bot appears to be "Hearing voices"—responding to a question that is no longer there.
2. Professional Moderation in High-Volume Groups
In community management, administrators often need to remove offensive or off-topic content. By listening to the revocation webhook, your central community dashboard can update its state in real-time. If an admin deletes a message on their phone, the central control panel should immediately hide that message for all human moderators, ensuring the "Moderation State" is synchronized across the entire organization.
3. Compliance and the "Right to be Forgotten"
In many jurisdictions (such as GDPR in Europe), a user's request to delete data is a legal mandate. While Wawp purges its own temporary caches, your internal database must also respect this signal.
The Policy Engine: Configure your system to treat a [message.revoked] event as an Authorized Deletion Request. Instead of just hiding the message in the UI, your system should logically "Scrub" the original body content from your database, replacing it with a metadata flag: [Content Revoked by User]. This ensures you remain compliant with privacy laws while maintaining a valid audit trail of the conversation's structure.
🛡️ Administrative Mandate: Scaling the Erase Pipeline
Scaling revocations requires a focus on "Transaction Atomicity."
1. Handling the "Revoke Before Receipt" Edge Case
In rare high-latency scenarios, your server might receive the [message.revoked] event before the original [message] event (due to different routing paths in a microservice architecture).
The Strategic Solution: Use a "Negative Cache" or an "Out-of-Order Buffer". If you receive a revocation for an ID you don't recognize, store that ID in a temporary "Pending Revocation" list for 60 seconds. If the original message arrives within that window, it should be discarded immediately upon ingestion.
2. The "Audit Trail" vs. "Privacy" Balance
For sensitive financial or support interactions, you may need a record that a message did exist (for auditing) without keeping the content of that message (for privacy). The Balance: Store the metadata (timestamp, sender JID, message ID) but delete the body, media URLs, and attachments associated with the revoked ID. This provides a "Skeleton History" that allows you to prove an interaction occurred without violating the user's intent to retract their specific words.
🛡️ Operational Best Practices: Optimizing the User Experience
- UI Visual Cues: In your custom agent dashboard, don't just delete the row. Replace it with a faded "Message deleted" placeholder. This provides the agent with context: "The customer said something but changed their mind." This awareness allows the agent to adjust their tone accordingly.
- Aborting Media Downloads: If a revocation fires for a media message (image/video) that your system is currently downloading, stop the download process immediately. This saves bandwidth and ensures that sensitive visuals are not stored on your servers.
- Admin Revocation Alerts: In group management contexts, if an admin (
@c.us) revokes a message in a group (@g.us), your system can tag this event as a "Moderator Action." This data can be used to generate "Moderation Reports," helping you identify which admins are most active in keeping the community clean.
⚙️ Engineering Best Practices: The Validation Loop
- Iterative Indexing: Ensure your Message ID index is optimized for high-speed "Delete" operations. Using a B-Tree or Hash index on the ID field is mandatory for maintaining performance as your database grows.
- Verify Revoker Authority: In groups, verify the [
revokedBy] JID. If your system relies on specific "Trust Levels," you should confirm that the revoker has the necessary permission to delete the target message. - Cross-Instance Siloing: Just like the message webhook, ensure revocation logic is scoped to the specific [
session]. Never allow a revocation from Instance A to accidentally trigger a lookup in the database for Instance B.
🎯 Conclusion: The Power of the Retraction Signal
The Message Revoked Webhook is the "Eraser" of your digital brand. By building an architecture that respects these signals, you move your organization from "Static Archiving" to Respectful, Real-Time Synchronization. You build systems that understand the fluidity of human conversation, respect user privacy, and maintain a high-fidelity "Single Source of Truth." In the world of Wawp, a revocation is not an error; it is a vital conversational signal that ensures your integration remains as human, as private, and as accurate as WhatsApp itself.
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
{
"id": "evt_01...",
"timestamp": 1634567890123,
"session": "default",
"metadata": {
"user.id": "123",
"user.email": "email@example.com"
},
"engine": "WEBJS",
"event": "message.revoked",
"payload": {
"id": "false_11111111111@c.us_...",
"revokedBy": "11111111111@c.us"
},
"me": {
"id": "11111111111@c.us",
"lid": "123@lid",
"pushName": "Instance"
}
}Command Palette
Search for a command to run...