Skip to content

grammyjs/grammY

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

913 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
grammY

The Telegram Bot Framework

grammY makes it easy to create Telegram bots. Both for beginners and at scale.

You want grammY because it is easy to use. It is very powerful and always up to date. It has the best documentation in town. It is extremely efficient and scales up effortlessly. It has a thriving ecosystem of plugins, a friendly community chat, seamless integrations with web frameworks and databases, and so much more.

Are you ready? πŸ€–πŸš€

Bots are written in TypeScript (or JavaScript) and run on Node.js or Deno.

Quickstart

If you are new to Telegram bots, read the official Introduction for Developers written by the Telegram team.

Visit @BotFather and create a new bot. You will obtain a bot token.

Create a new directory and run

npm install grammy

inside it. Then create a file bot.js with this content:

const { Bot } = require("grammy");

// Create a bot object
const bot = new Bot(""); // <-- place your bot token in this string

// Register listeners to handle messages
bot.on("message:text", (ctx) => ctx.reply("Echo: " + ctx.message.text));

// Start the bot (using long polling)
bot.start();

Now you can run the bot via

node bot.js

and it will echo all received text messages.

Congrats! You just wrote a Telegram bot :)

Going Further

grammY has an excellent documentation, and an API Reference. It even integrates with your code editor, e.g. VS Code. You can hover over any element of grammY to get a detailed description of what that thing does or means.

If you are still stuck, just join the Telegram chat and ask for help. People are nice there and we appreciate your question, no matter what it is :)

Here are some more resources to support you:

Resources

β€”main project website and documentation. Gets you started and explains all concepts.

β€”reference of everything that grammY exports. Useful to look up descriptions about any element of grammY.

β€”repository full of example bots. Includes a setup to easily run any of them.

β€”list of awesome projects built with grammY. Helpful if you want to see some real-world usage.

β€”The chat where you can ask any question about grammY or bots in general. We are also open for feedback, ideas, and contributions!

The Russian community chat can be found here.

β€”The channel where updates to grammY and the ecosystem are posted.

β€”documentation of the API that Telegram offers, and that grammY connects to under the hood.

Deno Support

All grammY packages published by @grammyjs run natively on Deno. We are compiling every codebase to still run on Node.js.

However, given that most bot developers are still using Node.js, all documentation is written Node.js-first. We may migrate it if Deno overtakes Node.js. If you are already on Deno today, import grammY from https://deno.land/x/grammy/mod.ts.

You may also be interested in why we support Deno.

JavaScript Bundles

The grammY core package in this repository is available as a JavaScript bundle via https://bundle.deno.dev/. This lets you transpile all published versions including current main branch to standalone JavaScript files. For example, the most recent source on main is available from https://bundle.deno.dev/https://raw.githubusercontent.com/grammyjs/grammY/main/src/mod.ts.

Being compatible with browsers is especially useful for running bots on Cloudflare Workers. For this reason, we also include a web bundle in our npm package. You can simply do import { Bot } from "grammy/web".

Contributors ✨

Thanks goes to these wonderful people (emoji key):

KnorpelSenf
KnorpelSenf

πŸ€” πŸ’» πŸ“– 🎨 πŸ’‘ ⚠️ πŸ”Œ πŸ“¦ πŸ‘€ πŸ§‘β€πŸ« πŸ“† πŸš‡ πŸ”Š ️️️️♿️ πŸ“’
Heero
Heero

πŸ”Œ πŸ““ πŸ’‘ πŸ“– πŸ‘€ πŸ’» πŸ€”
Wojciech Pawlik
Wojciech Pawlik

πŸ€” πŸ‘€ πŸš‡ πŸ“¦ πŸ”§ πŸ’»
Alessandro Bertozzi
Alessandro Bertozzi

πŸ“–
Thomas
Thomas

πŸ’» πŸ‘€
KnightNiwrem
KnightNiwrem

πŸ’» πŸ› πŸ”Œ πŸ“– πŸ’‘ πŸ‘€ πŸ§‘β€πŸ«
Muthu Kumar
Muthu Kumar

πŸ‘€ πŸ› πŸ’»
EdJoPaTo
EdJoPaTo

πŸ”Œ πŸ“– πŸ€” πŸ‘€ πŸ› πŸ’»
Amir Zouerami
Amir Zouerami

πŸ“– πŸ”Œ πŸ’‘
Roj
Roj

πŸ“– πŸ‘€ πŸš‡ 🌍 πŸ’» πŸ€” πŸ§‘β€πŸ« πŸ’‘
jokasimr
jokasimr

πŸ›
Qz
Qz

πŸ“– 🌍
AndreoliBR
AndreoliBR

πŸ‘€
Kirill Loskutov
Kirill Loskutov

πŸ“– πŸ› πŸ€” 🎨 πŸ’¬ πŸ‘€ πŸ’» πŸ”Œ
AndrewLaneX
AndrewLaneX

πŸ› πŸ‘€
Ashish Bhushan Kumar
Ashish Bhushan Kumar

πŸ“– πŸ’¬ πŸ› πŸ‘€
TheVirginBrokey
TheVirginBrokey

πŸ› πŸ”Œ
Asaku01
Asaku01

πŸ“–
ppsimn
ppsimn

πŸ›
Alexander
Alexander

πŸ”Œ πŸ“–
deptyped
deptyped

πŸ’‘ πŸ“– βœ… πŸ› 🌍
Jacek Nowacki
Jacek Nowacki

πŸ“– πŸ’» πŸ› πŸ‘€ πŸ€”
Outvi V
Outvi V

πŸ’»
Ikko Eltociear Ashimine
Ikko Eltociear Ashimine

πŸ“–
Yevhen Denesiuk
Yevhen Denesiuk

πŸ‘€ πŸ› πŸ’»
Galih
Galih

πŸ› πŸ’»
Sayem Chowdhury
Sayem Chowdhury

πŸ€”
kospra
kospra

πŸ€” πŸ’»
Chimit
Chimit

πŸ“–
Calsi
Calsi

πŸ“–
Jonas Zohren
Jonas Zohren

πŸ› πŸ’»
linbuxiao
linbuxiao

πŸ“– 🌍
PuffMeow
PuffMeow

πŸ“– 🌍
Borhan Hafez
Borhan Hafez

πŸ”Œ
WingLim
WingLim

πŸ“– 🌍 πŸ’» πŸ”Œ πŸ€”
taotie111
taotie111

πŸ“– 🌍
Merlin
Merlin

πŸ“–
Darvesh
Darvesh

πŸ› πŸ’» πŸ‘€
Dunkan
Dunkan

πŸ› πŸ’» πŸ”Œ πŸ‘€ πŸ“– πŸ€” πŸš‡ πŸ”§ πŸ§‘β€πŸ« 🚧
Kid
Kid

πŸ“– 🌍
Slava
Slava

πŸ› πŸ“–
Jose Francisco 'Kiko' VerdΓΊ GambΓ­n
Jose Francisco 'Kiko' VerdΓΊ GambΓ­n

πŸ“–
Wsevolod
Wsevolod

πŸ’» πŸ€” πŸ‘€
Habemuscode
Habemuscode

πŸ‘€ πŸ“– 🌍 🚧
Nikita Kolmogorov
Nikita Kolmogorov

πŸ”Œ
Vitalii Meshchaninov
Vitalii Meshchaninov

πŸ› πŸ’»
Дилян ΠŸΠ°Π»Π°ΡƒΠ·ΠΎΠ²
Дилян ΠŸΠ°Π»Π°ΡƒΠ·ΠΎΠ²

πŸ› πŸ’»
lmx-Hexagram
lmx-Hexagram

πŸ“–
Ilya Semenov
Ilya Semenov

πŸ€” πŸ‘€ πŸ’»
abdollahzadehAli
abdollahzadehAli

πŸ“– πŸ’‘
Saeed Nasiri
Saeed Nasiri

πŸ“–
Hesoyam
Hesoyam

πŸ“–
Yuri Zamyatin
Yuri Zamyatin

πŸ›
drmikecrowe
drmikecrowe

πŸ‘€
Martin
Martin

πŸ“– πŸ› πŸ‘€
Pavlo
Pavlo

πŸ’‘
Thor ι›·η₯ž Schaeff
Thor ι›·η₯ž Schaeff

πŸ’‘
x066it
x066it

πŸ› πŸ‘€
kolay
kolay

πŸ‘€
Eugen Nemann
Eugen Nemann

πŸ‘€
northen-mindset
northen-mindset

πŸ“–
Ali Alshaikh
Ali Alshaikh

πŸ’» πŸ‘€ πŸ€”
δΈ‰δΈ‰
δΈ‰δΈ‰

πŸ› πŸ’»
Roz
Roz

πŸ› πŸ’» πŸ‘€ πŸš‡ πŸ€” πŸ§‘β€πŸ« πŸ”Œ
Dani Haro
Dani Haro

πŸ’» πŸ”Œ πŸ“–
Akash
Akash

πŸ“–
Alisher Ortiqov
Alisher Ortiqov

πŸ“–
Tony
Tony

πŸ“–
Ra
Ra

πŸ’»
Ziding Zhang
Ziding Zhang

πŸ“–
Yoel Navas E.
Yoel Navas E.

πŸ€”
Vitor Gomes
Vitor Gomes

πŸ› πŸ’»
Aditya
Aditya

πŸ› πŸ‘€
Udit Karode
Udit Karode

πŸ‘€
Mike RockΓ©tt
Mike RockΓ©tt

πŸ‘€ πŸ›
Srinivasa IK Varanasi
Srinivasa IK Varanasi

πŸ’»
Akash Agarwal
Akash Agarwal

πŸ‘€ πŸ€” πŸ’»
Nick Lapshin
Nick Lapshin

πŸ’»
Aquatica
Aquatica

πŸ“– πŸ’¬
Chandler
Chandler

πŸ’» πŸ‘€ πŸ”Œ
Sergey Parfenyuk
Sergey Parfenyuk

πŸ›
Felinto
Felinto

πŸ›
Petr Stankin
Petr Stankin

πŸ›
Maxim Lebedev
Maxim Lebedev

πŸ€” πŸ’»
Madnex
Madnex

πŸ“–
Svyatoslav Tupchienko
Svyatoslav Tupchienko

πŸ’»
Vladislav Deryabkin
Vladislav Deryabkin

πŸ› πŸ’» πŸ‘€
Kashyap Sharma
Kashyap Sharma

πŸ’‘
AlexOwl
AlexOwl

πŸ› πŸ’»
Shrimadhav U K
Shrimadhav U K

πŸ’» πŸ€” ⚠️
Binamra Lamsal
Binamra Lamsal

πŸ€”
gertminov
gertminov

πŸ“– βœ…
sp.wack
sp.wack

πŸ›
shevernitskiy
shevernitskiy

πŸ› πŸ‘€ πŸ’»
Raghunandan Jhanwar
Raghunandan Jhanwar

πŸ“–
Andrii Zontov
Andrii Zontov

πŸ› πŸ’» πŸ’¬ πŸ€” πŸ“– 🌍
Abbass Al-Musawi
Abbass Al-Musawi

πŸ“– πŸ› πŸ’»
ArunR
ArunR

πŸ› πŸ’» πŸ€” ⚠️ πŸš‡
NDA
NDA

πŸ› πŸ€” πŸ’»
MatyiFKBT
MatyiFKBT

πŸ“–
Chris Lopes
Chris Lopes

πŸ› πŸ’» πŸ‘€
Islam Kiiasov
Islam Kiiasov

πŸ’»
Shane Avery Sistoza
Shane Avery Sistoza

πŸ€” πŸ’» ⚠️
Maicol
Maicol

πŸ’»
Nazar-Ant
Nazar-Ant

πŸ“– 🌍 🚧
Aleksei Ivanov
Aleksei Ivanov

πŸ‘€
Vladislav Ponomarev
Vladislav Ponomarev

⚠️ πŸ’» πŸ“¦
Louie Tan
Louie Tan

πŸ‘€
Leandro Vargas
Leandro Vargas

πŸ› πŸ’»
Sean Yap
Sean Yap

πŸ› πŸ’»
Sergey Solovev
Sergey Solovev

πŸ€” πŸ‘€
0xArchitect
0xArchitect

πŸ› πŸ’»
Yaroslav Vovchenko
Yaroslav Vovchenko

πŸ› πŸ’»
gabe
gabe

πŸ‘€
Lavrentiy Rubtsov
Lavrentiy Rubtsov

πŸ“–
Josh Gillies
Josh Gillies

πŸ’»
Uladzislau Hramyka
Uladzislau Hramyka

πŸ›
Gabriele Belluardo
Gabriele Belluardo

πŸ› πŸ’»
Dim Chen
Dim Chen

πŸ› πŸ’»
fwqaaq
fwqaaq

πŸ€” πŸ’»
Janek Szynal
Janek Szynal

πŸ€”
Alexander Mordvinov
Alexander Mordvinov

πŸ€”
Ash
Ash

πŸ‘€
Winston H.
Winston H.

πŸ€” πŸ’» πŸ‘€ ⚠️
Hero Protagonist
Hero Protagonist

πŸ’» πŸ› πŸ€” πŸ”Œ
Mobin Askari
Mobin Askari

πŸ”Œ πŸ‘€
Unotao
Unotao

πŸ€” πŸ’»
Grigory
Grigory

πŸ€” πŸ’» πŸ“–
Nikita Tashchilin
Nikita Tashchilin

πŸ’»
barinbritva
barinbritva

πŸ‘€
Lyudmil Ivanov
Lyudmil Ivanov

πŸ’‘
lexomis
lexomis

πŸ‘€
Andrew Sologor
Andrew Sologor

πŸ‘€
rayz
rayz

πŸ’¬ πŸ€” πŸ’» πŸ“–
ZaΒ‘d
ZaΒ‘d

πŸ”§
Mat Milbury
Mat Milbury

πŸ› πŸ’»
Shibo Lyu
Shibo Lyu

πŸ’»
Mased
Mased

🌍 πŸ“–
Artem Prokop
Artem Prokop

πŸ““
SΓ©rgio Rebelo
SΓ©rgio Rebelo

πŸ‘€
Igor Katsuba
Igor Katsuba

πŸ€” πŸ’»
Oyatillo
Oyatillo

πŸ‘€ πŸ› πŸ’»
Mordechai Dror
Mordechai Dror

πŸ‘€
mahovich
mahovich

πŸ“–
ThΓ nh HoΓ ng TrαΊ§n
ThΓ nh HoΓ ng TrαΊ§n

πŸ“–
ikelax
ikelax

πŸ“–
Lutymane
Lutymane

πŸ’»
Thada Wangthammang
Thada Wangthammang

πŸ› ⚠️ πŸ‘€
Konstantin Ryshkov
Konstantin Ryshkov

πŸ› πŸ“–
Mishkat
Mishkat

πŸ› πŸ’»
Dmytro Tiapukhin
Dmytro Tiapukhin

πŸ“–
Alexander
Alexander

πŸ“–
Codinary
Codinary

πŸ‘€
.vhs
.vhs

πŸ› πŸ‘€
agoudbg
agoudbg

πŸ› πŸ’»
A
A

πŸ› πŸ‘€
Harold Hunt
Harold Hunt

πŸ› πŸ’» ⚠️
GlacierPhonkβ„’
GlacierPhonkβ„’

πŸ› πŸ’» 🚧

This project follows the all-contributors specification. Contributions of any kind welcome!