Zalo Login Via QR Code
AI-generatedOverview
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 user's 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 the QR code with a specific user or session. |
| Proxy | Optional HTTP proxy URL (including credentials) to route Zalo API requests through. |
| Domain | Optional domain to use for Zalo API requests (default is https://zalo.me). |
| Webhook URL | URL to which webhook notifications about QR login events (expired, scanned, declined, etc.) will be sent. Defaults to https://n8n.cloudgo.vn/webhook/zalo-log. |
| 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: An object with detailed information about the QR login session and events:
success: Indicates if the QR code was generated successfully.state: The unique state identifier used for the session.message: Status message describing the current state.fileName: The filename of the generated QR code image (zalo-qr-code.png).usingExistingCredential: Boolean indicating if existing credentials were used.credentialType: Type of credential used ("n8nZaloApi", "zaloApi", or null).userInfo: Object withdisplayNameandavatarURL of the logged-in user (or placeholders if not available yet).zaloApiInfo: Containsimei,userAgent, andzaloUserIdrelated to the Zalo session.webhook: Details about webhook configuration including enabled status, URL, state, and supported event types.- Additional fields related to credential creation status and instructions depending on the credentials used.
binary: Contains the QR code image data encoded as PNG under the key
data. This binary data represents the QR code that users scan with the Zalo app to initiate login.
Dependencies
- Requires access to the Zalo platform via its SDK (
zca-jspackage). - Optionally requires credentials for:
- Zalo API access (cookie, IMEI, user agent, etc.).
- n8n API account credential to create new Zalo credentials automatically after login.
- Uses Axios for HTTP requests to send webhook notifications.
- If proxy is configured, HTTP requests to Zalo API are routed through it.
- Webhook URL must be accessible from the internet to receive event notifications.
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 API availability.
- Invalid webhook URL: If the webhook URL is invalid or unreachable, webhook notifications will fail. Verify the URL format and server accessibility.
- QR code expired: The QR code has a limited lifetime. Users must scan it before expiration; otherwise, generate a new QR code.
- Declined QR code: If the user declines the login request on their device, the node logs this event and sends a webhook if enabled.
- Credential creation errors: Automatic creation of Zalo credentials via the n8n API may fail due to incorrect API keys, network issues, or port blocking. Review logs and ensure correct API credentials and network access.
- No credentials provided: Without credentials, the node only generates a QR code but cannot perform authenticated actions until login completes.
- Proxy misconfiguration: Incorrect proxy settings may prevent connection to Zalo API. Validate proxy URL and credentials.
Links and References
- Zalo Official Website
- Zalo SDK (zca-js) (used internally by the node)
- Axios HTTP Client
- n8n Documentation - for general usage and credential management
- Example webhook listener setup to receive Zalo login events (user-provided URL)