Overview
This node enables logging into the Zalo platform using a QR code authentication method. It facilitates obtaining user information and creating or updating credentials based on the successful login via scanning a QR code. The node is useful in scenarios where automated workflows require authenticated access to Zalo accounts without manual password entry, such as integrating Zalo messaging or user data retrieval into n8n workflows.
Practical examples include:
- Automatically logging into a Zalo account to send messages or retrieve contact information.
- Creating or updating API credentials dynamically after a successful QR code login.
- Managing multiple Zalo user sessions by storing credential metadata for reuse.
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 of items with the following structure in the json field:
success: Boolean indicating if the login was successful.message: A descriptive message about the login status.fileName: The filename of the generated QR code image (zalo-qr-code.png).usingExistingCredential: Boolean indicating whether an existing credential was used.credentialType: The type of credential created or used (e.g., new Zalo API credential).userId: The unique identifier of the logged-in user.displayName: The display name of the user retrieved from Zalo.phoneNumber: The user's phone number extracted and normalized.userInfo: Additional user information fetched from the Zalo API.credentialInstructions: Instructions or notes related to the credential creation or usage.credentialError: If any error occurred during credential creation, this contains the error message.vietinsoftSuccess: Boolean flag indicating success of an additional external API call (specific to integration).vietinsoftResponse: Response data from the external API call if applicable.
If binary data is output, it represents the QR code image data encoded as PNG format, which users scan to authenticate.
Dependencies
- Requires an API key credential for authenticating requests to the n8n API endpoint that manages credentials.
- Uses the Zalo API client library internally to handle login and user info retrieval.
- Optionally supports routing requests through an HTTP proxy specified by the
Proxyproperty. - Reads and writes local JSON files (
dataUser.json) to cache user credential metadata. - Requires network connectivity to Zalo services and the n8n API server.
Troubleshooting
Common Issues
- QR Code Timeout: The QR code expires if not scanned within a certain timeframe, causing a timeout error.
- Credential Creation Failure: Errors when posting new credentials to the n8n API may occur due to invalid API keys or network issues.
- User Info Retrieval Failure: If the node cannot fetch user details from Zalo, it may return empty or partial user data.
- Proxy Misconfiguration: Incorrect proxy URLs can cause request failures to the Zalo API.
- Login Rejection: If the QR code login is rejected by the user, the node throws an error indicating login cancellation.
Error Messages and Resolutions
"Timeout generating QR code.": Indicates the QR code was not scanned in time. Retry the operation promptly."Login by QR code was rejected.": User declined the login; prompt user to scan and accept the login."Error getting user info from Zalo:": Network or API errors fetching user data; verify API availability and credentials."Credential creation failed": Check the API key credential validity and ensure the n8n API endpoint is reachable."Zalo credentials will be created after QR login.": Informational message indicating credentials are pending creation post-login.
Links and References
- Zalo Official Developer Documentation
- n8n Documentation - Creating Custom Nodes
- Axios HTTP Client
- Node.js File System Module
Note: Internal variable names, credential type identifiers, and other internal-only references have been generalized to comply with guidelines.