Wechat Work Node icon

Wechat Work Node

Wechat Work Node

Overview

This node enables sending various types of messages through a corporate WeChat Work application. It supports multiple message formats such as text, images, voice, video, files, cards, markdown, mini-program notifications, and template cards. The node is useful for automating internal communications within an enterprise, broadcasting announcements, or delivering rich content to targeted users, departments, or tags.

Practical examples include:

  • Sending a text alert to specific employees about an upcoming meeting.
  • Distributing marketing materials as image or video messages to a department.
  • Delivering interactive cards with links to resources or forms.
  • Notifying users via mini-program notifications or template cards for workflow approvals.

Properties

Name Meaning
*消息类型 (msgtype) Type of the message to send. Options: 文本消息 (text), 图片消息 (image), 语音消息 (voice), 视频消息 (video), 文件消息 (file), 文本卡片消息 (textcard), 图文消息 (news), 图文消息(MPNEWS)(mpnews), MARKDOWN消息 (markdown), 小程序通知消息 (miniprogram_notice), 模板卡片消息 (template_card)
*企业应用的ID (agentid) ID of the corporate application sending the message. Found in the app's settings page.
指定接收消息的成员 (touser) List of user IDs to receive the message, separated by '
指定接收消息的部门 (toparty) List of department IDs to receive the message, separated by '
指定接收消息的标签 (totag) List of tag IDs to receive the message, separated by '
*消息内容 (content) Content of a text message (max 2048 bytes). Supports ID translation. Required when msgtype is "text".
*图片媒体文件ID (media_id) Media file ID for image messages. Obtained from uploading temporary media. Required when msgtype is "image".
*语音文件ID (media_id) Media file ID for voice messages. Obtained from uploading temporary media. Required when msgtype is "voice".
*视频数据 (video) Collection containing video media ID, title (max 128 bytes), and description (max 512 bytes). Required when msgtype is "video".
*文件ID (media_id) Media file ID for file messages. Obtained from uploading temporary media. Required when msgtype is "file".
*卡片消息 (textcard) Collection with title (max 128 chars), description (max 512 chars), URL (max 2048 bytes, must include http/https), and optional button text (default "详情", max 4 chars). Required when msgtype is "textcard".
*图文消息 (articles) Fixed collection supporting 1 to 8 articles. Each article includes title (max 128 chars), description (max 512 chars), URL (max 2048 bytes), picture URL, and optional mini-program appid and pagepath. Required when msgtype is "news".
*图文消息 (articles) Fixed collection supporting 1 to 8 articles for MPNEWS type. Each article includes title (max 128 chars), thumb_media_id (required), author, content_source_url, content (HTML supported, max ~666 KB), and digest (max 512 bytes). Required when msgtype is "mpnews".
*Markdown内容 (content) Markdown formatted content (max 2048 bytes, UTF-8). Required when msgtype is "markdown".
*小程序数据内容 (miniprogram_notice) JSON object representing mini-program notification data. Required when msgtype is "miniprogram_notice".
*模板卡片数据内容 (template_card) JSON object representing template card data. Required when msgtype is "template_card".
是否是保密消息 (safe) Boolean flag indicating if the message is confidential (cannot be shared and shows watermark).
是否开启ID转译 (enable_id_trans) Boolean flag to enable ID translation in the message content.
是否开启重复消息检查 (enable_duplicate_check) Boolean flag to enable duplicate message checking.
重复消息检查的时间间隔(秒) (duplicate_check_interval) Time interval in seconds for duplicate message checking (max 4 hours).

Output

The node outputs an array of JSON objects representing the response from the WeChat Work API after attempting to send each message. Each output item corresponds to one input item processed. The JSON typically contains status information such as success or error codes and messages.

If the message involves media upload or retrieval, the output may include media identifiers or URLs. The node does not output binary data directly.

Dependencies

  • Requires valid credentials for the WeChat Work API, including a corporate ID and secret to obtain access tokens.
  • Needs network access to the WeChat Work API endpoints.
  • The node depends on n8n's HTTP request helper methods to communicate with the API.
  • Proper configuration of the corporate application in WeChat Work is necessary, including permissions to send messages and upload media.

Troubleshooting

  • Invalid Credentials: Errors related to authentication usually mean the corporate ID or secret is incorrect or expired. Verify credentials and regenerate if needed.
  • Message Sending Failures: Could be due to invalid recipient IDs, exceeding limits (e.g., too many recipients), or unsupported message content. Check the API error message for details.
  • Media Upload Issues: Media IDs must be obtained by uploading media first. Using invalid or expired media IDs will cause errors.
  • Content Length Exceeded: Text, titles, descriptions, and other fields have byte limits. Messages exceeding these limits will be truncated or rejected.
  • Duplicate Message Check: If enabled, sending identical messages within the specified interval may be blocked. Adjust settings accordingly.
  • Network Errors: Ensure stable internet connection and that the WeChat Work API endpoints are reachable.

Links and References

Discussion