Zalo Login Via QR Code icon

Zalo Login Via QR Code

Đăng nhập Zalo bằng QR code và lưu thông tin vào Credential

Overview

This node enables logging into the Zalo messaging platform using a QR code. It generates a unique QR code for a login session identified by a "state" string, which users scan with their Zalo app to authenticate. The node listens for various events during the QR login process such as QR code generation, scanning, expiration, decline, and successful login. It can send webhook notifications about these events to a specified URL.

Common scenarios where this node is beneficial include:

  • Automating user authentication in workflows that require Zalo login without manual password entry.
  • Integrating Zalo login sessions into broader automation pipelines.
  • Monitoring QR login events remotely via webhooks for audit or notification purposes.

Practical example:

  • A workflow that generates a QR code for a user to scan, waits for the user to authenticate via Zalo, then automatically saves the login credentials for future API calls or triggers downstream processes upon successful login.

Properties

Name Meaning
State Unique identifier for the QR login session (e.g., user1, user2, session1). Used to associate events.
Proxy HTTP proxy URL (with optional authentication) to route Zalo API requests through.
Domain Base domain URL for Zalo API requests (default placeholder: https://zalo.me).
Webhook URL URL to send event notifications (QR expired, scanned, declined, login success, etc.)
Enable Webhook Boolean flag to enable or disable sending webhook notifications for Zalo events.

Output

The node outputs an array with one item containing:

  • json object with fields:

    • success: boolean indicating if QR code generation was successful.
    • state: the input state string identifying the session.
    • message: status message describing the current state.
    • fileName: filename of the generated QR code image (zalo-qr-code.png).
    • usingExistingCredential: boolean indicating if existing credentials were used.
    • credentialType: type of credential used or null if none.
    • userInfo: object with displayName and avatar URL or placeholders before scan.
    • zaloApiInfo: info about IMEI, user agent, and Zalo user ID if available.
    • webhook: details about webhook configuration and enabled events.
    • Additional fields related to credential creation status and instructions if applicable.
  • binary data:

    • data: the QR code image in PNG format encoded as binary data, ready for use or display.

This output allows downstream nodes to access the QR code image for display or further processing and track login session status and metadata.

Dependencies

  • Requires an API key credential for Zalo or an n8n account credential to interact with Zalo services.
  • Uses the zca-js library for Zalo SDK interactions.
  • Uses axios for HTTP requests including webhook notifications and credential creation via n8n API.
  • Optional HTTP proxy support for network routing.
  • Webhook URL must be accessible to receive event notifications.
  • If automatic credential creation is enabled, requires valid n8n API credentials with appropriate permissions.

Troubleshooting

  • Timeout generating QR code: If the QR code is not generated within 30 seconds, the node throws a timeout error. Check network connectivity and Zalo service availability.
  • Invalid webhook URL: If the webhook URL is malformed or unreachable, webhook notifications will fail. Verify the URL format and endpoint accessibility.
  • QR code expired: The QR code has a limited lifetime; if expired, generate a new one.
  • QR code declined: User declined the login request; prompt user to retry.
  • Credential creation errors: Automatic creation of Zalo credentials via n8n API may fail due to incorrect API keys, network issues, or permission problems. Review logs and ensure API credentials are correct.
  • No credentials provided: Without credentials, the node only generates a QR code but cannot perform authenticated actions.
  • Proxy issues: Incorrect proxy settings may block requests; verify proxy URL and credentials.

Links and References

Discussion