在 api.ai 中,
skype 支持丰富的格式。这是一个例子:-
这是 api.ai 的自定义负载代码:-
{
"skype": {
"text": "OCAS means Online Credit Approval System.\n Click [here] (http://www.erainfotechbd.com/product/ocas-online-credit-approval-system/) for more information. ",
"attachments": [
{
"contentType": "image/png",
"contentUrl": "http://weknowyourdreams.com/images/smile/smile-07.jpg",
"name": "Profile-picture.png"
}
]
} }
现在,我也想在 facebook Messenger 中做类似的事情。但在api.ai doc,仅支持音频、视频和文件。
还有其他方法可以在 Messenger 中对 url 执行此操作吗?
最佳答案
通常,Webhook 响应可以向 API.AI 支持的大多数平台传递任何自定义负载,因此 Facebook Messenger、Skype、Google Assistant 等支持的任何功能都可以通过 API.AI 使用。不幸的是 Facebook 似乎不支持超链接文本。我能找到的最接近的模拟是 Facebook 所说的 URL Button 。以下示例说明了如何使用 Facebook 的按钮模板创建具有 Facebook URL 按钮的 API.AI 响应:
{
"speech": "OCAS means Online Credit Approval System. Check your phone for more information.",
"displayText": "OCAS means Online Credit Approval System. Click here for more information: http://www.erainfotechbd.com/product/ocas-online-credit-approval-system/",
"data": {
"facebook": {
"attachment": {
"type": "template",
"payload": {
"template_type": "button",
"text": "OCAS means Online Credit Approval System",
"buttons": [
{
"type": "web_url",
"url": "http://www.erainfotechbd.com/product/ocas-online-credit-approval-system/",
"title": "Click here for more information"
}
]
}
}
}
}
}
您还可以使用任何其他 Facebook Messenger API,方法是将任何 JSON 包含在您从 Facebook Messenger 文档中看到的“消息”属性中,该属性将由 API.AI 传递给 Facebook
PS - 上面的代码应该生成一条如下所示的消息:
关于facebook - 如何在 api.ai 中为 facebook Messenger bot 部署丰富格式的链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45985155/