Created
June 24, 2025 05:55
-
-
Save IvanAdmaers/7e207d1565c66595ca33d708c22b67bb to your computer and use it in GitHub Desktop.
How To Telegram Bot In Strapi (v4, v5) | Guide
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Create your Telegram bot | |
| `./bot/index.ts` | |
| ```ts | |
| import { Bot } from 'grammy'; | |
| const bot = new Bot(''); | |
| export const runTelegramBot = () => { | |
| bot.command('start', (ctx) => ctx.reply('Welcome! Up and running.')); | |
| bot.on('message', (ctx) => ctx.reply('Got another message!')); | |
| bot.start(); | |
| }; | |
| ``` | |
| 2. Call the `runTelegramBot` in Strapi bootstrap | |
| `./src/index.ts` | |
| ```ts | |
| import { runTelegramBot } from "../bot"; | |
| export default { | |
| bootstrap() { | |
| runTelegramBot(); // <=== Call it here | |
| }, | |
| }; | |
| ``` | |
| 3. That's it! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment