Zalo Login Via QR Code icon

Zalo Login Via QR Code

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

Overview

This node facilitates logging into the Zalo messaging platform using a QR code. It generates a QR code image that users scan with their Zalo app to authenticate. Upon successful login, it captures and saves the user's Zalo credentials (such as cookies, IMEI, and user agent) for future API interactions.

Common scenarios where this node is beneficial include:

  • Automating Zalo account authentication in workflows without manual credential input.
  • Integrating Zalo messaging capabilities into n8n workflows by programmatically obtaining valid session credentials.
  • Managing multiple Zalo accounts by generating and storing credentials dynamically.

Practical example:

  • A workflow that sends automated messages via Zalo can first use this node to log in via QR code, obtain fresh credentials, and then proceed with message sending nodes.

Properties

Name Meaning
Proxy HTTP proxy URL to route Zalo API requests through, e.g., https://user:pass@host:port.

Output

The node outputs one item containing:

  • json:

    • success: Boolean indicating if the QR code was generated successfully.
    • message: Informational message about the login or QR code generation status.
    • fileName: The filename of the QR code image (zalo-qr-code.png).
    • usingExistingCredential: Boolean indicating if existing credentials were used.
    • Credential-related metadata when applicable, such as instructions, credential name, ID, type, and notes about automatic credential creation.
    • If no credentials are provided, paths and instructions for manual credential creation scripts are included.
  • binary:

    • data: The QR code image data encoded as PNG, ready for download or display.

This output allows downstream nodes to access the QR code image for user scanning and to receive detailed information about the login state and credentials management.

Dependencies

  • Requires the zca-js library for interacting with the Zalo SDK.
  • Uses axios for HTTP requests to the n8n API when creating credentials automatically.
  • Optionally requires two types of credentials configured in n8n:
    • An API key credential for accessing the n8n instance's API (used for automatic credential creation).
    • A Zalo API credential containing existing Zalo session details (cookie, IMEI, user agent, etc.).

Troubleshooting

  • Timeout generating QR code: If the QR code does not generate within 30 seconds, a timeout error occurs. Check network connectivity and proxy settings.
  • No credentials provided: If neither Zalo nor n8n API credentials are supplied, the node will generate a QR code but cannot save credentials automatically. Users must manually create credentials using the provided script.
  • Proxy issues: Incorrect proxy URLs or authentication failures may prevent connecting to Zalo APIs.
  • Credential creation errors: Failures when calling the n8n API to create credentials may require verifying API key validity and n8n API availability.
  • QR code expired or declined: The node logs these events; users should rescan or retry login.

Links and References

Discussion