服务端发送消息给用户
SendMessageAPI message = (SendMessageAPI)factory.newInstance(EasemobRestAPIFactory.SEND_MESSAGE_CLASS);
Map
Map
ext.put("time", "0000xxxxx0000xxxx");
msg.put("type", "text");
msg.put("msg", "hello 环信");
TextMessageBody tmb = new TextMessageBody("users", new String[]{"123456789"}, "admin", ext, JSON.toJSONString(msg));
ResponseWrapper rw = (ResponseWrapper)message.sendMessage(tmb); System.out.println(rw.getResponseStatus());
环信返回
Response Body: {"action":"post","application":"7f791f50-e9a8-11e5-bda4-7b1406037610","uri":"https://a1.easemob.com/91430103096041818g/upark","entities":[],"data":{"123456789":"success"},"timestamp":1459318880085,"duration":1,"organization":"91430103096041818g","applicationName":"upark"}
1.环信配置正确,用下面的接口可以创建用户
BodyWrapper userBody = new IMUserBody("xxxxxxxx","111111","Coca-Cola");
2: 消息发送后 用户123456789应该可以收到,但是收不到。如果 123456789 不存在于app下面那么还是会收到发送成功的消息。
没有找到相关结果
已邀请:
4 个回复
ouyk
刚看了论坛,已经排除扩展消息问题。还是收不到
ouyk
这种方式也不行 估计不是扩展消息的问题
陌生旁观者
ouyk
换用户的话那怎么操作?
用你的代码拼装参数回事错误的
Body:
{"target_type":"users","target":["uparkadmin"],"from":"admin","msg":{"type":"txt","msg":"{\"type\":\"text\",\"msg\":\"baidu\"}"}}