Viber Routing
Bottender offers a bunch of helpers to route within your Viber or multi-platform application. For example, you may use Viber particular routes within your router
:
const { router, viber } = require('bottender/router');
function App() {
return router([
viber.message(HandleMessage),
viber.subscribed(HandleSubscribed),
viber.unsubscribed(HandleUnsubscribed),
viber.conversationStarted(HandleConversationStarted),
viber.delivered(HandleDelivered),
viber.seen(HandleSeen),
viber.failed(HandleFailed),
viber(HandleViber),
]);
}
async function HandleMessage(context) {
/* skip... */
}
async function HandleSubscribed(context) {
/* skip... */
}
async function HandleUnsubscribed(context) {
/* skip... */
}
async function HandleConversationStarted(context) {
/* skip... */
}
async function HandleDelivered(context) {
/* skip... */
}
async function HandleSeen(context) {
/* skip... */
}
async function HandleFailed(context) {
/* skip... */
}
async function HandleViber(context) {
/* skip... */
}
All available routes in viber
that recognize different kind of events:
viber
- matches when receiving any viber events.viber.message
- matches when receiving vibermessage
events.viber.subscribed
- matches when receiving vibersubscribed
events.viber.unsubscribed
- matches when receiving viberunsubscribed
events.viber.conversationStarted
- matches when receiving viberconversation_started
events.viber.delivered
- matches when receiving viberdelivered
events.viber.seen
- matches when receiving viberseen
events.viber.failed
- matches when receiving viberfailed
events.