Overview
This node triggers a workflow when a new message is received via the WeChatPadPro service. It listens to various types of incoming messages such as text, images, voice, emojis, videos, or other events from WeChat. The node establishes a WebSocket connection to receive real-time messages and processes them according to user-defined filters.
Common scenarios where this node is beneficial include:
- Automating responses or actions based on specific types of WeChat messages.
- Monitoring group chats with rules to filter messages (e.g., only messages mentioning the bot).
- Processing multimedia messages like images or voice notes by downloading and converting them for further use.
- Integrating WeChat communication into broader automation workflows.
Practical examples:
- Triggering a workflow when a user sends a text message containing a keyword.
- Automatically saving images sent in a group chat to cloud storage.
- Transcribing voice messages received in WeChat for analysis.
- Filtering group chat messages to respond only when the bot is mentioned.
Properties
| Name | Meaning |
|---|---|
| 场景 (scene) | Select the type of message scene to listen for: - 接收文本消息 (text) - 接收图片消息 (image) - 接收语音消息 (voice) - 接收表情消息 (emoji) - 接收视频消息 (video) - 其他事件 (other) |
| 群聊消息接收规则 (groupMessageRule) | Group chat message receiving rule (only shown when scene is "text"): - 接收全部消息 (all) - 接收@机器人消息 (mention) - 不接收消息 (none) |
| 群聊白名单 (groupWhitelist) | List of allowed group chat IDs to receive messages from (multiple values). Only applies when scene is one of text, voice, image, emoji, video and groupMessageRule is "all" or "mention". |
Output
The node outputs an array of JSON objects representing the received messages that match the configured filters. Each message object contains fields such as:
msg_type: Numeric code indicating the message type (text, image, voice, emoji/video).fromUserName: Sender's username or group ID.toUserName: Recipient's username.msgContent: Content of the message. For images and voice messages, this may be base64-encoded data.msgSource: Parsed XML source of the message if available.- Additional fields depending on message type, e.g.,
pcmDataand WAV format base64 for voice messages.
If the message is an image, the node downloads the full image in chunks, concatenates them, and encodes it in base64 before outputting.
For voice messages, the node converts the original audio from SILK format to PCM and WAV base64 formats for easier processing downstream.
Binary data is represented as base64 strings within the JSON output.
Dependencies
- Requires a valid API key credential for the WeChatPadPro service.
- Uses a WebSocket connection to receive messages in real time.
- Depends on external libraries for XML parsing (
xml2js), WebSocket handling (ws), and buffer manipulation. - Audio conversion utilities are bundled internally for transforming SILK audio to PCM and WAV formats.
Troubleshooting
No credentials got returned!
This error occurs if the required API authentication token is missing or invalid. Ensure the node has proper credentials configured.WebSocket connection errors or closures
Network issues or incorrect base URL can cause connection failures. The node attempts automatic reconnection every 5 seconds.Image download failures
If the node cannot retrieve image chunks successfully, check network connectivity and API permissions.Voice conversion errors
Failures during audio decoding or conversion may happen if the input data is corrupted or incomplete.Empty or missing message content
Sometimes the node receives empty data blocks; these are logged as warnings and skipped.
To resolve most issues, verify credentials, network access, and ensure the WeChatPadPro service is operational.
Links and References
- WeChatPadPro API Documentation (replace with actual link if available)
- n8n WebSocket Node Documentation
- XML2JS GitHub Repository
- SILK Audio Codec Information