2016-05-15 50 views
3

我正在使用Facebook Bot Messenger API并已搜索此内容,但似乎无法找到答案。我知道我可以发送结构化的消息,这将起作用,但这会更容易。Facebook的机器人邮件发送链接卡?

有谁知道机器人是否可以发送链接卡?在和朋友聊天时,您可以发送链接,Messenger会自动从链接中提取数据,并将其放置在如下所示的漂亮卡片中。

使用机器人发送消息时,它只是发送链接。

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

任何想法,或者是结构化消息我唯一的选择?

+0

不幸的是此刻不可能。尽管你可以尝试混合按钮与最近推出的网络视图! https://developers.facebook.com/docs/messenger-platform/messenger-extension – user151496

回答

0

正如我敢肯定你知道,在文档中提到的纯文本信息,图像,和结构化的消息,但...

发送到聊天机器人的链接的消息是这样的:

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

所以,你可以尝试张贴类似的财产以后,从机器人到Facebook的下面,看看会发生什么:

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

但说实话,我被它的工作:(

仅供参考一惊,从机器人发送的图像附件是这样的:

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

+0

FWIW,我试过这个,它不起作用。 – db42

0

为什么不尝试网址改为按钮。既然你想发送一个链接,你希望用户能够点击它,同样你也希望Facebook加载链接的预览。 Facebook做了url按钮预览

相关问题