微信公众号 icon

微信公众号

微信公众号 API

Overview

This node integrates with the WeChat Official Account API to manage media assets, specifically allowing users to upload temporary media files. It supports uploading different types of media such as images, videos, voice recordings, and news articles as temporary materials. This functionality is useful for scenarios where you need to quickly upload media content to WeChat for use in messages or posts without permanently storing them on the server.

Practical examples include:

  • Uploading a promotional image or video temporarily to be used in a marketing campaign.
  • Sending voice messages or audio clips as part of customer service interactions.
  • Uploading news-type media content temporarily for broadcast.

Properties

Name Meaning
素材类型 (media_type) The type of temporary media to upload. Options: 图片 (image), 视频 (video), 语音 (voice), 图文 (news).
素材文件字段 (media_data) The name of the input field that contains the media file stream to upload. Default is "data".

Output

The node outputs JSON data representing the response from the WeChat API after uploading the temporary media. This typically includes information such as the media ID assigned by WeChat, the type of media uploaded, and the expiration time of the temporary media.

If the node supports binary data output (e.g., returning the uploaded file or related binary content), it would represent the media file itself, but based on the provided code and properties, the main output is JSON metadata about the uploaded media.

Dependencies

  • Requires an API key credential for authenticating with the WeChat Official Account API.
  • The base URL defaults to https://api.weixin.qq.com/cgi-bin/ unless overridden by credentials.
  • The node expects the media file stream to be provided in the specified input field (media_data).

Troubleshooting

  • Common issues:
    • Incorrect media type selected may cause the API to reject the upload.
    • Providing an invalid or empty media file stream will result in errors.
    • Expired or invalid API credentials will prevent successful authentication.
  • Error messages:
    • Authentication errors indicating invalid API keys require checking and updating credentials.
    • Media format or size errors suggest verifying the file meets WeChat's requirements.
    • Network or timeout errors may require retrying or checking connectivity.

Links and References

Discussion