Zalo User Login

Generate QR Code for Zalo login

Generate QR Code

AI-generated

Overview

This node facilitates logging into the Zalo messaging platform by generating a QR code that users scan with their Zalo mobile app. It supports three main operations:

  • Generate QR Code: Immediately creates a QR code image for login.
  • Check Login Status: Checks if the user has successfully logged in after scanning the QR code.
  • Generate QR + Wait for Login: Generates a QR code and waits until the user logs in or a timeout occurs.

Typical use cases include automating Zalo account authentication within workflows, enabling subsequent nodes to perform actions on behalf of the authenticated user. For example, a workflow could generate a QR code, prompt the user to scan it, then verify login status before proceeding to send messages or retrieve contacts.

Properties

Name Meaning
Operation Choose the mode of operation:
- Generate QR Code
- Check Login Status
- Generate QR + Wait for Login
QR Code Timeout (seconds) Timeout duration (in seconds) for scanning the QR code; applicable when generating QR codes immediately or waiting for login. Default is 60 seconds.
Debug Mode Enable detailed debug information in the output; only available when checking login status.

Output

The node outputs JSON data and, when applicable, binary data containing the QR code image.

  • JSON Output Fields:

    • success: Boolean indicating if the operation succeeded.
    • message: Human-readable message describing the result.
    • operation: The operation performed (generateQR, checkStatus, or generateAndWait).
    • qrTimeout: The timeout value used for QR code scanning.
    • timestamp: ISO timestamp of the operation.
    • status: Status string such as qr_ready, waiting_for_scan, or error states.
    • cookie: When login is successful or checked, contains the extracted session cookie string.
    • instructions: Step-by-step guidance on how to use the session cookie to create credentials.
    • error: Present if an error occurred during the operation.
    • debug: Optional detailed debug information (if Debug Mode enabled).
  • Binary Output:

    • Field name: qrCode
    • Contains the PNG image data of the generated QR code.
    • Includes metadata: MIME type (image/png), filename (zalo_qr_code.png), and file extension (png).

Dependencies

  • Requires the external zca-js library for interacting with Zalo's login API.
  • Uses local filesystem access to read/write temporary files:
    • zalo_session.json: Stores session data after login.
    • qr.png: Stores the generated QR code image.
  • No explicit API keys are required; authentication is done via QR code scanning.
  • Node environment must have permission to read/write files in the current working directory.

Troubleshooting

  • Common Issues:

    • QR code file not generated or missing: Ensure the node has write permissions and no other process locks the qr.png file.
    • Session file missing or corrupted: If zalo_session.json does not exist or cannot be parsed, regenerate the QR code and scan again.
    • Timeout waiting for login: Increase the "QR Code Timeout" property or retry generating a new QR code.
    • Login failure or incomplete session data: Follow instructions in the output to regenerate QR code and rescan.
  • Error Messages:

    • "Failed to generate QR code file": Indicates the QR code image was not created within the expected time.
    • "Login failed or in progress": User has not completed login; try checking status again later.
    • "Error reading session": Session file could not be read or parsed; regenerate QR code.
    • "Operation failed": Generic catch-all error; check debug output if enabled.

Links and References

Discussion