
Product
Reachability for Ruby Now in Beta
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.
@xalbex/telegram-bot
Advanced tools
This is a Node.js module to communicate with official Telegram Bot API. To use this module the bot token is required and can be obtained by talking to @botfather.
Why use this module insead compared to others?
It has no dependencies. It reduce the size of your project.
It is written in Typescript and contains the definitions of all official methods and structures useful for type checking. This means that the editor can suggest you errors, name and the official documentation for each member.
It can be used without or with a little abstraction. This allows you to finely control your bot without being limited by this module.
For all the requests it return a Promise, this simplify the asynchronous procedures.
Go in your project folder and run the following command:
$ npm install --save @xalbex/telegram-bot
This module exports different object to do the same things:
It provide all the official methods without any abstraction. All methods accept the same parameters specified in the Telegram Bot API documentation and return a Promise with the result specified in the official documentation.
import * as TelegramBot from 'telegram-bot-js'
// Replace the value below with the Telegram token you receive from @BotFather
const token = '<BOT-TOKEN>';
// Create an object that manages the Telegram bot and receives the updates.
const bot = new TelegramBot.Raw (token);
// Send the message to a specific chat
let promise = bot.sendMessage ({ chat_id: '<A chat id>', text: 'Hello world!' });
It simplifies the management of updates. It is a EventEmitter and is possible to add listners. The events emitted have the same names of the update types specified in the Update object in the documentation: message, edited_message, channel_post, ...
It contains a member api that is the raw client discussed above.
import * as TelegramBot from 'telegram-bot-js'
// Replace the value below with the Telegram token you receive from @BotFather
const token = '<BOT-TOKEN>';
// Create an object that manages the Telegram bot and receives the updates.
const bot = new TelegramBot.Emitter (token);
// Listen for message events. The list of possible events is specified
// here (https://core.telegram.org/bots/api#update)
bot.on ('message', async msg =>
{
// Send a message to the chat acknowledging receipt of their message
let result = await bot.api.sendMessage ({ chat_id: msg.chat.id, text: 'Hi!' });
// Write the server response to the terminal
console.log (result);
});
FAQs
Telegram Bot API for Node.js
The npm package @xalbex/telegram-bot receives a total of 42 weekly downloads. As such, @xalbex/telegram-bot popularity was classified as not popular.
We found that @xalbex/telegram-bot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.

Research
/Security News
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.