Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save IvanAdmaers/7e207d1565c66595ca33d708c22b67bb to your computer and use it in GitHub Desktop.

Select an option

Save IvanAdmaers/7e207d1565c66595ca33d708c22b67bb to your computer and use it in GitHub Desktop.
How To Telegram Bot In Strapi (v4, v5) | Guide
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