WhatsApp Web Trigger
AI-generatedOverview
This node acts as a trigger for incoming WhatsApp messages using the WhatsApp Web protocol. It listens for new messages received on a WhatsApp account and triggers workflows based on those messages. This is useful for automating responses, logging conversations, or integrating WhatsApp communication into broader business processes.
Common scenarios include:
- Automatically processing customer inquiries received via WhatsApp.
- Logging all group or direct messages to an external system.
- Triggering alerts or notifications when specific messages arrive.
- Building chatbots that respond to WhatsApp messages in real-time.
For example, a support team could use this node to start a workflow whenever a customer sends a message, enabling automated ticket creation or routing.
Properties
| Name | Meaning |
|---|---|
| Trigger On | Select which messages trigger the node: - All Messages - Groups Only - Direct Messages Only |
| QR Code Logging | Whether to log QR code data to the console for debugging during authentication: - Enable - Disable |
| Debug Mode | Whether to include debug information in the output JSON: - Enable - Disable |
Output
The node outputs JSON objects representing received WhatsApp messages with the following structure:
id: Unique identifier of the message.body: Text content of the message.from: Sender's WhatsApp ID.to: Recipient's WhatsApp ID.timestamp: When the message was sent (Unix timestamp).type: Type of message (e.g., text, image).author: Author of the message (useful in groups).isGroup: Boolean indicating if the message is from a group.mentionedIds: Array of IDs mentioned in the message.hasMedia: Boolean indicating if the message contains media.fromMe: Boolean indicating if the message was sent by the logged-in user.deviceType: Type of device used to send the message.isForwarded: Boolean indicating if the message was forwarded.isStatus: Boolean indicating if the message is a status update.isStarred: Boolean indicating if the message is starred.broadcast: Boolean indicating if the message is part of a broadcast.
If Debug Mode is enabled, additional debug information is included under the debug property, such as session name, trigger settings, client readiness, timestamps, and user data directory paths.
The node does not output binary data.
Dependencies
- Requires an API key credential for WhatsApp Web authentication.
- Uses the
whatsapp-web.jslibrary internally to connect to WhatsApp Web. - Requires Puppeteer for headless browser automation.
- Stores session data temporarily in
/tmp/whatsapp-web-[sessionName]-[workflowId]. - The environment must allow running headless Chromium with appropriate sandboxing flags.
Troubleshooting
- Session Conflict Error: If multiple workflows try to use the same WhatsApp Web session simultaneously, you may see errors about session conflicts. Solution: ensure only one workflow uses the credentials at a time or use separate credentials.
- Browser Session Closed Unexpectedly: This can happen due to resource constraints or instability in the headless browser. Try restarting the workflow or increasing server resources.
- QR Code Not Scanning: If QR code logging is disabled, you might miss scanning prompts. Enable QR Code Logging to see the QR code data in the console for manual scanning.
- Message Filtering: Messages are filtered based on the "Trigger On" setting. If no messages trigger the workflow, verify this setting matches your intended message types (all, groups only, or direct only).