Overview
This node facilitates QR code login sessions for the Zalo platform, a popular messaging app. It manages unique QR login sessions identified by a "state" string and monitors their status in real-time. The node can detect events such as QR code scanned, declined, expired, or successful login, and optionally sends webhook notifications about these events to a specified URL.
Common scenarios where this node is beneficial include:
- Implementing QR code-based authentication flows for users of an application integrated with Zalo.
- Monitoring user login states via QR codes in real-time.
- Automating responses or workflows triggered by QR login events (e.g., sending welcome messages after successful login).
- Logging or auditing QR login session events externally through webhooks.
Practical example:
- A web app wants to allow users to log in using their Zalo account by scanning a QR code. This node generates and monitors the QR login session, reporting back when the user scans or confirms the login, enabling the app to authenticate the user seamlessly.
Properties
| Name | Meaning |
|---|---|
| State | Unique identifier for the QR login session; used to associate the QR code with a specific user or session (e.g., "user1", "session1"). Required. |
| Proxy | Optional HTTP proxy URL (including credentials if needed) to route API requests to Zalo. Format: https://user:pass@host:port. |
| Domain | Base domain URL for Zalo API requests. Defaults to https://zalo.me if not specified. |
| Webhook URL | URL to which webhook event notifications are sent (e.g., QR expired, scanned, declined). Default is https://ai.tamanjsc.com/webhook/zalo-log. |
| Enable Webhook | Boolean flag to enable or disable sending webhook notifications for Zalo events. Defaults to true. |
Output
The node outputs an array with one item containing:
json: An object with detailed information about the QR login session and its current state, including:
success: Boolean indicating if the operation was successful.state: The unique state identifier provided as input.message: Human-readable message describing the current status.fileName: Name of a file related to the session (likely a QR code image).usingExistingCredential: Boolean indicating if an existing credential was used.credentialType: Type of credential used (if any).userInfo: Object with user's display name and avatar URL (or indication if not available).zaloApiInfo: Containsimei,userAgent, andzaloUserIdrelated to the session.webhook: Object detailing webhook settings including whether enabled, URL, state, and list of event types monitored.
binary: Contains binary data representing the QR code image associated with the login session.
This output allows downstream nodes or workflows to access both the QR code image and metadata about the login session and user.
Dependencies
- Requires network access to Zalo's API endpoints, defaulting to
https://zalo.meunless overridden. - Supports optional HTTP proxy configuration.
- Optionally requires a webhook endpoint URL to send event notifications.
- Uses an API key credential (not named explicitly here) for authenticating requests to Zalo's API.
- Relies on internal HTTP request libraries and possibly other bundled dependencies for communication and event handling.
Troubleshooting
Common Issues
- Invalid or missing State: The "State" property must be unique and non-empty. If empty or duplicated, the node may fail to track the correct QR login session.
- Incorrect Proxy URL: Malformed proxy URLs or unreachable proxies will cause API request failures.
- Invalid Domain: Providing an incorrect domain URL will prevent successful API calls.
- Webhook Failures: If the webhook URL is unreachable or returns errors, webhook notifications will fail silently or log errors.
- Credential Issues: Missing or invalid API authentication credentials will cause authorization failures.
Error Messages and Resolutions
- Errors related to URL validation indicate malformed "Domain" or "Webhook URL" inputs. Verify URLs are correctly formatted.
- Timeout or network errors suggest connectivity issues with Zalo API or proxy misconfiguration.
- Authentication errors imply problems with the API key credential; ensure it is valid and has necessary permissions.
- JSON parsing or unexpected response errors may indicate changes in Zalo API or network interruptions.
Users should verify all input properties, network configurations, and webhook endpoints to resolve common errors.
Links and References
- Zalo Official Website
- Zalo Developer Documentation
- n8n Documentation
- For webhook setup and troubleshooting, refer to your webhook service provider's documentation.