微信公众号 icon

微信公众号

微信公众号 API

Overview

This node integrates with the WeChat Official Account API to send customer service voice messages directly to users. It is designed for scenarios where businesses or service providers want to engage with their customers via voice messages through WeChat’s customer service messaging platform. Typical use cases include sending personalized voice notifications, customer support responses, or audio instructions.

For example, a company could use this node to send a voice message confirming an appointment or providing troubleshooting steps in audio format to a user who contacted them via their WeChat Official Account.

Properties

Name Meaning
接收用户ID The OpenID of the WeChat Official Account user who will receive the voice message.
语音媒体ID The media ID of the voice message to be sent to the user. This references a previously uploaded voice media resource on WeChat.

Output

The node outputs JSON data representing the response from the WeChat API after attempting to send the voice message. This typically includes status information such as success confirmation or error details.

If the operation succeeds, the output JSON confirms that the voice message was sent to the specified user. If it fails, the output contains error codes and messages explaining the failure.

No binary data output is involved in this operation.

Dependencies

  • Requires an active WeChat Official Account with appropriate permissions to send customer service messages.
  • Needs an API authentication token (API key credential) configured in n8n credentials to authorize requests to the WeChat API.
  • The base URL defaults to https://api.weixin.qq.com/cgi-bin/ but can be overridden by credential configuration.

Troubleshooting

  • Common Issues:

    • Invalid or expired API authentication token causing authorization failures.
    • Incorrect or missing OpenID for the target user.
    • Using a voice media ID that does not exist or has expired.
    • Network connectivity issues preventing access to the WeChat API endpoint.
  • Error Messages:

    • Authorization errors indicating invalid credentials: Ensure the API key credential is correctly set up and valid.
    • "Invalid media_id" errors: Verify that the voice media ID corresponds to a valid uploaded voice file on WeChat.
    • User not found or invalid OpenID: Confirm the OpenID is correct and the user has interacted with the Official Account.

Resolving these usually involves checking credentials, verifying input parameters, and ensuring media resources are properly uploaded and available.

Links and References

Discussion