自定义消息

快捷键123 2023-5-27 417

发送自定义消息需要把整个MessagePayload对象encode吗

String sender = "1636632088780013569"; String s = "自定义消息"; Conversation conversation = new Conversation(); conversation.setTarget("1630092709974609921"); conversation.setType(0); conversation.setLine(0); MessagePayload messagePayload = new MessagePayload(); messagePayload.setType(1001); messagePayload.setContent(s); messagePayload.setSearchableContent(s); messagePayload.setPushContent(""); messagePayload.setPushData(""); messagePayload.setBase64edData(Base64.getEncoder().encodeToString(s.getBytes(StandardCharsets.UTF_8))); messagePayload.setMentionedType(0); List toUsers = new ArrayList<>(); toUsers.add("1630092709974609921"); IMResult sendMessageResultIMResult = MessageAdmin.sendMessage(sender, conversation, messagePayload, toUsers);

    我这样定义有什么问题吗?
最新回复 (1)
  • x86 2023-5-29
    引用 2
    把整个MessagePayload对象encode吗?
    -------------
    什么意思?

    请看下这儿的说明:https://docs.wildfirechat.cn/server/admin_api/models.html#MessagePayload

    然后,可以参考下客户端代码`encode`出来的`messagepayload`
返回