WSAPI icon

WSAPI

Interact with WSAPI WhatsApp API

Overview

This node integrates with the WSAPI WhatsApp API to perform various messaging operations. Specifically, the "Delete Message" operation under the "Message" resource allows users to delete a specific WhatsApp message by providing its unique message ID and the target contact or group ID.

Common scenarios for this node include:

  • Automatically removing sent messages that contain errors or sensitive information.
  • Managing message history by deleting outdated or irrelevant messages.
  • Implementing moderation tools in group chats by deleting inappropriate content.

For example, after sending a message via another operation, you can use this node to delete that message if certain conditions are met (e.g., user request or automated cleanup).

Properties

Name Meaning
To The WhatsApp contact ID or group ID where the message exists. For contacts, it is the phone number followed by @s.whatsapp.net (e.g., 1234567890@s.whatsapp.net). For groups, it is the group ID followed by @g.us.
Message ID The unique identifier of the WhatsApp message to delete. This ID can be obtained from previous WhatsApp operations or webhook events. Example: BAE5F2C9A4B1E3D2F7G8H9I0.

Output

The node outputs JSON data representing the result of the delete operation. Typically, this will confirm whether the deletion was successful or provide error details if it failed.

If the operation returns binary data (not typical for delete), it would represent associated media or files, but for deleting messages, output is expected to be purely JSON indicating status.

Dependencies

  • Requires an active connection to the WSAPI WhatsApp API.
  • Needs an API key credential configured in n8n to authenticate requests.
  • The base URL for the API must be set in the credentials configuration.

Troubleshooting

  • Common issues:

    • Invalid or missing "To" property format (must include country code and correct suffix).
    • Incorrect or expired message ID leading to failure in locating the message.
    • Insufficient permissions or invalid API credentials causing authorization errors.
    • Network connectivity problems preventing communication with the WSAPI endpoint.
  • Error messages:

    • "The resource "message" is not known!": Indicates the resource parameter is incorrect or unsupported.
    • "The operation "deleteMessage" is not implemented yet!": Suggests the operation name might be misspelled or not available.
    • API errors returned from WSAPI will typically include HTTP status codes and descriptive messages; ensure credentials and parameters are correct.
  • Resolution tips:

    • Verify the "To" field format matches WhatsApp's required pattern.
    • Confirm the message ID is accurate and corresponds to an existing message.
    • Check API credentials and refresh tokens if necessary.
    • Enable "Continue On Fail" in the node settings to handle errors gracefully during batch processing.

Links and References

Discussion