WSAPI icon

WSAPI

Interact with WSAPI WhatsApp API

Overview

The node integrates with the WSAPI WhatsApp API to manage WhatsApp chats programmatically. Specifically, the Set Ephemeral operation allows users to configure an automatic message deletion timer for a given chat. This means messages in that chat will be automatically deleted after a specified duration, enhancing privacy and reducing chat clutter.

Common scenarios where this node is beneficial include:

  • Automatically clearing sensitive conversations after a set time.
  • Managing group chats where ephemeral messaging is desired.
  • Implementing compliance with data retention policies by auto-deleting messages.

For example, a user can set a 24-hour expiration on messages in a group chat so that all messages disappear one day after being sent.

Properties

Name Meaning
Chat ID The unique identifier of the WhatsApp chat. For individual contacts, it is the phone number plus @s.whatsapp.net. For groups, it is the group ID plus @g.us. Example: 1234567890@s.whatsapp.net or 120363123456789@g.us.
Ephemeral Expiration (Seconds) Sets the automatic message deletion timer for the chat. Options are:
- Off (0 seconds): Messages never disappear automatically.
- 24 Hours (86400 seconds)
- 7 Days (604800 seconds)
- 90 Days (7776000 seconds)

Output

The node outputs JSON data representing the result of setting the ephemeral timer on the specified chat. The exact structure depends on the WSAPI response but typically includes confirmation of the update or details about the chat's new ephemeral settings.

If the operation involves binary data (not typical for this operation), it would represent media or files related to the chat, but for "Set Ephemeral," output is purely JSON.

Dependencies

  • Requires connection to the WSAPI WhatsApp API endpoint.
  • Needs an API key credential configured in n8n to authenticate requests.
  • The base URL for the WSAPI must be set in the credentials.
  • No additional external dependencies beyond the WSAPI service.

Troubleshooting

  • Invalid Chat ID: If the chat ID format is incorrect (e.g., missing @s.whatsapp.net or @g.us), the API may reject the request. Ensure the chat ID matches the expected format.
  • Permission Errors: If the API key lacks permissions to modify chat settings, the operation will fail. Verify API credentials have appropriate scopes.
  • Unsupported Expiration Value: Selecting an unsupported expiration value might cause errors. Use only the provided options.
  • Network Issues: Connectivity problems to the WSAPI endpoint will cause failures. Check network access and base URL configuration.
  • Operation Not Implemented: If the node throws an error about the operation not implemented, ensure the node version supports the "Set Ephemeral" operation.

Links and References

Discussion