Skip to content

Conversation

@denis-cto
Copy link

If you need the bot to be run on non-root URL, for example www.site.com/mybot/runhere or if you want run multiple bots on the same site, for example www.site.com/bots/01, www.site.com/bots/02, www.site.com/bots/03, and so on. There is additional configuration option for this:
use

const bot = new ViberBot({
	authToken: YOUR_AUTH_TOKEN_HERE,
	name: "EchoBot",
	avatar: "http://viber.com/avatar.jpg",
        path: '/mybot/runhere'
});

…like site.com/bot/viber) or multiple bots (like site.com/bot/1 and site.com/bot/2)
…like site.com/bot/viber) or multiple bots (like site.com/bot/1 and site.com/bot/2)
@totoantonio
Copy link

Can't make keyboard work... I'm no coder so i just followed the instructions and not tweak anything but can't make keyboard to work.. //Sample Location works as well as others except for Keyboard.. What could be the cause?

//Sample Keyboard
bot.onTextMessage(/^test|keyboard$/i, (message, response) =>
response.send (
new KeyboardMessage('SAMPLE_KEYBOARD'),
));

//Sample Location
bot.onTextMessage(/^loc|location$/i, (message, response) =>
response.send (
new LocationMessage('10.315699', '123.885437'),
console.log(${message.latitude}, ${message.longitude}),
));

@Alik333
Copy link

Alik333 commented Feb 9, 2018

475d95a18527d031-2056bad74bf56c67-144894bb39a75714

@dtorov
Copy link

dtorov commented Oct 11, 2018

sorry..
can you describe how to use it?
const bot1 = new ViberBot({
logger: logger,
authToken: '123',
name: "123",
avatar: "123",
path: '/bots/bot1'
});
const bot2 = new ViberBot({
logger: logger,
authToken: '123',
name: "123",
avatar: "123",
path: '/bots/bot2'
});

const webhookUrl1 = 'https://mybotapi.ru:7002/bots/bot1';
const webhookUrl2 = 'https://mybotapi.ru:7002/bots/bot2';

let httpOptions = {};
http.createServer(bot1.middleware()).listen(port, () =>
{
bot1.setWebhook(webhookUrl1).then(() => {
console.log('bot started');
}).catch(err => console.log(err));
}
);
how to start second bot? in my task i need to start and stop bots at any time...
or,maybe, i need some additional middleware? or?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants