Bot Connector: Sending custom message to Kik resul

2019-09-01 23:01发布

问题:

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):

Service Error: Response status code does not indicate success: 400 (Bad Request).

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."
      }
      ]
}

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.

回答1:

Try:

chatId = Message.ChannelConversationId

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