3
votes

I am working with the facebook Bot Messenger API and have searched for this but can't seem to find an answer. I am aware that I can send structured messages, which will work, but this would just be so much easier.

Does anyone know if it's possible for the bot to send link cards? When talking with friends or something you can send a link and messenger automatically pulls the data from the link and puts it in this pretty card like seen below.

When sending a message with the bot it just sends the link.

When I send a message to the bot it sets it up in a card.  When the bot sends the same link it just sends the link

Any ideas, or are structured messages my only option?

2
unfortunately impossible at the moment. you could try mixing buttons with recently introduced web views though! developers.facebook.com/docs/messenger-platform/… - user151496

2 Answers

0
votes

As I'm sure you know, the documentation mentions only text messages, images, and structured messages, but...

A link message sent to the chatbot looks like this:

{ "mid": "<mid>", "seq": <seq>, "text": "test", "attachments": [ { "title": "<title>", "url": "<url>", "type": "fallback", "payload": null } ] }

So you could try posting somthing like the following from the bot to Facebook and see what happens:

{ "attachment":{ "title": "test", "url": "https://facebook.com/", "type":"fallback", "payload": null } }

But to be honest, I'd be surprised if it worked :(

For reference, an image attachment sent from the bot would look like this:

{ "attachment":{ "type":"image", "payload":{ "url":"https://petersapparel.com/img/shirt.png" } } }

0
votes

Why not try a url button instead. Since you want to send a link and you want the user to be able to click it, likewise you want Facebook to load a preview of the link. Facebook does previews of url buttons