This Python script allows a group of friends to easily share a tweet with each other. After creating a memorable Twitter handle and authenticating with the Twitter API, the bot will pull the Twitter stream and listen for mentions. When anyone in the group mentioned the bot, the Tweet will be quoted and sent to the rest of the group.
Keep in mind that the Twitter rate limits apply not only to API calls but tweets themselves. Tweets are currently limited to 1000 per day broken into semi-hourly intervals. This works out to about 20 per half hour. If you try and use this with a large group, you will bump into this limit very frequently. I find it works best for groups of 5. More info: Twitter Rate Limits
- groupchat.py: Main python application.
- Procfile: Runs the script as a worker on heroku.
- requirements.txt: Ensures Tweepy is installed.
Only a few variables need to be changed to get this up an running.
- Create a new account for the bot: http://twitter.com
- Register for a developer account and create an app: http://dev.twitter.com
- Execute setup in the route directory to set config variables.
- Make sure the bot is following your desired list of friends and add their handles to the list.
- Test by tweeting at the bot!
This script can easily be deployed to Heroku, AWS, or any server host with reasonable uptime.
For Heroku (the simplist IMO):
heroku create [optional name]
git push heroku master
heroku ps:scale worker=1
- Test by tweeting at the bot / checking
heroku logs
Contact me on Twitter about anything: @JohnCoogan