Build a simple Python Telegram Bot that displays top news headlines.
We use the python-telegram-bot wrapper and the NewsAPI.org Python client.
-
Create a new bot with Telegram's BotFather (https://t.me/BotFather)
-
Insert the bot's token in
bot.py
. -
Register at https://newsapi.org to get your personalized token.
-
Insert NewsAPI token in
news_api.py
. -
Set up virtual environment and activate it:
virtualenv -p python3.7 env
. env/bin/activate
-
Install dependencies:
pip install python-telegram-bot newsapi-python
-
Run Chatbot:
python bot.py
Have fun with your bot!