Zalo Login QR icon

Zalo Login QR

Đăng nhập Zalo bằng QR code và tự động lưu credentials

Overview

The Zalo Login QR node enables logging into the Zalo messaging platform using a QR code. It supports generating a QR code for scanning with the Zalo mobile app, waiting for the user to scan and complete login, and optionally auto-saving the resulting credentials for future use in workflows.

This node is useful when you want to automate interactions with Zalo by programmatically authenticating without manual password entry. For example, it can be used to:

  • Generate a QR code that users scan on their phone to authenticate.
  • Wait for the user to scan and confirm login, then automatically save the session credentials.
  • Support hybrid modes where the QR code is shown immediately but the node continues listening for login completion in the background.

Practical scenarios include automating customer support chatbots, sending notifications via Zalo, or integrating Zalo messaging into business workflows.


Properties

Name Meaning
Timeout (Seconds) How long (in seconds) to wait for the QR code to be scanned and login to complete before timing out.
Proxy Optional HTTP proxy URL to route requests through (format: https://user:pass@host:port).
Login Mode Choose the login behavior:
- Complete Login (Wait for Scan): Wait until user scans and logs in.
- Show QR Only (No Wait): Generate QR code and return immediately.
- Show QR + Wait (Hybrid): Show QR immediately, then wait for scan and auto-save credentials.
Auto Save Credentials Whether to automatically save credentials after successful login (only available if Login Mode is "Complete Login").

Output

The node outputs JSON data containing detailed information about the login process and results:

  • success: Boolean indicating if the operation succeeded.
  • message: Informational message about the current status.
  • mode: Object describing the login mode type (qr-only, hybrid, or complete-login) and a human-readable description.
  • qrCode: Information about the QR code:
    • available: Whether a QR code image is included.
    • fileName: The filename of the QR code image binary (if available).
    • size: Size in bytes of the QR code image.
    • instruction: Instructions for scanning the QR code.
  • user: Details about the logged-in user:
    • displayName: User's display name or status like "Pending scan...".
    • loginTimestamp: Timestamp of login or QR generation.
    • loginComplete: Boolean indicating if login was completed.
  • credentials: Summary of credential state:
    • hasCredentials: Whether valid credentials are present.
    • imei: Partially masked IMEI identifier.
    • userAgent: Partial user agent string.
    • pending: Whether login is still pending (e.g., QR only mode).
  • autoSave: Details about auto-saving credentials:
    • enabled: If auto-save is enabled.
    • n8nApiConfigured: Whether the n8n API credential is configured for saving.
    • saved: Whether credentials were successfully saved.
    • credentialId: ID of saved credentials (if any).
    • error: Any error message from auto-save attempt.
    • applicable: Whether auto-save applies (false if QR-only mode).
  • execution: Metadata about execution parameters such as login mode, timeout, proxy usage, timestamp, and node version.
  • nextSteps: Suggested next steps for the user depending on the mode.

If a QR code image is generated, it is also provided as binary data under the binary.qrCode field, encoded as a PNG image ready for download or display.


Dependencies

  • Requires an optional existing Zalo API credential to reuse saved sessions.
  • Optionally requires an API key credential for the n8n API to enable automatic saving of new credentials.
  • Uses the external zca-js library to handle Zalo QR login flow.
  • Uses axios for HTTP requests to the n8n API.
  • Supports optional HTTP proxy configuration.
  • No other external services are mandatory, but network connectivity to Zalo servers is required.

Troubleshooting

Common Issues

  • QR code not generated within 30 seconds: Could indicate network issues or incompatibility with the underlying Zalo JS library.
  • Timeout waiting for QR scan: User did not scan the QR code within the specified timeout period.
  • QR code expired: The QR code has a limited lifetime; if expired, restart the login process.
  • Login declined by user: The user explicitly rejected the login request on their device.
  • Auto-save failures: Occur if the n8n API credential is missing or invalid, or if there are network/API errors during credential saving.

Error Messages and Resolutions

  • "QR code not generated within 30 seconds - possible zca-js issue": Check internet connection and ensure the zca-js library is compatible.
  • "Timeout after X seconds. QR code was not generated - check network connection and zca-js compatibility.": Verify network access and retry.
  • "QR code login was declined by user. Please try again.": User cancelled login; prompt them to retry.
  • "QR code has expired. Please try again.": Restart the node to generate a fresh QR code.
  • "Login initialization failed: ..." or "Failed to start QR login: ...": Internal errors starting the login process; check node configuration and dependencies.
  • Auto-save warnings like "Could not auto-save credentials": Ensure the n8n API credential is configured correctly and reachable.

Links and References

Discussion