FaceBook Messenger crash with Attachement
I'm using NodeJS BotBuilder to send Cards with attachements to FaceBook Messenger It works on Windows Emulator but crash with Facebook
let msg = new builder.Message(session);
msg.text("something")
msg.attachments([{
contentType: CONTENT_TYPE[ext],
contentUrl: attach
}]);
session.send(msg);
If I set attachement I get a 500 error:
2016/08/18 13:12:43 - [INFO] Message outgoing:
{"type":"message","agent":"botbuilder","source":"facebook","address":{"id":"I9LwmCti7d8","channelId":"facebook","user":{"id":"1413583995323943","name":"Jean-Philippe Encausse"},"conversation":{"isGroup":false,"id":"1413583995323943-1006047092848597"},"bot":{"id":"1006047092848597","name":"Tom"},"serviceUrl":"https://facebook.botframework.com","useAuth":true},"text":"some text","attachments":[{"contentType":"image/jpg","contentUrl":"https://ssl.encausse.net:3978/static/area.jpg"}]}
- What am I doing wrong ?
- IS there a way to debug the message sent from MS to Facebook ?
Thanks
So it works if I target images on an external HTTP server. If I host my own images on my HTTPS server it breaks with a 500 generic message
May be I have to do something more:
server.get(/\/static\/.+/, restify.serveStatic({
directory: ROOT+'/web'
}));
It work from a browser and the emulator
EDIT: hum ... it also works from images hosted on a Dropbox with HTTPS
Been there. From messenger api docs: "You cannot send a text and an attachment together, please read the Send API Reference for more details"
- text or attachment must be set
- text and attachment are mutually exclusive
- text is used when sending a text message, must be UTF-8 and has a 320 character limit
- attachment is used to send messages with images or Structured Messages
- metadata has a 1000 character limit
Thanks for the link, it should be in MS Doc too ? My issue do not comes from size limit, MSBotBuilder handle that very well. It comes from my Restify that may have a wrong configuration and do not send HTTPS files correctly to Facebook (I assume)
Are there any errors shown for Facebook in the Channels section in your Bot Framework Developer portal? I was having a similar issue and it was that I was using a URL with a wrong format. The error was shown in the developer portal.
@JpEncausse were you able to get around this?
@muzahmed no it's in my todo to dig why. For a PoC my workaround was to host files on Dropbox. But I have to understand
If you're still having this issue, suggestion, make sure you're setting the content-type header