WhatsApp Web Connect icon

WhatsApp Web Connect

Connect to WhatsApp Web and manage authentication

Connect

AI-generated

Overview

The node "WhatsApp Web Connect" enables integration with WhatsApp Web by managing authentication and connection sessions. It supports generating QR codes for authentication, connecting to WhatsApp Web using those QR codes, sending messages to WhatsApp chats, checking connection status, and disconnecting sessions.

This node is useful in scenarios where automated WhatsApp messaging or monitoring is required within workflows, such as customer support automation, notification systems, or marketing campaigns. For example, a workflow could generate a QR code for a user to scan and authenticate their WhatsApp session, then send messages automatically based on triggers or data inputs.

The Connect operation specifically handles establishing a WhatsApp Web session by generating a QR code for scanning and waiting for successful authentication within a configurable timeout period.

Properties

Name Meaning
QR Code Format Format of the QR code data returned in the output. Options:
- Raw Data (string)
- Base64 string
Timeout (seconds) Timeout duration in seconds to wait for QR code scanning and connection before failing (default 120 seconds)

Output

The output JSON object for the Connect operation includes:

  • operation: The string "connect" indicating the performed operation.
  • success: Boolean indicating if the connection was successful.
  • message: A descriptive message about the connection result or error.
  • sessionName: The unique session identifier used internally for this WhatsApp Web session.
  • qrCode: The QR code data string generated during connection, formatted according to the selected QR Code Format property. This is used for scanning in the WhatsApp mobile app to authenticate.
  • clientInfo (only on success): An object containing information about the connected WhatsApp client session.

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 to interact with WhatsApp Web.
  • Relies on Puppeteer for headless browser automation to manage WhatsApp Web sessions.
  • Temporary session data is stored under /tmp/whatsapp-web-{sessionName} on the host system.
  • Node requires permission to spawn child processes for cleanup operations.

Troubleshooting

  • Timeouts: If the connection times out (after the configured timeout), it usually indicates network issues, WhatsApp Web being unavailable, or the QR code not being scanned in time. Increasing the timeout or ensuring stable internet connectivity can help.
  • Authentication Failures: Errors during authentication may occur if the QR code is scanned incorrectly or the session is invalid. Re-generating the QR code and rescanning often resolves this.
  • Session Lock Errors: Errors mentioning "SingletonLock" or "Failed to create a ProcessSingleton" indicate conflicts with existing sessions or locked profile directories. Cleaning up the temporary session directory (/tmp/whatsapp-web-{sessionName}) manually or restarting the node can fix this.
  • Client Initialization Failures: These errors happen if the underlying Puppeteer client fails to initialize properly. Retrying the connection or verifying environment compatibility with Puppeteer is recommended.
  • Resource Cleanup: The node attempts to clean up session directories on certain errors, but manual cleanup might be necessary if stale files remain.

Links and References

Discussion