bottender
Advanced tools
Changelog
0.14.12 / 2017-12-25
const { TelegramBot } = require('bottender');
const bot = new TelegramBot({
accessToken: '__FILL_YOUR_TOKEN_HERE__',
});
bot.onEvent(async (context) => {
await context.sendText('Hello World');
});
bot.createLongPollingRuntime({
limit: 100,
timeout: 60,
allowed_updates: ['message', 'callback_query'],
});
See more details in examples/telegram-long-polling
Changelog
0.14.11 / 2017-12-20
sendXXXWithDelay
is deprecated. Use sendXXX
with options.delay
instead.context.leave()
function for group and room #107context.sendVideoNote
using messaging-api-telegram
v0.6.5sendMediaGroup:
context.sendMediaGroup([
{ type: 'photo', media: 'BQADBAADApYAAgcZZAfj2-xeidueWwI' },
]);
Payment API:
context.sendInvoice({
title: 'product name',
description: 'product description',
payload: 'bot-defined invoice payload',
provider_token: 'PROVIDER_TOKEN',
start_parameter: 'pay',
currency: 'USD',
prices: [
{ label: 'product', amount: 11000 },
{ label: 'tax', amount: 11000 },
],
});
Game API:
context.sendGame('Mario Bros.');
context.setGameScore(999);
context.getGameHighScores().then((result) => {
console.log(result);
/*
{
ok: true,
result: [
{
position: 1,
user: {
id: 427770117,
is_bot: false,
first_name: 'first',
},
score: 999,
},
],
};
*/
});
Changelog
0.14.10 / 2017-12-14
Introducing Viber Support to Bottender!
const { ViberBot } = require('bottender');
const { createServer } = require('bottender/express');
const bot = new ViberBot({
accessToken: '__FILL_YOUR_TOKEN_HERE__',
});
bot.onEvent(async (context) => {
if (context.event.isMessage) {
await context.sendText('Hello World');
}
});
const server = createServer(bot);
server.listen(5000, () => {
console.log('server is running on 5000 port...');
});
See viber-hello-world for more details.
update-notifier
in CLI #99v0.6.x
.Changelog
0.14.8 / 2017-12-05
README.md
and .gitignore
when bottender init
v0.5.16
event.isFromCustomerChatPlugin
getterChangelog
0.14.7 / 2017-11-30
mapPageToAccessToken
to support multiple pages (Experimental) #47new MessengerBot({
appSecret: '__FILL_YOUR_SECRET_HERE__',
mapPageToAccessToken: (pageId) => accessToken,
});
Note: API may changes between any versions.
context.reply
and context.push
methods. #52$ bottender line menu get
$ bottender line menu set
$ bottender line menu delete
if (context.event.isInteractiveMessage) {
console.log(context.event.action);
}
Changelog
0.14.6 / 2017-11-27
/assets
directory (in beta):$ bottender messenger attachment upload
Then, you can import them with getAttachment
util function:
const { getAttachment } = require('bottender/utils');
console.log(getAttachment('mypic.jpg').id); // '1591074914293017'
--force
option to bottender messenger profile set
(delete all and set all)test-utils.js
#44withTyping
#35as_user: true
#33