2017-08-31 71 views
2

在api.ai中,如何在api.ai中为Facebook Messenger使用丰富的格式化链接?

丰富的格式支持skype很好。这里有一个例子: -

enter image description here

这里是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,只支持音频,视频和文件。

是否有任何其他的方式来做这样的网址也在信使?

+0

是什么使你相信丰富使用Messenger平台甚至可以进行格式化? – luschn

回答

1

通常,webhook响应可以向API.AI支持的大多数平台提供任何自定义有效内容,因此可以通过API.AI使用Facebook Messenger,Skype,Google Assistant等支持的任何功能。不幸的是Facebook似乎不支持超链接文本。我能找到的最接近的模拟是Facebook称之为URL Button。下面是你如何可以创建一个拥有Facebook URL按钮与Facebook的按钮模板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" 
      } 
      ] 
     } 
     } 
    } 
    } 
} 

可以使用还包括“消息中的任何JSON使用其他任何透过Facebook Messenger的API “属性,你从Facebook的Messenger的文件看,它会沿着给Facebook通过API.AI传递

PS - 上面的代码应该产生一个消息,看起来是这样的:

相关问题