Microsoft Bot Framework attachments for Facebook messenger

Microsoft Bot Framework Messages with Buttons in Facebook Messenger

My question relates to a question related to the question. I am writing a bot using node.js, which does not use the sdk bot constructor. I manually return a compatible response for the ms bot connector service. This works fine for a text answer, but I want to return more complex answers, such as buttons / carousel, which you can return using the messenger. Based on the question I linked above, I guessed about the format and added the following:

response.attachments = [ { "Title": "Choose One: ", "Actions": [{ "Title": "Postback!", "Message": "Postback from button" }, { "Title": "Postback2!", "Message": "Postback2 from button" }] } ]; 

The top-level header does not seem to do anything except actions displayed as buttons such as postback (they send a message as the contents of the postback). With the messenger, you also have the option to return the URLs and URLs of the images.

As far as I can tell, there is zero documentation on returning attachments using node bot builder sdk. If I were, I would just write a bot using sdk to get the response format.

So my question is: does anyone know how to correctly return both feedback buttons and URLs to the bot's connection service, including accompanying images, with or without the sdk bot builder?

Update 05/05/2016

So, I found the link below, and you can see the definition of the attachment property:

http://docs.botframework.com/sdkreference/nodejs/interfaces/_botbuilder_d_.imessage.html

If you follow it in the IAttachment spec, it makes me wonder how / why does my code above work at all? As a test of this format, I wrote the following:

  var att = {}; att.content = "I am content"; att.contentType = "text/plain"; att.contentUrl = "http://www.google.com"; att.fallbackText = "I am fallback text"; att.text = "I am text"; att.thumbnailUrl = "https://pbs.twimg.com/profile_images/638751551457103872/KN-NzuRl.png"; att.title ="I am title"; att.titleLink = "http://yahoo.com"; 

Now I got a pretty good result from this: enter image description here

However, in the messenger I get "Service error: value cannot be empty. Parameter name: source"

+5
source share
1 answer

I found the information I need. I’m not sure if it wasn’t published at that time or I was just hunting in the documents of a bot builder, but all this is described in detail below.

http://docs.botframework.com/connector/message-actions/#navtitle

You need to adjust your message a little for certain integrations, for example, Skype really does not support attachments.

+3
source

All Articles