This repo guides you through a simple echo Telegram bot example.
- Register bot by talking to @BotFather, and save the token
- Try out using this token to get updates at https://api.telegram.org/bot/getUpdates
- Try sending a message to https://api.telegram.org/bot/sendMessage?chat_id=ID&text=TEXT
- Get the code:
git clone https://github.com/akashin/TelegramBot.git
- Install dependencies:
pip install -r requirements.txt
- Run the bot with:
python bot.py
Complete the steps from the local setup and then:
- Register on https://heroku.com
- Install heroku command line interface https://devcenter.heroku.com/articles/heroku-cli
- Create new Heroku application for our bot:
heroku login
heroku create --region eu appname # create app in eu region, common regions: eu, us
heroku buildpacks:set heroku/python # set python buildpack
git push heroku master # deploy app to heroku
heroku config:set TELEGRAM_TOKEN=123456789:AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLL # set config vars
heroku logs --tail # If for some reason it’s not working, check the logs
This should automatically start your bot on Heroku.
- Good tutorial: http://djangostars.com/blog/how-to-create-and-deploy-a-telegram-bot/
- Useful Heroku commands: https://github.com/Kylmakalle/heroku-telegram-bot