forked from borball/weixin-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
企业号消息和事件
borball edited this page Dec 12, 2015
·
2 revisions
-
代码
XmlMessageHeader xmlRequest = QyXmlMessages.fromXml(content);
-
XmlMessageHeader
XmlMessageHeader 是消息和事件的抽象类,可以向下转型为具体的微信消息和事件。
消息:
- text消息:QyTextRequest
- image消息:QyImageRequest
- voice消息:QyVoiceRequest
- video消息:QyVideoRequest
- 小视频消息:QyShortVideoRequest
- Location消息:QyLocationRequest
事件:
- 用户关注取消:QySubscriptionEvent
- 上报地理位置:QyLocationReportEvent
- 菜单点击:QyClickEvent
- 菜单链接:QyViewEvent
- 扫码: QyScanEvent
- 拍照,照片选择:QyPhotoEvent
- 弹出地理位置选择器:QyLocationSelectEvent
- 用户进入应用:EnterAgentEvent
-
消息类型
- text消息:TextXmlMessage
- image消息:ImageXmlMessage
- voice消息:VoiceXmlMessage
- video消息:VideoXmlMessage
- news消息:NewsXmlMessage
-
消息类型
- text消息:TextMessage
- image消息:ImageMessage
- voice消息:VoiceMessage
- video消息:VideoMessage
- file消息:FileMessage
- news消息:NewsMessage
- mpnews消息:MpNewsMessage
-
发送消息
//文本消息: JsonMessage textMessage = new TextMessage(); textMessage.text("文本消息").safe().toUser("borball").toParty("1|2").toTag("1|2").agent(30); Messages.defaultMessages().send(textMessage);