This repository has been archived by the owner on Jan 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
MP_主动发送消息
Binary Wang edited this page Sep 23, 2016
·
3 revisions
WxMpCustomMessage message = ...;
// 设置消息的内容等信息
wxMpService.customMessageSend(message);
// 2.0.0版本以上使用
wxMpService.getKefuService().customMessageSend(message);
不同类型的客服消息有不同的构造方法:
WxMpCustomMessage
.TEXT()
.toUser("OPENID")
.content("sfsfdsdf")
.build();
WxMpCustomMessage
.IMAGE()
.toUser("OPENID")
.mediaId("MEDIA_ID")
.build();
WxMpCustomMessage.VOICE()
.toUser("OPENID")
.mediaId("MEDIA_ID")
.build();
WxMpCustomMessage.VIDEO()
.toUser("OPENID")
.title("TITLE")
.mediaId("MEDIA_ID")
.thumbMediaId("MEDIA_ID")
.description("DESCRIPTION")
.build();
WxMpCustomMessage.MUSIC()
.toUser("OPENID")
.title("TITLE")
.thumbMediaId("MEDIA_ID")
.description("DESCRIPTION")
.musicUrl("MUSIC_URL")
.hqMusicUrl("HQ_MUSIC_URL")
.build();
WxMpCustomMessage.WxArticle article1 = new WxMpCustomMessage.WxArticle();
article1.setUrl("URL");
article1.setPicUrl("PIC_URL");
article1.setDescription("Is Really A Happy Day");
article1.setTitle("Happy Day");
WxMpCustomMessage.WxArticle article2 = new WxMpCustomMessage.WxArticle();
article2.setUrl("URL");
article2.setPicUrl("PIC_URL");
article2.setDescription("Is Really A Happy Day");
article2.setTitle("Happy Day");
WxMpCustomMessage.NEWS()
.toUser("OPENID")
.addArticle(article1)
.addArticle(article2)
.build();