Overview
This node uploads files to the Enterprise WeChat (WeCom) platform using a webhook URL. It supports uploading different types of media files such as images, voice recordings, videos, and generic files. The node can upload files either from binary data available in the workflow or directly from a local file path.
Common scenarios where this node is useful include:
- Automating the upload of media files to WeCom for sharing within an organization.
- Integrating file uploads into workflows that generate or receive files dynamically.
- Sending multimedia content to WeCom channels or users via webhook integrations.
Practical example:
- A workflow receives an image from a user, processes it, and then uses this node to upload the image to a WeCom group chat via a configured webhook.
- A scheduled workflow uploads daily reports stored locally as PDF files to WeCom for team access.
Properties
| Name | Meaning |
|---|---|
| 文件类型 (fileType) | The type of file to upload. Options: 图片 (image), 语音 (voice), 视频 (video), 文件 (file). |
| 上传方式 (uploadMethod) | How to upload the file. Options: 二进制数据 (binary) - upload from binary data in input; 文件路径 (filePath) - upload from a local file path. |
| 二进制属性名 (binaryPropertyName) | The name of the binary property containing the file data when uploading via binary data. Default is "data". Required if upload method is binary. |
| 文件路径 (filePath) | The local file path of the file to upload. Required if upload method is file path. |
| 文件名 (fileName) | The name to assign to the uploaded file. Optional when uploading via file path. |
Output
The node outputs an array of JSON objects, each representing the result of an attempted file upload. Each object contains:
success: Boolean indicating whether the upload succeeded.fileName: The name of the uploaded file.fileType: The type of the uploaded file (image, voice, video, file).- Additional fields returned by the WeCom API on success, including identifiers like
media_id. - On failure, an
errorfield with details about the failure message or response.
The output does not include binary data but provides metadata and status for each upload attempt.
Dependencies
- Requires an API key credential configured with a valid Enterprise WeChat webhook URL.
- Uses the
axioslibrary for HTTP requests. - Uses
form-datato construct multipart/form-data payloads. - Uses Node.js
fsandpathmodules to handle file streams and paths.
Troubleshooting
- No binary data found in input: Occurs if the selected upload method is binary but the input item lacks binary data or the specified binary property name is incorrect. Ensure the input contains binary data under the correct property.
- File not found: When uploading via file path, if the specified local file path does not exist, the node throws an error. Verify the file path is correct and accessible.
- Upload failed with error message from WeCom: If the WeCom API returns an error code, the node surfaces the error message. Check the webhook URL and permissions.
- Invalid webhook URL or missing API key: The node requires a valid webhook URL credential. Make sure the credential is properly set up and has the necessary permissions.