WhatsApp Web Connect icon

WhatsApp Web Connect

Connect to WhatsApp Web and manage authentication

Generate QR Code

AI-generated

Overview

The node "WhatsApp Web Connect" enables integration with WhatsApp Web for various operations including generating a QR code for authentication, connecting to WhatsApp Web, sending messages, checking connection status, and disconnecting.

For the Generate QR Code operation specifically, the node generates a QR code that users can scan with their WhatsApp mobile app to authenticate and establish a session with WhatsApp Web. This is useful in workflows where automated WhatsApp messaging or interaction is required after authentication.

Common scenarios:

  • Automating WhatsApp message sending after authenticating via QR code.
  • Integrating WhatsApp communication into business workflows.
  • Managing WhatsApp sessions programmatically.

Practical example:
A user wants to automate sending notifications via WhatsApp. They first use this node's Generate QR Code operation to get a QR code, scan it with their phone to authenticate, then use subsequent nodes to send messages automatically.


Properties

Name Meaning
QR Code Format Format of the QR code data returned in the output. Options: Raw Data (string), Base64.
Timeout (seconds) Timeout duration in seconds for QR code scanning before giving up (default is 120 seconds).

Output

The output JSON object for the Generate QR Code operation contains:

  • operation: The string "generateQR" indicating the operation performed.
  • success: Boolean indicating if the QR code generation was successful.
  • message: A descriptive message about the result.
  • sessionName: The unique session identifier used for WhatsApp Web authentication.
  • qrCode: The QR code data itself, either as raw string data or base64 encoded string depending on the selected format.

This QR code data should be presented to the user so they can scan it with their WhatsApp mobile app to authenticate.

No binary data output is produced by this operation.


Dependencies

  • Requires an API key credential for WhatsApp Web access configured in n8n.
  • Uses the whatsapp-web.js library internally to interact with WhatsApp Web.
  • Requires Puppeteer environment for headless browser automation.
  • Temporary user data directories are created under /tmp/whatsapp-web-<sessionName> for session management.
  • Network connectivity to WhatsApp Web servers is necessary.

Troubleshooting

  • Timeouts generating QR code: If the QR code is not generated within 60 seconds, it may indicate network issues or WhatsApp Web being unavailable. Increasing the timeout property or checking network connectivity can help.
  • Authentication failures: Errors during authentication will be reported with messages like "Authentication failed". Ensure the QR code is scanned promptly and correctly.
  • Session directory errors: Issues related to session directory cleanup or locking may occur. These are handled with retries but persistent errors might require manual cleanup of /tmp/whatsapp-web-* folders.
  • Client initialization failures: If the client fails to initialize after multiple retries, check system resources, Puppeteer dependencies, and network access.
  • Error messages: The node throws errors with descriptive messages such as "Failed to generate QR code within timeout period" or "Failed to initialize client". Review these messages to diagnose issues.

Links and References


If you need details on other operations or further assistance, feel free to ask!

Discussion