# Telegram

> Telegram is a user-friendly provider, in this article you will learn how to integrate your Telegram bots with the library.
>
> - **Canonical URL:** https://www.builderbot.app/en/plugins/telegram
> - **Documentation Index:** https://www.builderbot.app/llms.txt
> - **Full Corpus:** https://www.builderbot.app/llms-full.txt

> **NOTE:**
> Create your first Telegram bot if you don't have one yet [create your first Telegram bot](https://core.telegram.org/bots/tutorial "Create your first Telegram bot")

Implementing a new communication channel such as Telegram without affecting the logic of your project is very simple. Below you can find the starting point to implement the new telegram provider.

## Install

```bash (pnpm)
    pnpm install @builderbot-plugins/telegram
```
```bash (npm)
    npm install @builderbot-plugins/telegram
```

```typescript
import { createBot, MemoryDB, createProvider, addKeyword, createFlow } from '@builderbot/bot'
import { TelegramProvider } from '@builderbot-plugins/telegram'

const welcomeFlow = addKeyword(['hi'])
    .addAnswer('Ey! welcome')
    .addAnswer('Your name is?', { capture: true }, async (ctx, { flowDynamic }) => {
        await flowDynamic([`nice! ${ctx.body}`,'I will send you a funny image'])
    })
    .addAction(async(_ , {flowDynamic}) => {
        const dataApi = await fetch(`https://shibe.online/api/shibes?count=1&urls=true&httpsUrls=true`)
        const [imageUrl] = await dataApi.json()
        await flowDynamic([{body:'😜', media: imageUrl}])
    })

const main = async () => {
    const adapterDB = new MemoryDB()
    const adapterFlow = createFlow([welcomeFlow])
    const adapterProvider = createProvider(TelegramProvider, {
        token: 'YOUR_TELEGRAM_TOKEN_HERE'
    })

    await createBot({
        flow: adapterFlow,
        provider: adapterProvider,
        database: adapterDB,
    })
}

main()
```

In this way we have already implemented a new provider for Telegram keeping the same logic.

---
