Wechat Official Account Response icon

Wechat Official Account Response

Wechat Official Account Response

Overview

This node is designed to generate a response for a Wechat Official Account interaction within an n8n workflow. It is typically used after receiving and processing messages or events from Wechat users via a connected trigger node. The node formats the response data either as XML or JSON, optionally encrypts it if configured, and sends it back to Wechat.

Common scenarios include:

  • Responding to user messages with custom content.
  • Sending automated replies or notifications through a Wechat Official Account.
  • Handling encrypted communication with Wechat by generating properly formatted and encrypted responses.

For example, after receiving a message from a user, this node can be used to send a text reply in XML format or a JSON payload depending on the integration requirements.

Properties

Name Meaning
响应数据格式 (dataFormat) The format of the response data to send back. Options: XML or JSON.
响应数据 (content) The actual response content to send. This is a multiline string input. Required. The input field shown depends on the selected data format (XML or JSON).

Output

The node outputs a JSON array containing one object with the following structure:

  • If encryption is enabled (signature type "aes"), the output contains the encrypted response content.
  • Otherwise, it outputs the raw response content under the content key.

Example output JSON structure:

[
  {
    "content": "<response content here>"
  }
]

Additionally, the node sends the response directly to the Wechat server with HTTP status code 200 and appropriate headers. The response body matches the formatted and possibly encrypted content.

Dependencies

  • Requires a connected Wechat Official Account Trigger node upstream in the workflow to function correctly.
  • Uses an external utility module for message signing and encryption.
  • Uses an XML-to-JS conversion library to convert JavaScript objects to XML when needed.
  • Relies on static workflow data containing configuration such as token, AES key, app ID, and signature type for encryption.

Troubleshooting

  • Error: No connected Wechat Official Account Trigger node found
    This error occurs if the node is not connected to a valid Wechat Official Account Trigger node. Ensure that your workflow includes such a trigger node before this response node.

  • Error: No workflow data found
    Indicates missing static workflow data required for encryption or configuration. Verify that the workflow has been properly initialized and configured with necessary credentials and keys.

  • Incorrect response format or encryption issues
    Make sure the 响应数据格式 property matches the expected format by Wechat (XML or JSON). If encryption is enabled, verify that the token, AES key, and app ID are correctly set in the workflow static data.

Links and References

Discussion