Originated as a project of Team Denver during the 2014 fellowship at Code for America.
A twitter bot that pulls data from Adopt-A-Pet-Denver an API created by David Viramontes and Drew to serve data for animals currently in Denver animal shelters ready for adoption.
Originally specific to Denver, it's been redeployed by a few cities. Check out this twitter list to see where.
Links to API and Bot
- Create a new twitter app.
- On the API key tab for the Twitter app, modify permissions so the app can Read and Write.
- Create an access token. On the API Key tab in Twitter for the app, click Create my access token
- Take note of the values for environment set up below. Note: It's important to change permissions to Read/Write before generating the access token. The access token is keyed for the specific access level and will not be updated when changing permissions.
- Create a local .env file:
cp template.env .env
- Fill in the twitter keys created above.
rake
- Download and install the [Heroku Toolbelt](from: https://toolbelt.heroku.com).
- Create heroku project:
heroku create [app name]
- Push code:
heroku push heroku master
- Add environment variables
heroku config:set consumer_key="your_consumer_key_goes_here"
heroku config:set consumer_secret="your_consumer_secret_key_goes_here"
heroku config:set access_token="your_access_token_goes_here"
heroku config:set access_token_secret="your_access_token_secret_goes_here"
- Schedule Tweets
- Add the Heroku Scheduler add on:
heroku addons:add scheduler
- Schedule tweets:
heroku addons:open scheduler
- In the task field:
rake
.
- Add the Heroku Scheduler add on:
-
Kudos to Darius for his great guide on how to make a twitter bot.
-
And kudo to Erik for the twitter gem.