Home  >  Article  >  WeChat Applet  >  WeChat develops interfaces and parameters for receiving voice messages

WeChat develops interfaces and parameters for receiving voice messages

Y2J
Y2JOriginal
2017-05-18 13:17:593399browse

Receive ordinary messages

When an ordinary WeChat user sends a message to a public account, the WeChat server will POST the XML data packet of the message to the URL filled in by the developer superior.

Please note:

1. Regarding retry message duplication, it is recommended to use msgid to deduplicate messages.

2. If the WeChat server does not receive a response within five seconds, it will disconnect and re-initiate the request, retrying three times in total. If the server cannot guarantee to process and reply within five seconds,

can directly reply with an empty string. The WeChat server will not do anything with this and will not initiate a retry. For details, please see "Send Message-Passive Reply to Message".

3. If the developer needs to respond immediately to the user message within 5 seconds, that is, use the "Send Message-Passive Reply Message" interface to passively respond to the user When replying to a message, you can set message encryption in the Developer Center of the official website of the

public platform. After encryption is turned on, messages sent by users and messages replied by developers will be encrypted (but developers send them to users through customer service

interfaces and other API calls) messages are not affected). For detailed instructions on message encryption and decryption, please see "Sending Messages - Passive Reply Message Encryption and Decryption Instructions".


Voice message

<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1357290913</CreateTime>
<MsgType><![CDATA[voice]]></MsgType>
<MediaId><![CDATA[media_id]]></MediaId>
<Format><![CDATA[Format]]></Format>
<MsgId>1234567890123456</MsgId>
</xml>

WeChat develops interfaces and parameters for receiving voice messages

Please note , after enabling speech recognition, every time a user sends a voice message to an official account, WeChat will add a Recongnition field to the pushed voice message XML packet (Note: Due to client caching, developers enable or disable the speech recognition function, which is It will take effect immediately for new followers, and it will take 24 hours for already followed users. Developers can re-follow this account for testing). The voice XML data packet after enabling speech recognition is as follows:

<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1357290913</CreateTime>
<MsgType><![CDATA[voice]]></MsgType>
<MediaId><![CDATA[media_id]]></MediaId>
<Format><![CDATA[Format]]></Format>
<Recognition><![CDATA[腾讯微信团队]]></Recognition>
<MsgId>1234567890123456</MsgId>
</xml>

Parameter description:

WeChat develops interfaces and parameters for receiving voice messages

##[Related recommendations]

1.

微信官方平台Source code download

2.

Xiaozhu CMS Life Tong O2O system v2.0 exclusive version download

3.

小Pigcms (pigcms) WeChat Marketing System V8.52 Pinhaohao Mall Second Development Special Edition

The above is the detailed content of WeChat develops interfaces and parameters for receiving voice messages. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn