Possible Facebook messenger bug
Hi there,
I am seeing some strange responses in messenger on one of our bots.
The bot is returning a message with an attachment. The attachment has a title set, a thumbnailurl, the contenturl is just a url and the content type is application/text. I have also tried with application/pdf.
However, instead of the attachment displaying a link, it displays this:
https://l.facebook.com/l.php?u=https%3A%2F%2Fcdn.fbsbx.com%2Fv%2Ft59.2708-21%2F13635369_283096975390626_1756467727_n.jpg%2F369-j3uMG8.jpg%3Foh%3D988b7c91a428fba1dbfc51b6281c0550%26oe%3D57B23274%26dl%3D1&h=hAQGlW59L - which opens a jpg and said jpg appears to be corrupted.
However, another of our bots using the same code etc. does return the correct link to the piece of content.
Does anyone have any suggestions as to what might be causing messenger to return this odd content? Is there a way to debug/investigate what the bot is trying to send?
There are different type of attachments that can be added to a response message from the bot. One of them is HeroCard and another is to send a Document. A HeroCard (or ThumbnailCard) does not support documents attached inside it.
Example:
//Defining variables
var attachments = [];
var card = new builder.HeroCard(session)
.title(title)
.subtitle(subtitle)
.text(text)
.images([builder.CardImage.create(session, url)])
.buttons(buttons);
var document = {
name: "Sample1.PDF",
contentType: "application/pdf",
contentUrl: "url_with_your_pdf.pdf"
};
//Adding the card and the document
attachments.push(card);
attachments.push(document);
//Adding attachments to the message
var msg = new builder.Message(session)
.attachments(attachments);
session.send(msg);
Ok thanks.
If you still have more comments, please reopen the issue. Thank you.