viber-connector
Модуль для работы с Viber в Bot Builder.
Установка
npm install viber-connector
Подключение
var restify = require('restify'),
builder = require('botbuilder'),
viber = require("viber-connector.js")({
authToken: "authToken",
name: 'name',
avatar: 'https://avatar.ru/avatar.png'
}),
server = restify.createServer(),
connector = new builder.ChatConnector({
appId: "botframework-app-id",
appPassword: "botframework-app-pass"
}),
ubot = new builder.UniversalBot(connector);
server.listen(80, console.log.bind(console, '%s listening to %s', server.name, server.url));
ubot.connector(viber.channelId, viber);
server.post('/viber', viber.listen());
server.post('/ubot', connector.listen());
ubot.dialog('/', function (session) {
session.send("Привет, твой id: " + session.message.user.id);
});
Warn
viber.channelId - kik, а не viber
webhook нужно ставить самим https://developers.viber.com/api/rest-bot-api/index.html#webhooks