Awesome Open Source
Awesome Open Source
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. VSCode. 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

grammY Website

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

grammY API Reference

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

grammY Example Bots

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

Awesome grammY

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

grammY Telegram Chat

Telegram 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.

grammY News Channel

Telegram channel where updates to grammY and the ecosystem are posted. We are also on Twitter.

Telegram Bot API Reference

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.

Browser Support

The grammY core package in this repository is available as a JavaScript bundle from the CDN at get.grammy.dev. Currently, we transpile all stable versions (all releases since v1.0) as well as the current main branch to ES6 and ESNext.

You can download them from the URL https://get.grammy.dev/[ES version lowercased]@[grammY version including v-prefix].js. For example, the most recent source on main in ES6 is available from https://get.grammy.dev/[email protected].

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

Contribution Guide

Contributors

Thanks goes to these wonderful people (emoji key):

KnorpelSenf
KnorpelSenf

Heero
Heero

Wojciech Pawlik
Wojciech Pawlik

Alessandro Bertozzi
Alessandro Bertozzi

trgwii
trgwii

KnightNiwrem
KnightNiwrem

Muthu Kumar
Muthu Kumar

EdJoPaTo
EdJoPaTo

Amir Zouerami
Amir Zouerami

Roj
Roj

jokasimr
jokasimr

Ciki Momogi
Ciki Momogi

AndreoliBR
AndreoliBR

Kirill Loskutov
Kirill Loskutov

Andrew Lane
Andrew Lane

code-withAshish
code-withAshish

Stephane Mensah
Stephane Mensah

Asaku01
Asaku01

ppsimn
ppsimn

Satont
Satont

deptyped
deptyped

Jacek Nowacki
Jacek Nowacki

Outvi V
Outvi V

Ikko Ashimine
Ikko Ashimine

Yevhen Denesiuk
Yevhen Denesiuk

prastian
prastian

Sayem Chowdhury
Sayem Chowdhury

kospra
kospra

Chimit
Chimit

Calsi
Calsi

Jonas Zohren
Jonas Zohren

linbuxiao
linbuxiao

JiquanWang99
JiquanWang99

Borhan Hafez
Borhan Hafez

WingLim
WingLim

taotie111
taotie111

Merlin
Merlin

Darvesh
Darvesh

dcdunkan
dcdunkan

Kid
Kid

Slava Fomin II
Slava Fomin II

Kiko Beats
Kiko Beats

Vsevolod
Vsevolod

Habemuscode
Habemuscode

Nikita Kolmogorov
Nikita Kolmogorov

Vitaliy Meshchaninov
Vitaliy Meshchaninov



lmx-Hexagram
lmx-Hexagram

Ilya Semenov
Ilya Semenov

abdollahzadehAli
abdollahzadehAli

Saeed Nasiri
Saeed Nasiri

Hesoyam
Hesoyam

yrzam
yrzam

drmikecrowe
drmikecrowe

Martin
Martin

Pavel
Pavel

Thor  Schaeff
Thor Schaeff

x066it
x066it

kolay
kolay

Evgeny Nepomnyashchiy
Evgeny Nepomnyashchiy

Ananta Krsna dasa
Ananta Krsna dasa

Mighty Ali
Mighty Ali



Roz
Roz

Dani Haro
Dani Haro

Ryukaizen
Ryukaizen

Alisher Ortiqov
Alisher Ortiqov

Tony Tkachenko
Tony Tkachenko

Ra
Ra

sartoshi-foot-dao
sartoshi-foot-dao

Yoel Navas E.
Yoel Navas E.

Vitor Gomes
Vitor Gomes

Aditya
Aditya

Udit Karode
Udit Karode

Mike Rocktt
Mike Rocktt

Srinivasa IK Varanasi
Srinivasa IK Varanasi

abdoo9
abdoo9

ak4zh
ak4zh

Nikolay Lapshin
Nikolay Lapshin

Aquatica
Aquatica

Fa Dzikri
Fa Dzikri

Chandler Lattin
Chandler Lattin

Sergey Parfenyuk
Sergey Parfenyuk

merson Felinto
merson Felinto

Petr Stankin
Petr Stankin

Maxim Lebedev
Maxim Lebedev

Madnex
Madnex

Svyatoslav Tupchienko
Svyatoslav Tupchienko

Vladislav Deryabkin
Vladislav Deryabkin

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


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Javascript (1,158,774
Typescript (307,126
Telegram (12,323
Telegram Bot (6,472
Deno (1,960