Actions29
- Chat Actions
- Group Actions
- Instance Actions
- Message Actions
- Webhook Actions
Overview
The node provides an operation to delete a specific WhatsApp message from a chat. This is useful when you want to remove messages that your WhatsApp instance has sent, for example, to correct mistakes, retract sensitive information, or manage chat history programmatically.
A practical scenario includes automating message cleanup in customer support chats or removing outdated notifications sent by your system.
Properties
| Name | Meaning |
|---|---|
| To (Contact) | The WhatsApp contact identifier where the message should be deleted. It must be in the format phone_number@s.whatsapp.net (e.g., 551199999999@s.whatsapp.net). |
| Key (JSON) | A JSON object representing the message key used to identify the message to delete. It contains fields such as remoteJid (the chat ID), fromMe (must be true, indicating the message was sent by your instance), and id (the message ID). |
| Information | Notice explaining that only messages sent by your instance (fromMe: true) can be deleted, and that the message key is typically obtained from webhook events. |
Output
The output of this operation is a JSON object indicating the result of the delete message request. It typically confirms whether the deletion was successful or returns an error message if it failed.
No binary data is produced by this operation.
Dependencies
- Requires an active connection to the MegaAPI WhatsApp service.
- Needs valid API credentials (an API key/token and host URL) configured in n8n to authenticate requests.
- The message key object must be correctly formed and usually comes from webhook event data.
Troubleshooting
Common Issues:
- Attempting to delete messages not sent by your instance (
fromMemust be true) will fail. - Incorrectly formatted contact identifiers or message keys will cause errors.
- Network or authentication issues with the MegaAPI service may prevent successful deletion.
- Attempting to delete messages not sent by your instance (
Error Messages:
"Unknown chat operation: deleteMessage": Indicates the operation name might be misspelled or unsupported.- Errors related to invalid message keys or permissions typically mean the message cannot be found or you do not have rights to delete it.
Resolutions:
- Ensure the
fromMefield in the message key is set totrue. - Verify the contact string format matches
phone_number@s.whatsapp.net. - Confirm API credentials are valid and the MegaAPI service is reachable.
- Obtain the message key from webhook events triggered by messages your instance sends.
- Ensure the