viber - Viber 不断将点击的按钮 url 放入对话中
问题描述
我正在制作一个搜索航班的聊天机器人应用程序。找到航班后,我返回一个带有按钮的轮播,我希望用户在点击它们后被重定向到网站。它有效,唯一的问题是单击按钮会将 URL 放入对话中。有什么方法可以打开 URL 而不将其放入对话中?
我发送到 Viber REST API 的 JSON:
{
"type":"rich_media",
"min_api_version":6.8,
"receiver":"asmS1TwIYkPVxpod3rNCYg==",
"rich_media":{
"Type":"rich_media",
"ButtonsGroupColumns":6,
"ButtonsGroupRows":7,
"Buttons":[
{
"Columns":6,
"Rows":4,
"ActionType":"open-url",
"OpenURLType":"external",
"ActionBody":"http://localhost:60219/Booking?flightId=1&sessionid=3b0f51f5-cf88-4d1e-a64b-1222e19b4702&adults=1&children=0&infants=0",
"Text":"<b>Best Offer - 68.99 EUR</b><br />Bratislava to Nis on 18Oct at 14:10",
"Image":"http://localhost:60219/api/v1/FlightInfo/FlightDetail/Viber?flightId=1&returnFlightId=",
"TextVAlign":"bottom",
"TextHAlign":"center"
},
{
"Columns":6,
"Rows":1,
"ActionType":"open-url",
"OpenURLType":"external",
"ActionBody":"http://localhost:60219/Booking?flightId=1&sessionid=3b0f51f5-cf88-4d1e-a64b-1222e19b4702&adults=1&children=0&infants=0",
"Text":"DEMO booking",
"TextVAlign":"center",
"TextHAlign":"center"
},
{
"Columns":6,
"Rows":1,
"ActionType":"open-url",
"OpenURLType":"external",
"ActionBody":"https://www.ryanair.com/gb/en/booking/home/BTS/INI/2019-10-18//1/0/0/0",
"Text":"Book now",
"TextVAlign":"center",
"TextHAlign":"center"
},
{
"Columns":6,
"Rows":1,
"ActionType":"open-url",
"OpenURLType":"external",
"ActionBody":"http://localhost:60219/FlightDetail?flightid=1",
"Text":"Flight Details",
"TextVAlign":"center",
"TextHAlign":"center"
},
{
"Columns":6,
"Rows":4,
"ActionType":"open-url",
"OpenURLType":"external",
"ActionBody":"http://localhost:60219/PriceAlert?departureAirportId=ce43057e-afe6-4592-8759-9ea9643bb566&arrivalAirportId=3f43e185-bba3-4216-813d-473bfdbb024d",
"Text":"<b>Set the Price Alert for BTS-INI</b><br />We will notify you when the price will be below level set by you.",
"Image":"http://localhost:60219//content/images/price_alerts_default_image.jpg",
"TextVAlign":"bottom",
"TextHAlign":"center"
},
{
"Columns":6,
"Rows":3,
"ActionType":"open-url",
"OpenURLType":"external",
"ActionBody":"http://localhost:60219/PriceAlert?departureAirportId=ce43057e-afe6-4592-8759-9ea9643bb566&arrivalAirportId=3f43e185-bba3-4216-813d-473bfdbb024d",
"Text":"Set Price Alert ",
"TextVAlign":"center",
"TextHAlign":"center"
}
]
}
}
解决方案
Rich Media 消息及其按钮的参数也用于键盘。您可以在以下文章中找到有关它们的更多信息。
他们还提到,
根据按钮的“actionType”值,按下键盘按钮会触发不同的回复。
对于 ActionType 开放网址:
ActionBody 的值作为文本消息发送到帐户(通过消息事件)。
ActionBody 的值在浏览器中打开。
ActionBody 的值作为来自用户的消息出现在聊天线程中。
似乎出现了第三个选项,而不是上面列表中的第二个。
推荐阅读
- c# - rdlc 报告 asp.net 中未显示数据
- laravel - 如何比较表中的两个用户日期
- ios - 如何在 iOS 中保存用户复选标记选择
- php - Eloquent - 在嵌套函数中访问父值
- javascript - 将 json 传递给发布请求时 Flask 400 错误请求
- powershell - 使用powershell并行解压缩多个文件
- java - excel输出中的BIRT垂直文本
- python - Tensorflow 1.9 DNNClassifier 不等输出标签优化
- c# - 行 PdfPRow itextsharp 上的水平对齐(c#)
- c# - 我似乎无法在整个项目中抑制代码分析消息