A full tutorial covering everything from configuring your environment to deploying your finished bot is available here.
This page lists some libraries and frameworks developed by the Telegram community – you should take care to report any bugs you may find to the respective developers, as these projects are not maintained by Telegram.
Ping us on @BotSupport if you would like your library to appear on this page.
PHP Telegram Bot. PHP Telegram Bot based on the official Telegram Bot API. https://github.com/php-telegram-bot/core
Telegram Bot Api Base. Clear and simple Telegram Bot API. https://github.com/tg-bot-api/bot-api-base
PHP Telegram API. A complete async capable Telegram Bot API implementation for PHP7. https://github.com/unreal4u/telegram-api
Nutgram. 7.4 support. https://github.com/klev-o/telegram-bot-api
Telegram Bot PHP. A library that makes using Telegram Bot API much easier. https://github.com/telegram-bot-php/core
NeleBot X Framework. Framework for Telegram Bot API. https://github.com/NeleB54Gold/NeleBotX
Bot API PHP SDK. Telegram Bot API PHP SDK. Supports Laravel out of the box. https://github.com/irazasyed/telegram-bot-sdk
Telegraph. A Laravel package for fluently interacting with Telegram Bots. https://github.com/def-studio/telegraph
TeleBot. Easy way to create Telegram bots in PHP. Rich Laravel support out of the box. https://github.com/westacks/telebot
Simple Bot API. Simple & Easy Telegram Bot API. https://github.com/Muaath5/SimpleBotAPI
NovaGram. An Object-Oriented PHP library for Telegram Bots.
https://github.com/skrtdev/NovaGram
PHP Telegram Bot Api. Native PHP Wrapper for Telegram BOT API. https://github.com/TelegramBot/Api
TuriBot. A simple way to communicate with Telegram APIs in PHP. https://github.com/davtur19/TuriBot
TelegramBotApiBundle. A symfony wrapper bundle for Telegram Bot API. https://github.com/borsaco/TelegramBotApiBundle
go-telegram-bot-api. Bindings for the Telegram Bot API. https://github.com/go-telegram-bot-api/telegram-bot-api
Golang Telegram Bot library. An autogenerated wrapper for the Telegram Bot API. Inspired by the python-telegram-bot library. https://github.com/paulsonoflars/gotgbot
Telego. Telegram Bot API library. https://github.com/mymmrac/telego
echotron. An elegant and concurrent library for the Telegram Bot API.
https://github.com/NicoNex/echotron
Telegram Bot API helper for Golang. A Telegram Bot API wrapper. https://github.com/meinside/telegram-bot-go
Telegrambot. Telegram Bot API in Go, but with more clean code. https://github.com/nickname76/telegrambot
telebot. A Telegram bot framework. https://github.com/tucnak/telebot
go-tg. Library for accessing Telegram Bot API, with batteries for building complex bots included. https://github.com/mr-linch/go-tg
TgWrap. A library with Telegram Bot API bindings. https://github.com/rogozhka/tgwrap
Telegram Bot API: Go implementation. A Telegram IM bots API implementation. https://github.com/temoon/telegram-bots-api
python-telegram-bot. A wrapper you can't refuse. https://github.com/python-telegram-bot/python-telegram-bot
pyTelegramBotAPI.
A simple, but extensible Python implementation for the Telegram Bot API. https://github.com/eternnoir/pyTelegramBotAPI
AIOGram. A pretty simple and fully asynchronous library for Telegram Bot API written with asyncio and aiohttp. https://github.com/aiogram/aiogram
TGramBot. A partially auto-generated and asynchronous Minimal Telegram Bot API framework. https://github.com/KeralaBots/TGramBot
OrigamiBot. A pythonic Telegram bot API library. https://github.com/cmd410/OrigamiBot
pytgbot. A module to access the Telegram Bot API. https://github.com/luckydonald/pytgbot
teleflask. A framework based on flask and pytgbot. https://github.com/luckydonald/teleflask
Frankenstein. A Telegram Bot API client. https://github.com/ayrat555/frankenstein
teloxide.
An elegant Telegram bots framework. https://github.com/teloxide/teloxide
Ferrisgram. An asynchronous autogenerated wrapper for the Telegram Bot API. https://github.com/ferrisgram/ferrisgram
carapax. A Telegram Bot API framework. https://github.com/tg-rs/carapax
tgbotapi. A library for using the Telegram Bot API. https://github.com/Syfaro/tgbotapi-rs
telegram-bot. A Library for creating a Telegram Bot. https://github.com/telegram-rs/telegram-bot
Telebot. Write Telegram bots with Tokio and Futures. https://github.com/bytesnake/telebot
TelegramBotAPI. Type-safe library for work with Telegram Bot API. https://github.com/InsanusMokrassar/TelegramBotAPI
Kotlin Telegram Bot. Telegram Bot API wrapper, with handy Kotlin DSL. https://github.
com/vendelieu/telegram-bot
Kotlin Telegram Bot. A wrapper for the Telegram Bot API. https://github.com/kotlin-telegram-bot/kotlin-telegram-bot
Telegram Bot API in Kotlin Multiplatform. Telegram Bot API in Kotlin. https://github.com/omarmiatello/telegram
kt-telegram-bot. Telegram Bot API library for Kotlin language. https://github.com/elbekD/kt-telegram-bot
Iris Telegram API. Yet another Telegram API bot created with Kotlin. https://github.com/iris2iris/iris-telegram-api
Telegraf. Modern Telegram Bot Framework for Node.js. https://github.com/telegraf/telegraf
Node-Telegram-bot. Node.js module to interact with the official Telegram Bot API. https://github.com/yagop/node-telegram-bot-api
Telebot. The easy way to write Telegram bots.
https://github.com/mullwar/telebot
Slimbot. A fuss-free, thin wrapper around Telegram Bot API for Node.js. No frills. https://github.com/edisonchee/slimbot
Telegram.bot. .NET Client for Telegram Bot API. https://github.com/TelegramBots/Telegram.Bot
Telegram.Bots. A .NET 5 wrapper for the Telegram Bot API. https://github.com/TelegramBotsAPI/Telegram.Bots
RxTelegram.Bot. RxTelegram uses a reactive approach to make Updates available. https://github.com/RxTelegram/RxTelegram.Bot
Telegram.BotAPI for NET. One of the most complete libraries available to interact with the Telegram Bot API. https://github.com/Eptagone/Telegram.BotAPI
Telegram Vapor Bot. The wrapper for the Telegram Bot API written in Swift with Vapor. https://github.com/nerzh/telegram-vapor-bot
telegram-bot-swift.
Telegram Bot SDK for Swift. https://github.com/rapierorg/telegram-bot-swift
Telegrammer. Telegram Bot Framework written in Swift 5.1 with SwiftNIO network framework. https://github.com/givip/Telegrammer
grammY. The Telegram Bot Framework. https://github.com/grammyjs/grammY
Nestgram. Framework for working with Telegram Bot API on TypeScript like Nest.js. https://github.com/Degreet/nestgram
puregram. Powerful and modern telegram bot api sdk for node.js and typescript. https://github.com/nitreojs/puregram
TelegramBots. A simple to use library to create Telegram Bots. https://github.com/rubenlagus/TelegramBots
Java API. Telegram Bot API for Java. https://github.com/pengrad/java-telegram-bot-api
ReBot.
A Java EE Telegram Bot API. https://github.com/rebasing-xyz/rebot
canoe. Functional Telegram Bot API. https://github.com/augustjune/canoe
bot4s.telegram. Simple, extensible, strongly-typed wrapper for the Telegram Bot API. https://github.com/bot4s/telegram
F[Tg] - Telegramium. Pure functional Telegram Bot API implementation. https://github.com/apimorphism/telegramium
Telegram::Bot. Ruby gem for building Telegram Bot with optional Rails integration. https://github.com/telegram-bot-rb/telegram-bot
telegram-bot-ruby. Ruby wrapper for Telegram's Bot API. https://github.com/atipugin/telegram-bot-ruby
Elixir. ExGram. Telegram Bot API low level API and framework. https://github.com/rockneurotiko/ex_gram
Elixir.
Nadia. Telegram Bot API Wrapper. https://github.com/zhyu/nadia
C++. tgbot-cpp. A library for Telegram Bot API. https://github.com/reo7sp/tgbot-cpp
C++. tgbot. A library for Telegram Bot API with generated API types and methods. https://github.com/egorpugin/tgbot
Dart. TeleDart. A library interfacing with the latest Telegram Bot API. https://github.com/DinoLeung/TeleDart
Pascal. TGBotMini. Telegram Bot Mini API. https://github.com/HemulGM/TGBotMini
Clojure. telegrambot-lib. A library for interacting with the Telegram Bot API. https://github.com/wdhowe/telegrambot-lib
Lua. telegram-bot-lua. A feature-filled Telegram Bot API library. https://github.com/wrxck/telegram-bot-lua
OCaml. TelegraML. A library for creating bots for Telegram.
https://github.com/nv-vn/TelegraML
Haskell. haskell-telegram-api. High-level bindings to the Telegram Bot API based on servant library. https://github.com/klappvisor/haskell-telegram-api
Perl. Telegram Bot. A genuine Perl 6 client for the Telegram's Bot API. https://github.com/GildedHonour/TelegramBot
This page will help you get started with Telegram Bot SDK. You'll be up and running in a jiffy!
📘
Introduction
Telegram Bot SDK lets you develop Telegram Bots in PHP easily! Supports Laravel out of the box.
Telegram Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.
To learn more about the Telegram Bot API, please consult the Introduction to Bots and Bot FAQ on the official Telegram site.
1 SDK for PHP language.
2.0" } } After installing, you need to require Composer's autoloader if you want to use the library standalone:
require 'vendor/autoload.php';
You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at getcomposer.org.
If you're using this SDK with Laravel, the SDK will self-register its ServiceProvider and Facade using Laravel's auto-discovery.
Open your terminal window and fire the following command to publish config file to your config directory:
php artisan vendor:publish --provider="Telegram\Bot\Laravel\TelegramServiceProvider"
👍
Submit Your Bot!
If you're using this SDK to build your Telegram Bots, We'd love to know and share the bot with the world. Tell us about it - here
Check out the Who's Using Telegram Bot SDK wiki page to know more about what people have been building with this SDK.
![]()
Thank you for considering contributing to the project. Please review the CONTRIBUTING guidelines before submitting any pull requests.
Thanks to JetBrains for providing an open-source license to their PhpStorm IDE that has been very useful in developing this SDK. Please go check them out!
This project and its author is neither associated nor affiliated with Telegram in any way.
See License section for more details.
This project is released under the BSD 3-Clause License.
📘
Additional Information
The library takes advantage of the amazing Laravel Collection API to automatically map the data.
So it's a lot easier to work with the array of data. Supports all the methods listed on the official docs.
Any issues, feedback, suggestions or questions please use issue tracker here.
Updated almost 3 years ago
Hello everyone, this is the first lesson from the course on developing bots for Telegram.
In this course, we will discuss how to create bots for Telegram in PHP. I will tell you how to send text messages, how to send files, how to receive and process messages from users, and as a result, we will write a script to quickly create a Telegram bot in PHP.
In the first lesson, we will look at the basic concepts associated with the API. I will tell you what API methods and hooks are, use Telegram as an example to build a URL for creating requests, and talk about how simple API requests are created in PHP. nine0003
A complete list of all course records is on site or in publications on Habr .
To send and receive requests via the API, you'd better use shared hosting, as local hosting won't be able to receive data via hooks.
Let's look at the basic concepts for working with the API.
API (Application Programming Interface) is a set of methods and rules by which various programs communicate with each other and exchange data.
nine0003
API method is a specific action that the application should perform based on the received data (send a message, return a list of chats, send a picture, etc.)
Token (token) is a unique bot key required to send requests.
To send HTTP requests, you can use the file_get_contents() function, where the link is specified as the first main parameter. This function is great for sending GET requests, but unfortunately using function file_get_contents() POST requests cannot be sent, so we will use the Curl library to send POST requests.
Curl is a library designed to receive and transmit data via protocols such as HTTP, FTP, HTTPS.
You can read more about Curl on my website .
There are 2 types of interaction with the application through the API.
The first is from from the client to the server , and the second from the server to the client . In this case, the client is your application (website), and the server is the site to which you send requests (in our case, this is Telegram).
API request is a way to communicate with the program by sending data from client - to server .
Hooks (Hooks) is a way to communicate with the program, by means of sending data from server - client . That is, with certain changes in the program, the server (application) will send data to the specified client script.
You can find all methods and parameters for requests in the official Telegram documentation.
Telegram Bot API - https://core.tlgr.org/bots/api
We will refer to this site throughout the course.
Documentation for creating Telegram bots is divided into several sections.
In section Recent changes you can find information about Telegram updates. It describes the versions and innovations that have been made to the functionality of the messenger.
Sections Authorizing your bot and Making requests describe how to authorize bots and how to create requests to work with bots.
Section Getting updates describes how to get bot interaction updates. When a user interacts with bots, all his actions, according to the standard, are recorded on the Telegram servers, and in order to gain access to them, you need to send a request getUpdates .
By sending a request getUpdates you can get the id of the last user who wrote the bot, find out his nickname, message text and the date of sending. If the bot is added to a community, then you can get the community id.
Section Getting updates also describes the rules for setting up hooks, which allows you to send any changes to the developer's server. But we will talk about this later, now let's continue our acquaintance with the documentation. nine0003
The next section that interests us is called Available types . This section describes all types of data that Telegram returns to us. When your script sends a request, after processing it, Telegram will return a response to you in JSON string format, which describes the special parameters.
For example, if you send a message, Telegram will return an array containing the created message id, user id, message creation date, and much more. You can parse all this data and write it to the database. nine0003
The section we'll have to work with the most is Available methods , methods for interacting with the bot. I advise you to go through all the methods and explore all the possibilities of working with bots.
In a nutshell, here are methods for sending messages, files, images, and more. All methods have clear names and described parameters, which makes it easy to read the documentation, even without knowledge of English.
Well, at the end, we have described methods for working with stickers, games in Telegram, methods for working with payment in Telegram. nine0003
The Telegram API has a simple and understandable URL structure for sending requests.
Here is an example URL for creating requests to the bot:
https://api.telegram.org/bot{token}/{method} {token} is a unique key that is issued when the bot is created;
{method} is the request method by which we will receive or send certain data. Depending on the name of the method, we will perform different actions. nine0003
These examples are used only for visualization of building a URL, the token specified in the URL is not tied to any bot!
This is how sending messages using the GET method looks like.
The first part of the URL contains the domain api.telegram.org , then we write the string bot with the token that is given to us when creating the bot, after which we specify the sendMessage method and list the GET parameters.
https://api.telegram.org/bot546445612928:AAHjk6643OYgWHim_TICgsaF9NDDVXYnKzA/sendMessage?chat_id=&text=
Sending files to chat looks similar, only method sendMessage is replaced with sendDocument . And GET parameters are not listed here, after specifying the method, since we send data using the POST method.
https://api.telegram.org/bot543264456928:AAHjk6643OYgWHim_TICgsaF9NDDVXYnKzA/sendDocument
Send images to chat:
https://api.telegram.org/bot546413456928:AAHjk6643OYgWHim_TICgsaF9NDDVXYnKzA/sendPhoto
This concludes our acquaintance with the Telegram documentation. In the next lesson, we will create the first bot and try to send simple requests.
The second lesson is already on Habré - https://habr.com/ru/post/697000/
Read more about bots in introductory article .
Many Telegram users create their own tools for creating bots. On this page, we collect them to make it easier for novice bot builders to find the right library. nine0003
Full support for all Bot API features, including games, inline mode, payments, and more.
Microframework for creating bots.
Full implementation of the Bot API in PHP7.
Plugin support library.
nine0184Powerful SDK with Laravel support.
Wrapper for Symfony.
Fully asynchronous library for Telegram Bot API written in asyncio and aiohttp.
Powerful and actively developing library
Framework for creating bots on the Telegram Bot API.
Framework for creating bots. Based on the Twisted library for Python 3.
A small library for creating bots. Suitable for deployment on Google App Engine.
Telegram Bot API client in Ruby.
Ubuntu + Swift + Vapor + Telegram.
Simple framework. Supports inline mode.
Qt5/C++ library for creating Telegram bots.
100% idiomatic wrapper for Telegram Bot API.
Perl 6 client.
High-level bindings for Bot API based on servant.
The simplest PHP bot example
Creates polls in groups.