botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Facebook Structured Messages

Open matheus208 opened this issue 10 years ago • 3 comments

Are Facebook's structured messages supported on this lib?

I'm using Node.js and I saw that on Session.ts there is a verification whether to send a text or an object. I was expecting this object to be of any type (as long as Facebook supported it).

I am sending a structured message JSON, but it is not sent to Facebook :(

This is a console.log output of the object I'm sending:

{ 
    attachment: { 
        type: 'template',
        payload: { 
            template_type: 'generic', 
            elements: [Object] 
        } 
    } 
}

Is there a way to pass these messages through?

matheus208 avatar May 09 '16 13:05 matheus208

I followed this and able to send attachment to Facebook via Message.Attachments or Message.ChannelData.

http://stackoverflow.com/questions/37011994/microsoft-bot-framework-messages-with-buttons-in-facebook-messenger

eddie1976 avatar May 09 '16 13:05 eddie1976

I couldn't find an equivalent for Node.js

The closest I found was Session.createMessage(), but it assumes that I want to send a text. I guess I might have to fork it and verify if the argument is a string or an object?

{ 
    text: { 
        attachment: { 
            type: 'template', 
            payload: [Object] 
        } 
    },
    language: 'pt' 
}

matheus208 avatar May 09 '16 14:05 matheus208

Ok, I managed to use "Session.sendMessage()", passing an attachment JSON, as described on the Send API documentation and it worked!

matheus208 avatar May 09 '16 17:05 matheus208