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 optionally saves the authentication credentials for future API interactions.
Common scenarios where this node is beneficial include:
- Automating Zalo account login without manual password entry.
- Integrating Zalo messaging capabilities into workflows by obtaining valid session credentials.
- Managing multiple Zalo accounts programmatically by generating and storing login credentials via QR code scanning.
Practical example:
- A user wants to automate sending messages through Zalo in an n8n workflow. They use this node to generate a QR code, scan it with their mobile Zalo app to log in, and then subsequent nodes can use the saved credentials to send messages on behalf of the logged-in user.
Properties
| Name | Meaning |
|---|---|
| Proxy | HTTP proxy URL (e.g., https://user:pass@host:port) to route Zalo API requests through. |
Output
The node outputs an array with one item containing:
json:
success: Boolean indicating if the QR code was generated successfully.message: Informational message about the login or credential usage status.fileName: The filename of the generated QR code image (zalo-qr-code.png).usingExistingCredential: Boolean indicating if existing credentials were used.- Additional fields depending on credential usage:
- If using n8n account credential: instructions about automatic credential creation, credential name, ID, and type.
- If using existing Zalo credentials: details about the credential name, ID, and type.
- If no credentials provided: file path to saved credentials JSON and instructions for manual or automatic credential creation.
binary:
data: The QR code image data in PNG format encoded as binary, ready for further use or download.
Dependencies
- Requires access to Zalo API services for QR code generation and login.
- Optionally requires:
- An API key credential for Zalo API or an n8n account credential with API access.
- Network access to the n8n API endpoint if automatic credential creation is enabled.
- Supports configuring an HTTP proxy for outbound requests.
- Uses external libraries:
zca-jsfor Zalo SDK interaction.axiosfor HTTP requests.pathfor file path operations.
Troubleshooting
Timeout generating QR code:
Occurs if the QR code is not generated within 30 seconds. Check network connectivity and Zalo service availability.No credentials provided:
If neither Zalo API nor n8n account credentials are supplied, the node will generate a QR code but cannot save credentials automatically. Users must manually handle credential storage.Credential creation failures:
Errors during automatic credential creation via the n8n API may occur due to incorrect API keys, network issues, or port blocking. Review error logs and ensure correct API configuration.Proxy issues:
Incorrect proxy settings may prevent successful connection to Zalo API. Verify proxy URL format and accessibility.QR code expired or declined:
The QR code has a limited validity period. If expired, rerun the node to generate a new QR code. Declined scans indicate the user rejected the login request.
Links and References
- Zalo Official Website
- n8n Documentation
- Axios HTTP Client
- zca-js GitHub Repository (Note: Replace with actual repo if available)