I am making a chat bot app that searches for flights. When a flight is found, I return a carousel with buttons and I want user to be redirected to the website after clicking on them. It works, only problem is that clicking button puts the URL into the conversation. Is there some way to just open the URL without putting it into the conversation?
The JSON I am sending to the Viber REST API:
{
"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"
}
]
}
}
Per the Official Viber API Documentation,
The parameters for Rich Media message and its buttons are also used for Keyboards. You can find additional information on them in the following article.
They also mention,
Pressing a keyboard button would trigger a different reply depending on the buttons “actionType” value.
For ActionType open-url:
The value of ActionBody is sent as a text message to account (via message event).
The value of ActionBody is opened in the browser.
The value of ActionBody appears in the chat thread as message from the user.
It appears that the third option is occurring instead of the second in the list above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With