Rebuilt upon NZ-Newsfeed-Telegram with simplified architecture.
Improved compatibility with cloud container host. The project can be seamlessly hosted on Heroku.
- Create a bot with BotFather. doc
- Save the token. Keep it secret.
- If you are sending message to a channel, add the bot to the channel and give it permission to send messages. If you are sending message to individual users, obtain the chatID on
https://api.telegram.org/bot<YourBOTToken>/getUpdates
Further detail: [https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id]
- Install required python packages Python 3.X
pip install feedparser
pip install python-telegram-bot
- Clone the script.
- Replace your chatID and Token. For channels, the chatid is
@<YourChannelID>
(remember @). It is recommended to be saved as environmental variables - Add the feeds you want to follow
- Save and run
- Clone the script. Add the feeds you want to follow.
- Create new app on Heroku. Select deployment method as
Connect to GitHub
. - Select the repo. Make sure the repo contains
requirements.txt
andProcfile
. They will instruct Heroku to install the required packages and the execution command. - Go to
Settings tab > Config Vars
. Put thetg_bot_token
and thetg_push_channel
there. - Go to
Overview tab > Configure Dynos
. Change the task to run.
Remarks: It is recommended to stop the Dyno before any git push.