Simple telegram bot hosted on replit using flask, It forwards messages using the mailgun api.
0.1 You will need an account(free) on replit to host this project so it runs 24/7 in the cloud. The free tier is fine, make sure to use environment variables like described below.
0.2 You also need an account(free) with mailgun to use there api to send emails. Make a note of the "private api key" in settings & your domain (starts with "sandbox..mailgun.org") and finally add recipient email. (If emails end up in spam you can create a custom rule on gmail etc)
0.3 Create a bot using botfather and get the telegram api. Make a note of api key" before closing BotFather Chat
- Create new project using python. Name it anything.
- Install the following packages: (i) requests (ii) Flask (iii) pyTelegramBotAPI
- Add environment variables (i) MAILGUN_KEY (ii) TELEGRAM_KEY (iii) URL
- Copy code for main.py from this repo replace "<MAILGUN_DOMAIN>" with your domain
- Create new file called keep_alive.py and copy the code from keep_alive.py into it.
- Run code and test your bot. Bot should welcome you to the room and forward every message it receives to the email you specified.
- You can publish the repl, run it and close the tab and your bot will keep running in the background 24/7 for free!!