Overview
This node sends various types of messages to an enterprise WeChat group via a webhook URL. It supports sending text, markdown, image, news (rich media with title, description, link, and picture), and file messages. The node is useful for automating notifications, alerts, or updates directly into WeChat groups used by teams or organizations.
Common scenarios include:
- Sending alert messages from monitoring systems.
- Broadcasting announcements or reports in markdown format.
- Sharing images or files relevant to team collaboration.
- Posting rich news-style messages with clickable links.
Properties
Name | Meaning |
---|---|
消息类型 (msgType) | Type of message to send. Options: 文本 (text), Markdown, 图片 (image), 图文 (news), 文件 (file). |
内容 (content) | Text content of the message (required if msgType is text). |
@用户 (mentionUsers) | Whether to mention specific users in the group (only for text messages). |
@所有人 (mentionAll) | Whether to mention all users in the group (only for text messages and if mentionUsers is true). |
用户ID列表 (mentionedList) | Comma-separated list of user IDs to mention (only for text messages when mentionUsers is true and mentionAll is false). |
手机号列表 (mentionedMobileList) | Comma-separated list of mobile numbers to mention (same conditions as 用户ID列表). |
Markdown内容 (markdownContent) | Content of the markdown message (required if msgType is markdown). |
图片数据 (imageData) | Base64 encoded image data (required if msgType is image). |
标题 (title) | Title of the news message (required if msgType is news). |
描述 (description) | Description of the news message (optional, only for news). |
跳转链接 (url) | URL to open when clicking the news message (required if msgType is news). |
图片链接 (picUrl) | Image URL for the news message (optional, only for news). |
文件ID (mediaId) | Media ID of the file uploaded via WeChat API (required if msgType is file). |
Output
The node outputs an array of JSON objects, each representing the result of sending a message for each input item. Each object contains:
success
: Boolean indicating whether the message was sent successfully (true
if error code is 0).- Additional fields returned by the WeChat API response, such as error codes and messages.
- In case of failure, an
error
field with details about the failure.
No binary data output is produced by this node.
Dependencies
- Requires an API key credential configured with the WeChat Work webhook URL.
- Uses the axios HTTP client library to send POST requests to the webhook endpoint.
- Requires Node.js crypto module for generating MD5 hash of image data.
Troubleshooting
- Invalid webhook URL or credentials: If the webhook URL is incorrect or missing, the node will fail to send messages. Ensure the webhook URL is correctly set in the credentials.
- Message format errors: Providing incomplete or invalid parameters for the selected message type (e.g., missing required fields like
content
for text ormediaId
for file) will cause errors. Double-check required properties based on the message type. - API rate limits or network issues: Network failures or API rate limiting may cause request failures. Retry or check network connectivity.
- Error responses from WeChat API: The node returns error details from the API in the output. Common errors include invalid media IDs or unsupported message formats.