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" parameter, which can be scanned by the Zalo mobile app to authenticate the user. 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 Zalo account logins in workflows without manual password entry.
- Integrating Zalo login status updates into other systems via webhooks.
- Managing multiple Zalo sessions identified by unique states (e.g., different users or devices).
- Automatically creating or updating credentials after successful login.
Practical example:
- A business wants to automate customer support via Zalo. This node generates a QR code for each support agent's session. When an agent scans the QR code with their Zalo app, the node captures login info and sends it to a webhook that updates the support system with the agent’s online status.
Properties
| Name | Meaning |
|---|---|
| State | Unique identifier for this QR login session (e.g., user1, user2, session1). Used to track who owns the QR code. |
| Proxy | HTTP proxy URL to route Zalo API requests through (format: https://user:pass@host:port). Optional. |
| Domain | Base domain for Zalo API requests (default placeholder is https://zalo.me). Optional. |
| Webhook URL | URL to send event notifications to (e.g., QR expired, scanned, declined, login success). |
| Enable Webhook | Boolean flag to enable or disable sending webhook notifications for Zalo events. |
Output
The node outputs one item containing:
json: An object with detailed information about the QR login session and events:
success: Boolean indicating if QR code generation was successful.state: The unique state identifier used.message: Status message describing the current state.fileName: Filename of the generated QR code image (zalo-qr-code.png).usingExistingCredential: Whether existing credentials were used.credentialType: Type of credential used or created (generic description).userInfo: Object withdisplayNameandavatarURL of the logged-in user (or placeholders if not available yet).zaloApiInfo: Containsimei,userAgent, andzaloUserIdrelated to the login session.webhook: Details about webhook configuration including enabled status, URL, state, and supported event types.- Additional fields related to credential creation status and instructions if applicable.
binary: Contains the QR code image data in PNG format under the key
data. This image can be displayed or saved for scanning.
Dependencies
- Requires access to the Zalo platform via its SDK/library bundled as
zca-js. - Optionally requires credentials for Zalo API or an n8n account API to manage credentials automatically.
- Uses Axios HTTP client for sending webhook POST requests.
- If proxy is configured, HTTP requests to Zalo API will use the specified proxy.
- Webhook URL must be a valid URL accessible from the node runtime environment.
- For automatic credential creation, requires 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 to Zalo API and ensure credentials are valid.
- Invalid webhook URL: If the webhook URL is empty or malformed, webhook notifications are skipped with warnings logged.
- QR code expired: The QR code has a limited lifetime. Users must scan it before expiration; otherwise, generate a new QR code.
- QR code declined: User declined the login request on their device. Retry the login process.
- Credential creation errors: Automatic creation of Zalo credentials via n8n API may fail due to network issues or permission problems. In such cases, credentials are saved to a file for manual creation.
- No credentials provided: The node can still generate a QR code for login but cannot reuse existing credentials or create new ones automatically.
- Connection errors: Errors connecting to Zalo SDK are logged and sent via webhook if enabled. Verify network and proxy settings.
Links and References
This summary is based solely on static analysis of the provided source code and property definitions.