93 lines
1.9 KiB
Markdown
93 lines
1.9 KiB
Markdown
# wechat-officeaccount
|
||
支持从微信服务号获取用户输入信息(含:正文,图片,视频,语音,事件),并通过zmq消息发送给订阅了config.json中woa_handler_id的代码处理,并将结果通过zmq消息发送会奔模块的等待函数
|
||
|
||
|
||
## 接收消息类型
|
||
|
||
* TextMessage
|
||
* ImageMessage
|
||
* VoiceMessage
|
||
* VideoMessage
|
||
* LocationMessage
|
||
* LinkMessage
|
||
* EventMessage
|
||
|
||
发送给消息处理程序的结构:
|
||
{
|
||
subscribe_id:消息处理程序zmq消息返回消息使用的key
|
||
received_at:消息接收时间
|
||
openid:用户的openid号
|
||
msgtype:消息类型, ['text', 'image', 'video', 'voice', 'location', 'link', 'event' ] 之一
|
||
# 以下信息为是msgtype=='text'
|
||
content: 正文
|
||
#### over
|
||
# 以下信息为是msgtype in ['video', 'voice', 'image']
|
||
media_url:媒体的url,通过此url下载相应的图片,视频,voice等
|
||
#### over
|
||
# 以下信息是msgtype=='position'
|
||
location:{ # LocationMessage位置消息
|
||
latitude:纬度
|
||
longitude:经度
|
||
label:地址标签
|
||
}
|
||
#### over
|
||
event:
|
||
# 以下信息为是msgtype == 'link'
|
||
title:标题
|
||
description:描述
|
||
url:链接
|
||
}
|
||
|
||
## 回微信的消息类型
|
||
* TextReply
|
||
消息属性
|
||
{
|
||
msgtype: 'text'
|
||
content:如果不需要回复微信的消息,content='success'
|
||
}
|
||
* ImageReply
|
||
消息属性
|
||
{
|
||
msgtype:'image'
|
||
media_file:图像文件的本地路径
|
||
}
|
||
* VoiceReply
|
||
消息属性
|
||
{
|
||
msgtype:'voice'
|
||
media_file:图像文件的本地路径
|
||
}
|
||
* VideoReply
|
||
消息属性
|
||
{
|
||
msgtype:'video'
|
||
media_file:图像文件的本地路径
|
||
}
|
||
* ArticlesReply
|
||
消息属性
|
||
{
|
||
msgtype:'video'
|
||
articles:[
|
||
{
|
||
'title':标题
|
||
‘description:描述
|
||
'image_url':图片url
|
||
'url':文章所在url
|
||
}
|
||
]
|
||
}
|
||
|
||
* MusicReply
|
||
消息属性
|
||
{
|
||
msgtype:'music'
|
||
title:标题
|
||
description:描述
|
||
music_url:公网可访问的url
|
||
hq_music_url:高质量链接
|
||
}
|
||
|
||
返回消息有以下属性
|
||
|
||
|