botframeworkkikbotconnector

Bot Connector: Sending custom message to Kik results in 400 error


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.


Solution

  • Try:

    chatId = Message.ChannelConversationId
    

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