1

I'm using the Microsoft Botframework and the node.js version of botbuilder. My bot can send messages to kik (and other services) using the shared message fields - the ones that the botconnector allows for all messages.

However, when I try to use channelData fields for kik, I get a 400 (Bad Request) error message. I have already adapted my message to use the tip from: Bot Connector: Sending custom message to Kik results in 400 error but I'm still missing something.

Thanks for any help on mapping the message properly for kik.

Code that results in the 400 error: session.send({ type: "Message", to: { "channelId":"kik", "address": session.message.from.address}, from: { "channelId":"kik", "address": session.message.to.address}, replyToMessageId: session.message.id, conversationId: session.message.conversationId, channelConversationId: session.message.channelConversationId, channelMessageId: session.message.channelMessageId, channelData: { "messages": [ { "chatId": session.message.channelConversationId, "type": "text", "to": session.message.from.name, "text": "test text", "noForward": true } ] } });

I've also tried sending only the channelData portion, but that also results in the 400 error: channelData: { "messages": [ { "chatId": session.message.channelConversationId, "type": "text", "to": session.message.from.name, "text": "test text", "noForward": true } ] }

Community
  • 1
  • 1
designdit
  • 851
  • 7
  • 7

1 Answers1

0

I believe your data is malformed. Kik expects text content as "body" not "text". Try:

"messages": [
            {
                "chatId": session.message.channelConversationId,
                "type": "text",
                "to": session.message.from.name,
                "body": "test text",
                "noForward": true
            }
Lars
  • 9,976
  • 4
  • 34
  • 40
  • Thanks for the suggestion, @Lars. That didn't seem to do it. I tried with both sets of data (channelData only and with more of the message information as in my original post). Am still getting: "Service Error:Response status code does not indicate success: 400 (Bad Request)." – designdit Jun 22 '16 at 02:13
  • Double check that you don't have your 'from' and 'to' addresses reversed. The 400 is coming directly from Kik. – Lars Jun 22 '16 at 19:33
  • I think I have the "from" and "to" correct - am using the "from" from the message sent by the user as the address the bot sends "to". I can send non-channel-data messages to Kik without a problem, just haven't figured out how to format/send messages that use the Kik specific channel data fields. – designdit Jun 24 '16 at 05:17