Overview
This node allows uploading one or multiple files to a specified chat thread on the Zalo platform, which can be either a user or a group thread. It supports various file sources including local file paths, remote URLs, and binary data from previous nodes. This node is useful for automating file sharing in Zalo conversations, such as sending reports, images, or documents directly within workflows.
Practical examples:
- Automatically upload daily report PDFs stored locally to a specific user chat.
- Download an image from a URL and send it to a group chat.
- Pass binary data from a previous node (e.g., an image generated or downloaded earlier) and upload it with a custom filename.
Properties
| Name | Meaning |
|---|---|
| Thread ID | The ID of the thread (user ID or group ID) where the files will be uploaded. |
| Thread Type | The type of thread: "User" or "Group". |
| Upload Sources | A list of files to upload. Each source can be one of: |
| - File Path: Local path to the file to upload. | |
| - File URL: URL of the file to download and upload. | |
| - Binary Data: Binary property name containing file data from previous nodes; requires a file name. |
Output
The node outputs a single JSON object with the following structure:
success(boolean): Indicates if the upload was successful.threadId(string): The ID of the thread where files were uploaded.threadType(string): The type of thread ("user" or "group").uploadResults(array): An array containing details about each uploaded file returned by the Zalo API.totalFiles(number): The total number of files uploaded.
If any error occurs during processing, the output will contain:
success: falseerror: The error message describing what went wrong.
The node does not output binary data itself but accepts binary input for upload.
Dependencies
- Requires an API authentication token credential for Zalo with cookie, IMEI, and user agent information.
- Uses the Zalo API client library to handle login and file uploads.
- Access to the local filesystem for reading files when using file paths.
- Network access to download files from URLs.
- n8n helper methods to retrieve binary data from previous nodes.
Troubleshooting
- Failed to initialize Zalo API: Indicates invalid or expired credentials. Verify that the provided cookie, IMEI, and user agent are correct and have not expired.
- File not found at path: When using a local file path, ensure the file exists and the n8n process has permission to read it.
- File name required for binary data: When uploading binary data, a file name must be provided; otherwise, the node throws an error.
- No files to upload: If the upload sources list is empty, the node will throw an error.
- Network errors downloading file URLs: Check network connectivity and URL validity.
- Partial failures: If some files fail to upload, the node logs errors per item and may continue depending on error handling settings.
Links and References
- Zalo Official API Documentation
- n8n Documentation on Creating Custom Nodes
- Node.js fs module for file system operations