Overview
This node acts as a trigger for workflows based on events sent from a Wechat Official Account server. It listens for Server-Sent Events (SSE) via HTTP webhooks and triggers the workflow when messages or events are received from Wechat's platform. The node supports verifying message signatures to ensure authenticity and can handle different message encryption modes, including plaintext, compatible, and AES-encrypted messages.
Common scenarios where this node is beneficial include:
- Automating responses or actions when users interact with a Wechat Official Account.
- Processing incoming messages or events such as user subscriptions, clicks, or text messages.
- Integrating Wechat Official Account events into broader automation workflows without manual polling.
Practical example:
- When a user sends a message to your Wechat Official Account, this node triggers the workflow, which could then analyze the message content and send an automated reply or log the interaction.
Properties
| Name | Meaning |
|---|---|
| Token | A secret token used to verify the signature of incoming requests to ensure they come from Wechat. This is required for security. |
| 消息加密方式 (signatureType) | The message encryption mode used by Wechat: - 明文模式 (plaintext): No encryption. - 兼容模式 (compatible): Compatible mode. - 安全模式 (aes): Secure AES encryption mode. |
| EncodingAESKey | The AES key used to decrypt messages when the encryption mode is set to "安全模式" (aes). Required only in AES mode. |
Output
The node outputs a JSON array containing one object per webhook event. Each object has the following structure:
{
"query": { /* The query parameters received in the webhook request, including signature, timestamp, nonce, etc. */ },
"body": { /* The parsed body of the webhook request, including decrypted XML data if applicable */ }
}
query: Contains the raw query parameters sent by Wechat, useful for debugging or further processing.body: Contains the message payload. If the message was encrypted, it will be decrypted and parsed here, exposing the original XML fields as JSON.
No binary data output is produced by this node.
Dependencies
- Requires an API authentication token ("Token") configured in the node properties to validate incoming requests.
- Uses internal utility functions for signature verification and message decryption.
- Must be configured with a webhook URL accessible by Wechat servers to receive events.
- If using AES encryption mode, the correct EncodingAESKey must be provided.
Troubleshooting
- Invalid signature errors: Occur if the token does not match or the signature parameters are missing or incorrect. Ensure the token matches the one configured in the Wechat Official Account settings and that all required query parameters (
signature,timestamp,nonce) are present. - Missing aesKey error: When using AES encryption mode, the EncodingAESKey must be provided; otherwise, the node throws an error.
- Decrypt Msg Error: Indicates failure during message decryption, possibly due to an incorrect AES key or corrupted message payload.
- Webhook not triggering: Verify that the webhook URL is correctly set in the Wechat Official Account platform and publicly accessible.
- Empty or malformed messages: Check that Wechat is sending valid XML payloads and that the node’s webhook path matches the configured endpoint.