node-telegram-bot-api

js
Telegram Bot API
Version 0.66.0 License MIT
Keywords
telegramtelegram bottelegram bot apibot
INSTALL
Type:
Version:
- Static
- Latest Patch
- Latest Minor
- Latest Major
- 0.66.0
- 0.65.1
- 0.65.0
- 0.64.0
- 0.63.0
- 0.61.0
- 0.60.0
- 0.59.0
- 0.58.0
- 0.57.0
- 0.56.0
- 0.55.0
- 0.54.0
- 0.53.0
- 0.52.0
- 0.51.0
- 0.50.0
- 0.40.0
- 0.30.0
- 0.29.0
- 0.28.0
- 0.27.1
- 0.27.0
- 0.26.0
- 0.25.0
- 0.24.0
- 0.23.3
- 0.23.2
- 0.23.1
- 0.23.0
- 0.22.1
- 0.22.0
- 0.21.1
- 0.20.1
- 0.20.0
- 0.19.2
- 0.19.1
- 0.19.0
- 0.18.0
- 0.17.1
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.0
- 0.13.0
- 0.12.1
- 0.11.1
- 0.11.0
- 0.10.0
- 0.9.0
- 0.8.5
- 0.8.4
- 0.8.3
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.0
- 0.6.0
- 0.5.1
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
Node.js Telegram Bot API
π¦ Install
npm i node-telegram-bot-api
βοΈ Note: If you use Typescript you can install this package that contains type definitions for this library
npm install --save-dev @types/node-telegram-bot-api
π Usage
const TelegramBot = require('node-telegram-bot-api');
// replace the value below with the Telegram token you receive from @BotFather
const token = 'YOUR_TELEGRAM_BOT_TOKEN';
// Create a bot that uses 'polling' to fetch new updates
const bot = new TelegramBot(token, {polling: true});
// Matches "/echo [whatever]"
bot.onText(/\/echo (.+)/, (msg, match) => {
// 'msg' is the received Message from Telegram
// 'match' is the result of executing the regexp above on the text content
// of the message
const chatId = msg.chat.id;
const resp = match[1]; // the captured "whatever"
// send back the matched "whatever" to the chat
bot.sendMessage(chatId, resp);
});
// Listen for any kind of message. There are different kinds of
// messages.
bot.on('message', (msg) => {
const chatId = msg.chat.id;
// send a message to the chat acknowledging receipt of their message
bot.sendMessage(chatId, 'Received your message');
});
π Documentation
- Usage
- Examples
- Tutorials
- Help Information
- API Reference: (api-release / development / experimental)
- Contributing to the Project
- Experimental Features
Note: Development is done against the development branch. Code for the latest release resides on the master branch. Experimental features reside on the experimental branch.
π Community
We thank all the developers in the Open-Source community who continuously take their time and effort in advancing this project. See our list of contributors.
We have a Telegram channel where we post updates on the Project. Head over and subscribe!
We also have a Telegram group to discuss issues related to this library.
Some things built using this library that might interest you:
- tgfancy: A fancy, higher-level wrapper for Telegram Bot API
- node-telegram-bot-api-middleware: Middleware for node-telegram-bot-api
- teleirc: A simple Telegram β IRC gateway
- bot-brother: Node.js library to help you easily create telegram bots
- redbot: A Node-RED plugin to create telegram bots visually
- node-telegram-keyboard-wrapper: A wrapper to improve keyboards structures creation through a more easy-to-see way (supports Inline Keyboards, Reply Keyboard, Remove Keyboard and Force Reply)
- beetube-bot: A telegram bot for music, videos, movies, EDM tracks, torrent downloads, files and more.
- telegram-inline-calendar: Date and time picker and inline calendar for Node.js telegram bots.
- telegram-captcha: Telegram bot to protect Telegram groups from automatic bots.
π₯ Contributors
License
The MIT License (MIT)
Copyright Β© 2019 Yago