WhatsApp QR Trigger icon

WhatsApp QR Trigger

Triggers when a WhatsApp message is received (Manual execution shows sample data, active workflows receive real messages)

Overview

This node triggers a workflow when a WhatsApp message is received via a QR-based WhatsApp session. It listens for incoming messages and emits them as workflow data, enabling automation based on WhatsApp communications.

Common scenarios where this node is beneficial include:

  • Automating customer support by triggering workflows on new WhatsApp messages.
  • Filtering and processing messages from specific contacts or groups.
  • Integrating WhatsApp messaging with other systems like CRMs or databases.
  • Monitoring WhatsApp conversations for keywords or media content to trigger alerts or actions.

For example, you could use this node to automatically log all WhatsApp messages containing the keyword "order" into a sales database or notify a team when a message arrives from a VIP contact.

Properties

Name Meaning
Auto-create Session Whether to automatically create a WhatsApp session if it doesn't exist. If enabled, the node will attempt to create a session automatically; otherwise, it requires a pre-existing session.
Filter Options A collection of filters to control which messages trigger the workflow:
• Only from Contacts: Trigger only for messages from saved contacts.
• Exclude Groups: Do not trigger for group messages.
• Include Media: Whether to include messages that contain media.
• Keyword Filter: Only trigger for messages containing this keyword (case-insensitive). Leave empty to disable.
• Phone Number Filter: Only trigger for messages from this phone number. Leave empty to disable.

Output

The node outputs an array of JSON objects representing WhatsApp messages that pass the configured filters. Each output item includes:

  • id: Unique message identifier.
  • from: Sender's WhatsApp ID.
  • to: Recipient's WhatsApp ID.
  • body: Text content of the message.
  • type: Message type (e.g., chat).
  • timestamp: Unix timestamp of when the message was sent.
  • hasMedia: Boolean indicating if the message contains media.
  • mediaUrl: URL to access the media (if any).
  • mediaType: Type of media (e.g., image, video).
  • isGroup: Boolean indicating if the message is from a group.
  • groupName: Name of the group (if applicable).
  • contact: Object with contact details (name, number, isMyContact).
  • sessionName: The name of the WhatsApp session used.
  • receivedAt: ISO string timestamp when the message was received by the node.
  • Additional fields for test messages during manual execution, such as isTestMessage and note.

If the message contains media, the node includes relevant media information but does not output binary data directly.

Dependencies

  • Requires a valid WhatsApp session accessible via a QR code API service.
  • Needs an API key credential for authenticating with the WhatsApp QR API service.
  • Optionally requires configuration of a webhook URL and browser executable path for session creation.
  • Depends on an internal WhatsApp service utility to manage sessions and webhook callbacks.

Troubleshooting

  • Session Not Found Error: If the node throws "WhatsApp session not found and auto-create is disabled," ensure that a WhatsApp session exists or enable the auto-create session option.
  • No Messages Triggered: Check filter settings—filters like "Only from Contacts," "Exclude Groups," keyword, or phone number filters may prevent messages from triggering the workflow.
  • Media Not Included: If media messages are not triggering, verify that "Include Media" is enabled in filter options.
  • Webhook Issues: Ensure the webhook URL is correctly set up and reachable if using webhooks for receiving messages.
  • Manual Execution Shows Sample Data: This is expected behavior; real messages are only received when the workflow is active.

Links and References

Discussion