Hello! This projects aims to make a Telegram bot that forwards Twitter updates to people, groups, channels, or whatever Telegram comes up with!
It was once hosted on Telegram as @TwitterForwarderBot which doesn't work anymore. There are a few other instances running around:
- (add a Pull Request linking to your instance here!)
This is based on former work:
- python-telegram-bot
- tweepy
- peewee
- envparse
- also, python, pip, the internets, and so on
So, big thanks to anyone who contributed on these projects! :D
The code is currently targeting Python 3.5
- clone this thing
- fill secrets.env (see next readme section)
- create your virtualenv, activate it, etc, e.g.:
virtualenv -p python3 venv . venv/bin/activate . secrets.env
pip install -r requirements.txt
- run it!
python main.py
First, you'll need a Telegram Bot Token, you can get it via BotFather (more info here).
Also, setting this up will need an Application-only authentication token from Twitter (more info here). Optionally, you can provide a user access token and secret.
You can get this by creating a Twitter App here.
Bear in mind that if you don't have added a mobile phone to your Twitter account you'll get this:
You must add your mobile phone to your Twitter profile before creating an application. Please read https://support.twitter.com/articles/110250-adding-your-mobile-number-to-your-account-via-web for more information.
Get a consumer key, consumer secret, access token and access token secret (the latter two are optional), fill in your secrets.env
, source it, and then run the bot!
contributed by @llg, thanks!
Make sure crontab user have write access to venv directory
- use examples/cron-run.sh script in cron:
* * * * * cd /path/to/telegram-twitter-forwarder-bot && examples/cron-run.sh >> /dev/null 2>&1
- you can change time for checking to any you want