File size: 1,652 Bytes
a85c9b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
title: "πŸ“± Telegram Bot"
---

### πŸ–ΌοΈ Template Setup

- Open the Telegram app and search for the `BotFather` user.
- Start a chat with BotFather and use the `/newbot` command to create a new bot.
- Follow the instructions to choose a name and username for your bot.
- Once the bot is created, BotFather will provide you with a unique token for your bot.

<Tabs>
    <Tab title="docker">
        ```bash
        docker run --name telegram-bot -e OPENAI_API_KEY=sk-xxx -e TELEGRAM_BOT_TOKEN=xxx -p 8000:8000 embedchain/telegram-bot
        ```

    <Note>
    If you wish to use **Docker**, you would need to host your bot on a server.
    You can use [ngrok](https://ngrok.com/) to expose your localhost to the
    internet and then set the webhook using the ngrok URL.
    </Note>

    </Tab>
    <Tab title="replit">
    <Card>
        Fork <ins>**[this](https://replit.com/@taranjeetio/EC-Telegram-Bot-Template?v=1#README.md)**</ins> replit template.
    </Card>

    - Set your `OPENAI_API_KEY` in Secrets.
    - Set the unique token as `TELEGRAM_BOT_TOKEN` in Secrets.

    </Tab>

</Tabs>

- Click on `Run` in the replit container and a URL will get generated for your bot.
- Now set your webhook by running the following link in your browser:

```url
https://api.telegram.org/bot<Your_Telegram_Bot_Token>/setWebhook?url=<Replit_Generated_URL>
```

- When you get a successful response in your browser, your bot is ready to be used.

### πŸš€ Usage Instructions

- Open your bot by searching for it using the bot name or bot username.
- Click on `Start` or type `/start` and follow the on screen instructions.

πŸŽ‰ Happy Chatting! πŸŽ‰