Skip to content

codeforamerica/CutePets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CutePets

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

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

CutePetsDenver Twitter feed: https://twitter.com/CutePetsDenver

https://twitter.com/CutePetsDenver

Get Your Own!

We've tried to make this as simple as possible. You'll be setting up a few free online accounts, connecting them together, then you'll get your very own CutePets twitter bot. Its painless and takes about an hour. Lets go.

Instructions

Summary:

  • We'll find an animal shelter we want to help get pets adopted from.
  • We'll set up a new Twitter account for these CutePets.
  • We'll create a bot that regularly posts the pets pictures and info.

Requirements

This service requires a credit card to get set up. This card will NOT be charged.

Petharbor

We're scraping info from Petharbor to make our Twitter bot.

  1. Search on petharbor.com for a shelter in your town.
  2. 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 petharbor.com. i.e. the shelter id in http://www.petharbor.com/site.asp?ID=69155 is 69155.
  3. Figure out which pet types your shelter has. Do a search on petharbor.com narrowed down by your shelter. It should be cat dog or others.
  4. We'll need this info in a few minutes, keep it around.

Twitter

First we'll make a new twitter account, then we'll set up the 'bot' side of things.

  1. Create a twitter account with the user name you'd like to have stream your pet tweets
  2. Add your phone number. If your phone number ia already attached to your personal Twitter account, you've got two options:
    • Quickest way is to make a new temporary phone number using Google Voice or BurnerApp.
    • Create the new twitter app on your personal accountthen transfer the API key to the new bot account here by selecting “I need to transfer an API key to another account”, filling out the form, and waiting a few days.
  3. Accept the confirmation email that Twitter sends you.
  4. Create a new twitter app.
  5. For Website, use the new twitter account you just made, https://twitter.com/cutepetstester or whatever
  6. Leave callback url blank
  7. Accept Developer Agreement
  8. Go to the Keys & Access Token tab
  9. Create an Access Token
  10. Good work so far. We're going to need all of these values soon, so keep this window open or write them down.

Heroku

This is where we'll turn on a free rented computer in the sky. It will run the code that grabs the info about animals from Petharbor, then tells Twitter to tweet about them.

  1. Create a Heroku account
  2. Confirm the email they send you.
  3. Cick here -> Deploy
  4. Give your new app a unique name. Try the same name as your Twitter account.
  5. Enter in the Twitter values
  6. Enter in the Petharbor values
  7. Enter in your credit card info. You will NOT be charged.
  8. Click on "Manage App"
  9. Click on "Heroku Scheduler"
  10. Click on "Add new job"
  11. In the text box, copy and paste rake tweet_pet
  12. Keep the dyno size at free. Set the frequency at daily.
  13. Choose the closest time to now to send your first tweet. You can check UTC time at https://www.google.com/search?q=utc+time.
  14. Wait for it, wait for it.
  15. Yeah! You did it!

Github

Great work. Now, tell us which city you made a cutepets bot for. We do this by sending in a Pull Request with our twitter bot's name and location.

  1. Make a new Github Account. Choose the free account plan.
  2. Check out the map on the CutePets Repo
  3. We want to add our own point to the map. We'll need the latitude and longitude for our city. Try using Bing Maps or http://www.latlong.net/ to easily find them.
  4. Edit the where.geojson file using this link.
  5. Add in your twitter bot's name and location using the format below. Note that the negative longitude goes first. Be sure to have that comma at the very end too.
		{
			"type": "Feature",
			"properties":
			{
				"twitter" : "http://twitter.com/CutePetsAdamsCo"
			},
			"geometry":
			{
				"type": "Point",
				"coordinates": [ -104.871902 , 39.891651 ]
			}
		},
  1. Click "Propose Changes" at the bottom of the page.
  2. Click "Create Pull Request"
  3. That's it! Thanks!

About

Twitter bot that posts adoptable pets in your city.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages