How to create a viber keyboard and open it in internal browser

posted in: Uncategorized
 You should send a POST request to viber webhook on https://chatapi.viber.com/pa/send_message

The request headers should contain:

X-Viber-Auth-Token: <your viber authentication token>
Content-Type:application/json

An example request body is:
 
“receiver”:“01234567890A=”,
“type”:“text”,
“text”:“Hello viber keyboard”,
“keyboard”: 
“Type”:“keyboard”,
“DefaultHeight”:true,
“Buttons”: 
 
“ActionType”:“reply”,
“ActionBody”:“reply to me”,
“Text”:“Key text”,
“TextSize”:“regular”
}
]
}
}

Open in internal browser

It is very important to put the attribute “min_api_version”:3 , because opening a keyboard in internal browser is supported after api version 3.
Otherwise the button will be opened in external browser.
Here is the changed version for opening in internal browser:

 
“receiver”:“01234567890A=”,
“type”:“text”,
“text”:“Hello viber keyboard”,
“min_api_version”:3,
“keyboard”: 
“Type”:“keyboard”,
“DefaultHeight”:true,
“Buttons”: 
 
“ActionType”:“open-url”,
“ActionBody”:“example.com”,
“Text”:“Key text”,
“TextSize”:“regular”
}
]
}
}