微信公众号 icon

微信公众号

微信公众号 API

Overview

This node integrates with the WeChat Official Account API to manage media assets, specifically allowing users to add permanent image materials. It is useful for scenarios where you want to upload and store images permanently on the WeChat server for later use in messages, menus, or other content within the WeChat ecosystem. For example, a marketing team could use this node to upload brand images that will be reused in multiple campaigns without needing to re-upload each time.

Properties

Name Meaning
素材文件字段 (media_data) The name of the input field containing the binary data stream of the image file to upload. This should match the field name from which the image data is read.

Output

The node outputs JSON data representing the response from the WeChat API after uploading the permanent image material. This typically includes identifiers such as the media ID assigned by WeChat, which can be used to reference the uploaded image in subsequent operations.

If the node supports binary data output, it would relate to the uploaded image file stream, but based on the provided code and properties, the main output is JSON metadata about the uploaded asset.

Dependencies

  • Requires an API key credential for authenticating with the WeChat Official Account API.
  • The node depends on the WeChat API endpoint at https://api.weixin.qq.com/cgi-bin/.
  • Proper configuration of the API base URL and authentication credentials in n8n is necessary.

Troubleshooting

  • Common issues:
    • Incorrect or missing API credentials will cause authentication failures.
    • Providing an incorrect field name for the image data (素材文件字段) will result in no file being uploaded.
    • Uploading unsupported file types or exceeding size limits imposed by WeChat may cause errors.
  • Error messages:
    • Authentication errors usually indicate invalid or expired API tokens; refreshing credentials or verifying API keys resolves this.
    • Validation errors related to the media file often require checking the input binary data and ensuring it matches the expected format and size.

Links and References

Discussion