Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
node-telegram-bot-api
Advanced tools
Node.js module to interact with official Telegram Bot API. A bot token is needed, to obtain one, talk to @botfather and create a new bot.
npm install node-telegram-bot-api
var TelegramBot = require('node-telegram-bot-api');
var token = 'YOUR_TELEGRAM_BOT_TOKEN';
// Setup polling way
var bot = new TelegramBot(token, {polling: true});
bot.on('message', function (msg) {
var chatId = msg.chat.id;
// photo can be: a file path, a stream or a Telegram file_id
var photo = 'bot.gif';
bot.sendPhoto(chatId, photo, {caption: "I'm a bot!"});
});
There are some other examples on examples.
Both request method to obtain messages are implemented. To use standard polling, set polling: true
on options
. Notice that webHook will need a valid (not self signed) SSL certificate.
Emmits message
when a message arrives.
See: https://core.telegram.org/bots/api
Returns basic information about the bot in form of a User
object.
Specify an url to receive incoming updates via an outgoing webHook.
See: https://core.telegram.org/bots/api#setwebhook
Use this method to receive incoming updates using long polling
See: https://core.telegram.org/bots/api#getupdates
Send text message.
See: https://core.telegram.org/bots/api#sendmessage
Forward messages of any kind.
Send photo
See: https://core.telegram.org/bots/api#sendphoto
file_id
previously uploadedSend audio
See: https://core.telegram.org/bots/api#sendaudio
file_id
previously uploaded.Send Document
See: https://core.telegram.org/bots/api#sendDocument
file_id
previously uploaded.Send .webp stickers.
See: https://core.telegram.org/bots/api#sendsticker
file_id
previously uploaded.Send video files, Telegram clients support mp4 videos (other formats may be sent whith sendDocument
)
See: https://core.telegram.org/bots/api#sendvideo
file_id
previously uploaded.Send chat action.
typing
for text messages,
upload_photo
for photos, record_video
or upload_video
for videos,
record_audio
or upload_audio
for audio files, upload_document
for general files,
find_location
for location data.
See: https://core.telegram.org/bots/api#sendchataction
FAQs
Telegram Bot API
The npm package node-telegram-bot-api receives a total of 57,171 weekly downloads. As such, node-telegram-bot-api popularity was classified as popular.
We found that node-telegram-bot-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.