本文介绍了Bot连接器:向Kik发送自定义消息会导致400错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试弄清楚如何使用Bot Framework/Bot Connector将自定义消息发送到Kik(请参见 http://docs.botframework.com/connector/custom-channeldata/#custom-kik-messages ),但是,我尝试过的所有操作都会产生一条错误消息(尤其是在用于iPhone的Kik应用中):

I'm trying to figure out how to send custom messages to Kik using the Bot Framework / Bot Connector (see http://docs.botframework.com/connector/custom-channeldata/#custom-kik-messages) but, everything I've tried results in an error message (specifically in the Kik app for iPhone):

我已经在C#中创建了一个Kik消息类,并将其添加到Message.ChannelData属性中,然后再发布消息.我使用context.MakeMessage()创建了消息对象,除了ChannelData之外没有设置任何其他属性.在Framework Emulator中查看JSON,我的channelData看起来像这样(例如,使用一条简单的文本消息):

I've created a Kik message class in C# and am adding it to the Message.ChannelData property before posting the message. I created the message object using context.MakeMessage() and am not setting any other properties besides ChannelData.Looking at the JSON in the Framework Emulator my channelData looks like this (using a simple text message for example):

"channelData": {
      "messages": [
      {
          "type": "text",
          "chatId": "<Value from Message.ConversationId>",
          "to": "<Value from Message.To.Name>",
          "body": "This is the body."
      }
      ]
}

我使用类似的方法向Slack或Facebook发送自定义消息没有任何问题,所以我想知道这是否是Bot Connector中的错误,或者我是否缺少Kik的东西?谢谢.

I've not had any trouble sending custom messages to Slack or Facebook using a similar approach so I'm wondering if this is a bug in the Bot Connector or if I'm missing something for Kik? Thanks.

推荐答案

尝试:

chatId = Message.ChannelConversationId

ConversationId是BotFramework使用的ID. ChannelConversationId是频道使用的本机ID.

ConversationId is the Id used by the BotFramework. ChannelConversationId is native Id used by the channel.

这篇关于Bot连接器:向Kik发送自定义消息会导致400错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 04:14