Actions2
Overview
This node integrates with WhatsApp Web API to send messages and media files, as well as create groups. It is useful for automating communication workflows where WhatsApp is the preferred messaging platform. Common scenarios include sending notifications, alerts, or marketing messages directly to users' WhatsApp accounts, or managing group chats programmatically.
For the Send Media operation specifically, the node sends media content (such as images, videos, or documents) to a specified phone number on WhatsApp. This can be used in customer support automation, sharing promotional materials, or delivering multimedia content automatically.
Properties
Name | Meaning |
---|---|
Phone Number | The recipient's phone number to which the media will be sent. Format should be international without symbols. |
(Note: The provided properties JSON only includes "Phone Number" for the Send Media operation. Other operations have additional properties like "Message".)
Output
The node outputs an array of JSON objects, each representing the result of sending a message or media item. For the Send Media operation, the output JSON includes:
success
: Boolean indicating if the media was sent successfully.status
: A string message confirming the action, e.g., "Message sent successfully".phoneNumber
: The recipient's phone number.content
: The content sent (for Send Message operation; for Send Media, this would correspond to media details if implemented).
If an error occurs and the node is configured to continue on failure, the output JSON will contain an error
field with the error message.
The node does not explicitly show binary data handling in the provided code snippet, but since it supports sending media, it likely handles media content internally or via references.
Dependencies
- Requires connection to WhatsApp Web via the
@whiskeysockets/baileys
library. - Stores authentication state locally in a folder named
whatsapp-auth
within the current working directory. - Requires the user to scan a QR code once to authenticate the WhatsApp session (printed in terminal).
- No explicit external API keys are shown, but WhatsApp account authentication is necessary.
- Node depends on n8n workflow environment and its error handling utilities.
Troubleshooting
- Client Not Initialized Error: If the WhatsApp client fails to initialize, ensure that the authentication folder exists and the QR code has been scanned successfully.
- Connection Closed Unexpectedly: The node attempts to reconnect unless the disconnect reason is a logout. If persistent disconnections occur, check network stability and WhatsApp account status.
- Invalid Phone Number Format: Phone numbers must be in international format without special characters. Incorrect formatting may cause message sending failures.
- Error Messages: Errors during sending are caught and either thrown or returned in the output depending on the "Continue On Fail" setting. Review error messages for clues such as invalid credentials, blocked contacts, or unsupported media types.
- QR Code Not Displayed: Ensure the node runs in an environment where terminal output is visible to scan the QR code for initial authentication.
Links and References
- Baileys GitHub Repository – WhatsApp Web API client used by the node.
- WhatsApp Business API Documentation – Official WhatsApp API reference.
- n8n Documentation – General information about creating and using custom nodes in n8n.