This repo provides a service which will take Twitter statuses, replies and retweets from your news feed and publish them to a slack channel, resulting in a stream of posts that look like this:
I can't take much credit for the functionality of this repo, it is built on top of Slack's amazing python client as well as bear/python-twitter.
The authentication for Slack and Twitter works via env variables.
To run twitter-on-slack
you will need to set the following env variables:
TWITTER_CONSUMER_KEY
TWITTER_CONSUMER_SECRET
TWITTER_ACCESS_TOKEN
TWITTER_ACCESS_TOKEN_SECRET
SLACK_API_TOKEN
TWITTER_ON_SLACK_CHANNEL
Where TWITTER_ON_SLACK_CHANNEL
is the name of the channel you'd like to publish the twitter posts.
For more info on obtaining the Slack/Twitter tokens, see the
python-twitter and
Slack API docs.
Your Slack app will need the following permissions:
After the env setup, install the necessary Python requirements via pip install -r requirements.txt
Following successful installation, python main.py
will start the process of pulling Twitter
posts every two minutes, publishing new ones to TWITTER_ON_SLACK_CHANNEL
It is recommended to use this repository as a service. To do so, fill the above env variables in a file named .env
in the repository directory (see .env.example
to see how this should be set up). Then build and deploy the service with
docker-compose up -d
Found a bug? Think this repo could do with more functionality?
Please submit your feedback via the issue board and it will be seen to. Alternatively if you feel like contributing, your pull requests are most welcome!