消息回调内容
<p>[TOC]</p>
<h5>简要描述</h5>
<ul>
<li>接收实时消息, 本接口需自行搭建。用来接收微信实时消息。
<h5>请求URL</h5></li>
<li><code>自行搭建地址</code></li>
</ul>
<h5>请求方式</h5>
<ul>
<li>POST </li>
</ul>
<h5>发送参数 当https://www.showdoc.com.cn/laolinrobot/11249253831997000 接口传递参数为2 时</h5>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;wxid_123456&quot;,
&quot;sendorrecv&quot;:&quot;2&quot;,
&quot;pb_data&quot;:&quot;0A058C6EA223445F1C...&quot;,
}
</code></pre>
<h5>发送参数 当https://www.showdoc.com.cn/laolinrobot/11249253831997000 接口传递参数为1 时</h5>
<h1>PC端 发送的消息</h1>
<p><strong>PC发出文本消息</strong>
第一次 发送的内容</p>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;1&quot;,
&quot;msgnumber&quot;:&quot;1&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2023-03-05 13:07:54&quot;,
&quot;msgtype&quot;:&quot;1&quot;,
&quot;msgsvrid&quot;:&quot;&quot;,
&quot;msg&quot;:&quot;大佬666~&quot;,
&quot;fromwxid&quot;:&quot;themid&quot;,
&quot;toid&quot;:&quot;filehelper&quot;
}]
}
</code></pre>
<p>第二次 发送成功后 收到 服务器返回的消息ID (msgid)</p>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;2&quot;,
&quot;msgnumber&quot;:&quot;1&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2023-03-05 13:07:54&quot;,
&quot;msgtype&quot;:&quot;1&quot;,
&quot;msgsvrid&quot;:&quot;7029814402633277009&quot;,
&quot;msg&quot;:&quot;PC发文本消息成功&quot;,
&quot;fromwxid&quot;:&quot;themid&quot;,
&quot;toid&quot;:&quot;filehelper&quot;
}]
}</code></pre>
<p><strong>PC发出图片消息</strong>
第一次 发送的内容</p>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;1&quot;,
&quot;msgnumber&quot;:&quot;0&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2023-03-05 13:09:19&quot;,
&quot;msgtype&quot;:&quot;3&quot;,
&quot;msgsvrid&quot;:&quot;&quot;,
&quot;msg&quot;:&quot;8bb306d0ad78a2aa8cafe229dc304f38&quot;,
&quot;fromwxid&quot;:&quot;themid&quot;,
&quot;toid&quot;:&quot;filehelper&quot;,
&quot;img_path&quot;:&quot;C:\\\\Users\\\\Administrator\\\\Documents\\\\WeChat Files\\\\thexed\\\\FileStorage\\\\Temp\\\\1677992958058.jpg&quot;
}]
}
</code></pre>
<p>第二次 发送成功后 收到 服务器返回的消息ID (msgid)</p>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;2&quot;,
&quot;msgnumber&quot;:&quot;1&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2023-03-05 13:09:20&quot;,
&quot;msgtype&quot;:&quot;3&quot;,
&quot;msgsvrid&quot;:&quot;8676825236427018921&quot;,
&quot;msg&quot;:&quot;PC发图片消息成功&quot;,
&quot;fromwxid&quot;:&quot;themid&quot;,
&quot;toid&quot;:&quot;filehelper&quot;
}]
}
</code></pre>
<p><strong>PC发出文件/app消息</strong>
第一次 发送的内容</p>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;1&quot;,
&quot;msgnumber&quot;:&quot;0&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2023-03-05 13:11:27&quot;,
&quot;msgtype&quot;:&quot;49&quot;,
&quot;msgsvrid&quot;:&quot;&quot;,
&quot;msg&quot;:&quot;version.dll&quot;,
&quot;fromwxid&quot;:&quot;themid&quot;,
&quot;toid&quot;:&quot;filehelper&quot;,
&quot;file_path&quot;:&quot;C:\\\\Users\\\\Administrator\\\\Desktop\\\\version.dll&quot;
}]
}</code></pre>
<p>第二次 发送成功后 收到 服务器返回的消息ID (msgid)</p>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;2&quot;,
&quot;msgnumber&quot;:&quot;1&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2023-03-05 13:11:30&quot;,
&quot;msgtype&quot;:&quot;99&quot;,
&quot;msgsvrid&quot;:&quot;476728224034532762&quot;,
&quot;msg&quot;:&quot;PC发app/文件消息成功&quot;,
&quot;fromwxid&quot;:&quot;themid&quot;,
&quot;toid&quot;:&quot;filehelper&quot;
}]
}
</code></pre>
<p><strong>PC发出视频消息</strong>
第一次 发送的内容</p>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;1&quot;,
&quot;msgnumber&quot;:&quot;0&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2023-03-05 13:14:07&quot;,
&quot;msgtype&quot;:&quot;4&quot;,
&quot;msgsvrid&quot;:&quot;&quot;,
&quot;msg&quot;:&quot;3057020100044b30490201000204911740bc02032f77f50204ab5b90db02046404251f042438373463386566632d396161312d346263642d383838392d3335613736613865396634610204011400030201000405004c550500&quot;,
&quot;fromwxid&quot;:&quot;themid&quot;,
&quot;toid&quot;:&quot;filehelper&quot;,
&quot;video_path&quot;:&quot;C:\\\\Windows\\\\SystemApps\\\\Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy\\\\media\\\\oobe-intro.mp4&quot;
}]
}
</code></pre>
<p>第二次 发送成功后 收到 服务器返回的消息ID (msgid)</p>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;2&quot;,
&quot;msgnumber&quot;:&quot;1&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2023-03-05 13:14:11&quot;,
&quot;msgtype&quot;:&quot;36&quot;,
&quot;msgsvrid&quot;:&quot;3847230082234559699&quot;,
&quot;msg&quot;:&quot;PC发视频文件成功&quot;,
&quot;fromwxid&quot;:&quot;themid&quot;,
&quot;toid&quot;:&quot;&quot;
}]
}</code></pre>
<h1>PC端 收到的消息(文字)</h1>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;2&quot;,
&quot;msgnumber&quot;:&quot;1&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2023-03-14 11:18:07&quot;,
&quot;msgtype&quot;:&quot;1&quot;,
&quot;msgsvrid&quot;:&quot;2936072064472736442&quot;,
&quot;msg&quot;:&quot;wxid_kqi...:\n111&quot;,
&quot;fromtype&quot;:&quot;2&quot;,
&quot;fromgid&quot;:&quot;438191..@chatroom&quot;,
&quot;toid&quot;:&quot;themid&quot;
}]
}
{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;2&quot;,
&quot;msgnumber&quot;:&quot;1&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2023-03-14 11:18:07&quot;,
&quot;msgtype&quot;:&quot;1&quot;,
&quot;msgsvrid&quot;:&quot;13430535177462202152&quot;,
&quot;msg&quot;:&quot;111&quot;,
&quot;fromtype&quot;:&quot;2&quot;,
&quot;fromgid&quot;:&quot;438..@chatroom&quot;,
&quot;fromid&quot;:&quot;wxid_k..&quot;,
&quot;toid&quot;:&quot;themid&quot;
}]
}</code></pre>
<h1>PC端 收到的消息(图片)</h1>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;2&quot;,
&quot;msgnumber&quot;:&quot;2&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2023-03-05 13:25:47&quot;,
&quot;msgtype&quot;:&quot;51&quot;,
&quot;msgsvrid&quot;:&quot;6229442408328493980&quot;,
&quot;msg&quot;:&quot;&lt;msg&gt;\n&lt;op id='1'&gt;\n&lt;username&gt;wxid_kq...&lt;/username&gt;\n&lt;name&gt;lastMessage&lt;/name&gt;\n&lt;arg&gt;{\&quot;messageSvrId\&quot;:\&quot;0\&quot;,\&quot;MsgCreateTime\&quot;:\&quot;1677993947\&quot;}&lt;/arg&gt;\n&lt;/op&gt;\n&lt;/msg&gt;&quot;,
&quot;fromwxid&quot;:&quot;themid&quot;,
&quot;toid&quot;:&quot;wxid_kq...&quot;
},{
&quot;index&quot;:&quot;2&quot;,
&quot;time&quot;:&quot;2023-03-05 13:25:47&quot;,
&quot;msgtype&quot;:&quot;3&quot;,
&quot;msgsvrid&quot;:&quot;1205604146658880283&quot;,
&quot;msg&quot;:&quot;&lt;?xml version=\&quot;1.0\&quot;?&gt;\n&lt;msg&gt;\n\t&lt;img aeskey=\&quot;7c2724b850f88a..f40631abe\&quot; encryver=\&quot;1\&quot; cdnthumbaeskey=\&quot;7c2...f40631abe\&quot; cdnthumburl=\&quot;3057020..4640427db042461656539336534642d376661302d343136312d3..3738313836020401150a020201000405004c4f2900\&quot; cdnthumblength=\&quot;1994\&quot; cdnthumbheight=\&quot;120\&quot; cdnthumbwidth=\&quot;67\&quot; cdnmidheight=\&quot;0\&quot; cdnmidwidth=\&quot;0\&quot; cdnhdheight=\&quot;0\&quot; cdnhdwidth=\&quot;0\&quot; cdnmidimgurl=\&quot;3057020100..0a0202c4f2900\&quot; length=\&quot;273129\&quot; md5=\&quot;67025..90cc261\&quot; hevc_mid_size=\&quot;273129\&quot; /&gt;\n\t&lt;platform_signature&gt;&lt;/platform_signature&gt;\n\t&lt;imgdatahash&gt;&lt;/imgdatahash&gt;\n&lt;/msg&gt;\n&quot;,
&quot;img_path&quot;:&quot;C:\\Users\\Administrator\\Documents\\WeChat Files\\themid\\FileStorage\\MsgAttach\\81a7f2695cd..599f\\Image\\2023-03\\e0f480bb..bfdd1e634.dat&quot;,
&quot;fromwxid&quot;:&quot;themid&quot;,
&quot;toid&quot;:&quot;wxid_kq..&quot;
}]
}
{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;2&quot;,
&quot;msgsvrid&quot;:&quot;1957754625548008208&quot;,
&quot;img_path&quot;:&quot;C:\\Users\\Administrator\\Documents\\WeChat Files\\themid\\FileStorage\\MsgAttach\\81a7..599f\\Image\\2023-03\\ba649..df2.dat&quot;,
&quot;time&quot;:&quot;2023-03-05 13:25:47&quot;,
&quot;msg&quot;:&quot;&lt;?xml version=\&quot;1.0\&quot;?&gt;\n&lt;msg&gt;\n\t&lt;img aeskey=\&quot;7c2724b..1abe\&quot; encryver=\&quot;1\&quot; cdnthumbaeskey=\&quot;7c272..abe\&quot; cdnthumburl=\&quot;3057020..c4f2900\&quot; cdnthumblength=\&quot;1994\&quot; cdnthumbheight=\&quot;120\&quot; cdnthumbwidth=\&quot;67\&quot; cdnmidheight=\&quot;0\&quot; cdnmidwidth=\&quot;0\&quot; cdnhdheight=\&quot;0\&quot; cdnhdwidth=\&quot;0\&quot; cdnmidimgurl=\&quot;3057020..2900\&quot; length=\&quot;273129\&quot; md5=\&quot;67..c261\&quot; hevc_mid_size=\&quot;273129\&quot; /&gt;\n\t&lt;platform_signature&gt;&lt;/platform_signature&gt;\n\t&lt;imgdatahash&gt;&lt;/imgdatahash&gt;\n&lt;/msg&gt;\n&quot;
}
</code></pre>
<h1>PC端 收到的消息(GIF动图)</h1>
<pre><code>
{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;2&quot;,
&quot;msgnumber&quot;:&quot;1&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2022-12-22 18:15:08&quot;,
&quot;msgtype&quot;:&quot;47&quot;,
&quot;msgsvrid&quot;:&quot;9168432254856816012&quot;,
&quot;msg&quot;:&quot;&lt;msg&gt;&lt;emoji fromusername = \&quot;thekid\&quot; tousername = \&quot;themid\&quot; type=\&quot;2\&quot; idbuffer=\&quot;media:0_0\&quot; md5=\&quot;97365663bee2eb41ea0b3ad50cbe9dd2\&quot; len = \&quot;439919\&quot; productid=\&quot;\&quot; androidmd5=\&quot;97365663bee2eb41ea0b3ad50cbe9dd2\&quot; androidlen=\&quot;439919\&quot; s60v3md5 = \&quot;97365663bee2eb41ea0b3ad50cbe9dd2\&quot; s60v3len=\&quot;439919\&quot; s60v5md5 = \&quot;97365663bee2eb41ea0b3ad50cbe9dd2\&quot; s60v5len=\&quot;439919\&quot; cdnurl = \&quot;http://vweixinf.tc.qq.com/110/20401/stodownload?m=97365663bee2eb41ea0b3ad50cbe9dd2&amp;filekey=30440201010430302e02016e0402535a04203937333635363633626565326562343165613062336164353063626539646432020306b66f040d00000004627466730000000131&amp;hy=SZ&amp;storeid=323032313035303731393134333530303033653932336261623532663833353335383538303930303030303036653031303034666231&amp;ef=1&amp;bizid=1022\&quot; designerid = \&quot;\&quot; thumburl = \&quot;\&quot; encrypturl = \&quot;http://vweixinf.tc.qq.com/110/20402/stodownload?m=ea1bd1936ce3281e92a72ed45653a768&amp;filekey=30440201010430302e02016e0402535a04206561316264313933366365333238316539326137326564343536353361373638020306b670040d00000004627466730000000131&amp;hy=SZ&amp;storeid=323032313035303731393134333530303034376139626261623532663833353335383538303930303030303036653032303034666232&amp;ef=2&amp;bizid=1022\&quot; aeskey= \&quot;658d8cd15a6d4573990cd63ebb0d4e70\&quot; externurl = \&quot;http://vweixinf.tc.qq.com/110/20403/stodownload?m=bf191d0d4bc5d7de00a08b16960c3c74&amp;filekey=30440201010430302e02016e0402535a0420626631393164306434626335643764653030613038623136393630633363373402030422c0040d00000004627466730000000131&amp;hy=SZ&amp;storeid=323032313035303731393134333530303036353639326261623532663833353335383538303930303030303036653033303034666233&amp;ef=3&amp;bizid=1022\&quot; externmd5 = \&quot;870b23321c54bce14f843a037a746989\&quot; width= \&quot;512\&quot; height= \&quot;512\&quot; tpurl= \&quot;\&quot; tpauthkey= \&quot;\&quot; attachedtext= \&quot;\&quot; attachedtextcolor= \&quot;\&quot; lensid= \&quot;\&quot; emojiattr= \&quot;\&quot; linkid= \&quot;\&quot; desc= \&quot;\&quot; &gt;&lt;/emoji&gt; &lt;gameext type=\&quot;0\&quot; content=\&quot;0\&quot; &gt;&lt;/gameext&gt;&lt;/msg&gt;&quot;,
&quot;gif_url&quot;:&quot;http://vweixinf.tc.qq.com/110/20401/stodownload?m=97365663bee2eb41ea0b3ad50cbe9dd2&amp;filekey=30440201010430302e02016e0402535a04203937333635363633626565326562343165613062336164353063626539646432020306b66f040d00000004627466730000000131&amp;hy=SZ&amp;storeid=323032313035303731393134333530303033653932336261623532663833353335383538303930303030303036653031303034666231&amp;ef=1&amp;bizid=1022&quot;,
&quot;fromwxid&quot;:&quot;thekid&quot;,
&quot;toid&quot;:&quot;themid&quot;,
&quot;tonickname&quot;:&quot;&quot;,
&quot;toname&quot;:&quot;&quot;,
&quot;tohead&quot;:&quot;&quot;
}]
}</code></pre>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;2&quot;,
&quot;msgsvrid&quot;:&quot;10116766129219189887&quot;,
&quot;gif_url&quot;:&quot;http://vweixinf.tc.qq.com/110/20401/stodownload?m=97365663bee2eb41ea0b3ad50cbe9dd2&amp;filekey=30440201010430302e02016e0402535a04203937333635363633626565326562343165613062336164353063626539646432020306b66f040d00000004627466730000000131&amp;hy=SZ&amp;storeid=323032313035303731393134333530303033653932336261623532663833353335383538303930303030303036653031303034666231&amp;ef=1&amp;bizid=1022&quot;,
&quot;time&quot;:&quot;2022-12-22 18:15:08&quot;,
&quot;msg&quot;:&quot;&lt;msg&gt;&lt;emoji fromusername = \&quot;thekid\&quot; tousername = \&quot;themid\&quot; type=\&quot;2\&quot; idbuffer=\&quot;media:0_0\&quot; md5=\&quot;97365663bee2eb41ea0b3ad50cbe9dd2\&quot; len = \&quot;439919\&quot; productid=\&quot;\&quot; androidmd5=\&quot;97365663bee2eb41ea0b3ad50cbe9dd2\&quot; androidlen=\&quot;439919\&quot; s60v3md5 = \&quot;97365663bee2eb41ea0b3ad50cbe9dd2\&quot; s60v3len=\&quot;439919\&quot; s60v5md5 = \&quot;97365663bee2eb41ea0b3ad50cbe9dd2\&quot; s60v5len=\&quot;439919\&quot; cdnurl = \&quot;http://vweixinf.tc.qq.com/110/20401/stodownload?m=97365663bee2eb41ea0b3ad50cbe9dd2&amp;filekey=30440201010430302e02016e0402535a04203937333635363633626565326562343165613062336164353063626539646432020306b66f040d00000004627466730000000131&amp;hy=SZ&amp;storeid=323032313035303731393134333530303033653932336261623532663833353335383538303930303030303036653031303034666231&amp;ef=1&amp;bizid=1022\&quot; designerid = \&quot;\&quot; thumburl = \&quot;\&quot; encrypturl = \&quot;http://vweixinf.tc.qq.com/110/20402/stodownload?m=ea1bd1936ce3281e92a72ed45653a768&amp;filekey=30440201010430302e02016e0402535a04206561316264313933366365333238316539326137326564343536353361373638020306b670040d00000004627466730000000131&amp;hy=SZ&amp;storeid=323032313035303731393134333530303034376139626261623532663833353335383538303930303030303036653032303034666232&amp;ef=2&amp;bizid=1022\&quot; aeskey= \&quot;658d8cd15a6d4573990cd63ebb0d4e70\&quot; externurl = \&quot;http://vweixinf.tc.qq.com/110/20403/stodownload?m=bf191d0d4bc5d7de00a08b16960c3c74&amp;filekey=30440201010430302e02016e0402535a0420626631393164306434626335643764653030613038623136393630633363373402030422c0040d00000004627466730000000131&amp;hy=SZ&amp;storeid=323032313035303731393134333530303036353639326261623532663833353335383538303930303030303036653033303034666233&amp;ef=3&amp;bizid=1022\&quot; externmd5 = \&quot;870b23321c54bce14f843a037a746989\&quot; width= \&quot;512\&quot; height= \&quot;512\&quot; tpurl= \&quot;\&quot; tpauthkey= \&quot;\&quot; attachedtext= \&quot;\&quot; attachedtextcolor= \&quot;\&quot; lensid= \&quot;\&quot; emojiattr= \&quot;\&quot; linkid= \&quot;\&quot; desc= \&quot;\&quot; &gt;&lt;/emoji&gt; &lt;gameext type=\&quot;0\&quot; content=\&quot;0\&quot; &gt;&lt;/gameext&gt;&lt;/msg&gt;&quot;
}</code></pre>
<h1>PC端 收到的消息(语音消息)</h1>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;themid&quot;,
&quot;sendorrecv&quot;:&quot;2&quot;,
&quot;msgnumber&quot;:&quot;1&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2023-03-05 13:19:05&quot;,
&quot;msgtype&quot;:&quot;34&quot;,
&quot;msgsvrid&quot;:&quot;3921037281184911662&quot;,
&quot;msg&quot;:&quot;&lt;msg&gt;&lt;voicemsg endflag=\&quot;1\&quot; cancelflag=\&quot;0\&quot; forwardflag=\&quot;0\&quot; voiceformat=\&quot;4\&quot; voicelength=\&quot;1980\&quot; length=\&quot;2972\&quot; bufid=\&quot;0\&quot; aeskey=\&quot;18987a920fd...ae5b2b6a245\&quot; voiceurl=\&quot;305202010004...4000f0201000400\&quot; voicemd5=\&quot;\&quot; clientmsgid=\&quot;49026462e24bee876...3cb70cthemid_19_1677993542\&quot; fromusername=\&quot;wxid_kqi...\&quot; /&gt;&lt;/msg&gt;&quot;,
&quot;voip_data&quot;:&quot;02232153494C4B5F56331200A738B8AACFF7B149A2093860..&quot;,
&quot;fromwxid&quot;:&quot;wxid_kqi..2&quot;,
&quot;toid&quot;:&quot;themid&quot;
}]
}
</code></pre>
<h1>PC端 拉人进群通知</h1>
<pre><code>{
&quot;ServerPort&quot;:&quot;30001&quot;,
&quot;selfwxid&quot;:&quot;wxid_kqis...&quot;,
&quot;sendorrecv&quot;:&quot;2&quot;,
&quot;msgnumber&quot;:&quot;1&quot;,
&quot;msglist&quot;:[{
&quot;index&quot;:&quot;1&quot;,
&quot;time&quot;:&quot;2023-01-09 17:23:26&quot;,
&quot;msgtype&quot;:&quot;20001&quot;,
&quot;msg&quot;:&quot;Everything is OK&quot;,
&quot;gid&quot;:&quot;43202784070@chatroom&quot;
}]
}</code></pre>
<h5>参数说明</h5>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">ServerPort</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>发送消息的端口默认30001,如果是30002则代表第二个微信</td>
</tr>
<tr>
<td style="text-align: left;">selfwxid</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>本人微信ID</td>
</tr>
<tr>
<td style="text-align: left;">sendorrecv</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>1=收到的消息2=发送的消息</td>
</tr>
<tr>
<td style="text-align: left;">msgnumber</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>本次收到/发送的消息数量</td>
</tr>
<tr>
<td style="text-align: left;">businesstype</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>业务类型代码</td>
</tr>
<tr>
<td style="text-align: left;">businessdata</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>业务数据(16进制protobuf文本)</td>
</tr>
<tr>
<td style="text-align: left;">time</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>收到消息的时间</td>
</tr>
<tr>
<td style="text-align: left;">msgtype</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>消息类型代码</td>
</tr>
<tr>
<td style="text-align: left;">device</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>设备代码 手机=1 其他=0</td>
</tr>
<tr>
<td style="text-align: left;">fromtype</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>个人消息 = 1 群消息=2</td>
</tr>
<tr>
<td style="text-align: left;">fromwxid</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>发送方微信ID</td>
</tr>
<tr>
<td style="text-align: left;">toid</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>接收人微信ID/群ID</td>
</tr>
<tr>
<td style="text-align: left;">msg</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>消息内容</td>
</tr>
<tr>
<td style="text-align: left;">msgsvrid</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>服务器消息ID, 用于撤回,或者下载图片/视频/文件</td>
</tr>
<tr>
<td style="text-align: left;">img_path</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>如果当前收到的是图片,则会显示图片路径图片为.dat格式</td>
</tr>
<tr>
<td style="text-align: left;">gif_path</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>如果当前收到的是gif表情,则会显示gif路径</td>
</tr>
<tr>
<td style="text-align: left;">file_path</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>如果当前收到的是文件,则会显示文件路径</td>
</tr>
<tr>
<td style="text-align: left;">video_path</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>如果当前收到的是视频,则会显示视频路径</td>
</tr>
<tr>
<td style="text-align: left;">voip_data</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>如果当前收到的是语音,则会显示语音数据。格式为16进制文本的.silk文件</td>
</tr>
<tr>
<td style="text-align: left;">revoke_msg</td>
<td style="text-align: left;">是</td>
<td>string</td>
<td>如果当前收到的是撤回的消息,则会显示撤回的内容</td>
</tr>
<tr>
<td style="text-align: left;">appletcode</td>
<td style="text-align: left;">否</td>
<td>string</td>
<td>返回小程序code,如果调用了GetMiniAppCode_Sync接口则会返回该数据</td>
</tr>
</tbody>
</table>
<h2>msgtype 消息类型代码 二级代码参考:</h2>
<p>1 文本消息
3 图片消息
34 语音消息
37 好友确认消息
40 好友推荐消息
42 共享名片
43 视频消息
44 主动撤回
47 动画表情
48 位置消息
49 APP分享链接/文件
50 VOIP消息
51 微信初始化消息
52 VOIP结束消息
53 VOIP邀请
62 小视频
9999 SYSNOTICE
10000 系统消息
10002 撤回消息</p>
<p><strong>返回值</strong></p>
<p>返回值将被忽略</p>
<h1>Python FLASK 代码示例</h1>
<pre><code># encoding:utf-8
from flask import Flask, request, jsonify
from flask_cors import CORS
import logging
from flask_httpauth import HTTPTokenAuth
import requests
import json
import binascii
import os
import sys
import logging
import re
from PIL import Image
import blackboxprotobuf
auth = HTTPTokenAuth(scheme='JWT')
app = Flask(__name__)
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
# 开启消息接收功能
def ConfigureMsgRecive(diyurl):
url = &quot;http://127.0.0.1:30001/ConfigureMsgRecive&quot;
aheaders = {'Content-Type': 'application/json'}
params_1 = {
&quot;isEnable&quot;: &quot;1&quot;,
&quot;url&quot;: diyurl
}
data = json.dumps(params_1)
#print('[JSON格式raw]', data)
r = requests.post(url, headers=aheaders, data=data)
ret = r.text
print(ret)
# 自定义URL获取聊天信息
i = 0
@app.route('/api/msg/recive', methods=[&quot;POST&quot;])
def diy_recive_msg():
if request.method == 'POST':
# payload = request.get_data(as_text=True)
# print('[全数据]\r', payload)
# 按照顺序打印输出
# payload = json.dumps(payload, sort_keys=True, indent=2, ensure_ascii=False)
# print('[全数据]\r', payload)
global i
i = i + 1
print('================= [自定义URL消息接收] ====================')
ServerPort = request.json.get('ServerPort')
print('[服务端口]', ServerPort)
selfwxid = request.json.get('selfwxid')
print('[本人微信ID]', selfwxid)
# 1=收到的消息 2=发送的消息
sendorrecv = request.json.get('sendorrecv')
print('[收发类型]', sendorrecv)
# 本次收到消息的数量
msgnumber = request.json.get('msgnumber')
print('[收到数量]', msgnumber)
# 消息数组
msglist = request.json.get('msglist')
for i in range(len(msglist)):
# 消息序号
index =msglist[i]['index']
print('[消息序号]', index)
# 消息时间
time = msglist[i]['time']
print('[消息时间]', time)
# 消息类型
msgtype = msglist[i]['msgtype']
print('[消息类型]', msgtype)
# 服务器消息ID
msgsvrid = msglist[i]['msgsvrid']
print('[服务器消息ID]', msgsvrid)
# 消息内容
msg = msglist[i]['msg']
print('[消息内容]', msg)
# 发送人微信ID
fromwxid = msglist[i]['fromwxid']
print('[发送人微信ID]', fromwxid)
# 接收方微信ID/群ID
toid = msglist[i]['toid']
print('[消息接收者]', toid)
return '1'
else:
# 请求方式错误
return '0'
if __name__ == '__main__':
# 下面的代码是消息接收的部分
app.config['JSON_AS_ASCII'] = False
CORS(app, supports_credentials=True)
# 开启消息接收
ConfigureMsgRecive(&quot;http://localhost:1029/api/msg/recive&quot;)
app.run(host='0.0.0.0', port=1029, debug=True)
</code></pre>