Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands and inline requests. You control your bots using HTTPS requests to Telegram Bot API.
Telegram Bots are special accounts that do not require an additional phone number to set up. These accounts serve as an interface for code running somewhere on your server.
Create a new service account for your project. Download private key for the service account in a JSON file.
pip install gnewsclient
Heroku is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud.
A Procfile is a mechanism for declaring what commands are run by your application's dynos on the Heroku platform.
web gunicorn app:app
Also, install gunicorn in your virtual environment:
pip install gunicorn
To specify a particular version of Python via your app's runtime.txt
python-3.7.3
Contains all 3rd party libraries required by your app. Simply do:
pip freeze > requirements.txt
to generate a requirements.txt file.
.gitignore file specifies patterns which are used to exclude certain files in your working directory from your Git history.
git init
-git add .
-git commit -m "YOUR_COMMIT_MESSAGE_HERE"
heroku create <your-app-name>
bot.set_webhook("https://telegrambot.herokuapp.com/" + TOKEN)
Finally, you are ready to deploy your app by pushing your local git repository to the remote heroku app's git repository by:
git push heroku master
heroku logs