Viber keeps putting clicked button url into conversation
Asked Answered
G

2

9

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"
         }
      ]
   }
}
Gaffney answered 15/10, 2019 at 10:29 Comment(3)
Does the app have permission to open external links?Deianira
@Deianira it has all the permissions it requested, but i cant see permision to open external links there(Android) - no idea if it is not needed or it does not exist. It is also happening on desktop viber client.Gaffney
@MilanHalada I also came across this issue. I also set Silent parameter of the Button to false. Since it's set to Silent it doesn't come up as a chat message but it's being sent to the webhook I set up in my bot application. Did you find any solution for this?Cuvette
G
1

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.

Gannet answered 2/11, 2019 at 0:47 Comment(0)
L
0

https://developers.viber.com/docs/tools/keyboards/#buttons-parameters

There is "Silent" parameter for a button: Determine whether the user action is presented in the conversation It's false by default, but you can change it!

Logician answered 25/9, 2020 at 8:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.