Skip to content
Switch branches/tags
This branch is 6 commits ahead, 83 commits behind codeforamerica:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Post a random adoptable pet from a shelter to a twitter feed

Based off of Code for America's CutePetsDenver made by Team Denver.

Example twitter feed:

Set Up for Local Development

Environment variables

Edit a the local .env file by adding the appropriate config values. How to get Twitter/PetHarbor/Petfinder config variables is stated below.


rake tweet_pet



  1. Create a twitter account with the user name you'd like to have stream your pet tweets
  2. Accept the confirmation email that Twitter sends you.
  3. Add and validate your phone number for your new Twitter account at Note: If your phone is already linked to another Twitter acct, then use a Google Voice number.
  4. Create a new twitter app.
  5. On the API key tab for the Twitter app, modify permissions so the app can Read and Write. 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.
  6. Create an access token. On the API Key tab in Twitter for the app, click Create my access token
  7. Take note of the values for environment set up below.


  1. Create a Heroku account
  2. Download and install the [Heroku Toolbelt](from:
  3. Create heroku project: heroku create [app name]
  4. Push code: git push heroku master
  5. Add Twitter environment variables
    1. heroku config:set api_key="your_consumer_key_goes_here"
    2. heroku config:set api_secret="your_consumer_secret_key_goes_here"
    3. heroku config:set access_token="your_access_token_goes_here"
    4. heroku config:set access_token_secret="your_access_token_secret_goes_here"
  6. Configure pet datasource–you have two options (below). Search on Petfinder for your shelter and use that if you find it, otherwise look on PetHarbor.
    1. Petfinder
      1. Register for an account at and then get your API key. To find the shelter id, find a shelter's page on The id is the last two letters followed by three numbers in the shelter page url. i.e. For this shelter page,, the shelter id is CA154.
      2. Add Petfinder environment variables.
        1. heroku config:set petfinder_key="your_api_key_goes_here"
        2. heroku config:set petfinder_shelter_id="shelter_id_goes_here"
        3. heroku config:set pet_datasource="petfinder"
    2. PetHarbor
      1. Find the petharbor shelter id. The shelter id can be found near the end of the url, before the pet id, when clicking on the short link for a pet through i.e. the shelter id in is BRKL.
      2. Figure out which pet types your shelter has. Do a search on narrowed down by your shelter. If your shelter has cats, include 'cat' in pet types. If your shelter has dogs or other animals, include 'dog' or 'others' in your pet types as well. When setting the petharbor_pet_types heroku config variable, pet types must be separated with spaces.
      3. Add Petharbor environment variables
        1. heroku config:set petharbor_shelter_id="shelter_id_goes_here"
        2. heroku config:set petharbor_pet_types="cat dog others"
        3. heroku config:set pet_datasource="petharbor"
  7. Schedule tweets
    1. Add the Heroku Scheduler add on: heroku addons:add scheduler
    2. Schedule tweets: heroku addons:open scheduler
    3. In the task field: rake tweet_pet.
  8. Add your new deployment to the official list
    1. open where.geojson and add your listing


Twitter bot that posts adoptable pets from the City of Sacramento's Animal Care Services



No releases published


No packages published