-
-
Notifications
You must be signed in to change notification settings - Fork 3
Setting Up a Twitter Bot
1) Go to twitter.com and create an account for your bot.
2) Go to apps.twitter.com and sign in with your Twitter account.
3) Click on "Create New App"
4) Fill out the form. You can put in http://www.github.com/codeforboston/CutePetsBoston as the website URL, like so:
Make sure you put the URL in the format http://wwww.example.com, or else you'll get an error.
5) Once you submit, you should be redirected to this page:
6) Scroll down and click on "Create my access token" in the "Token actions" section.
1) Go to github.com/codeforboston/CutePetsBoston, scroll down, and click on the "Deploy to Heroku" button:
2) Create an account on Heroku as directed.
3) Once the app has been deployed to Heroku, click on the "Dashboard" link:
4) Click on the name of your app and then click on the "Code" tab.
5) Click on the "Heroku Toolbet" link:
6) Download Heroku Toolbet on the page you're redirected to.
7) Once that has been downloaded, go to the command line. On Macs, you can use Finder to search for "Terminal" and open up the app that has a black square for an icon. On Windows, go to Start > All Programs > Accessories > Command Prompt. Type in:
heroku login
And enter your Heroku login details. Note that you won't see anything as you type in your password, but it's being entered!
8) Next type:
heroku git:clone -a cutepetsmethuen
cd cutepetsmethuen
1) Open up the cutepetsmethuen folder. This should be in your user directory (the one named after you). Open a new file in a text editor like TextEdit and save it as .env in the cutepetsmethuen folder. You might be asked if you're sure about naming the file with a dot, but this is okay! Note: your file cannot have an extension - so the default .env.txt will not work! For Macs, you will have to right click on the file in Finder and remove the .txt from the name. Make sure the "Hide extension" box is unchecked as well.
Note: for the next steps, you must have 'smart quotes' turned off. Smart quotes are quotation marks that are slanted or curved towards the text, but we need quotes that look like vertical lines. To change this, go to TextEdit preferences and uncheck the box for smart quotes at the bottom. Then, quit TextEdit and reopen it.
2) Go back to your Twitter Developers page. In your .env file, type:
consumer_key='your_api_key_from_twitter'
consumer_secret=‘your_api_secret_from_twitter’
access_token=‘your_access_token_from_twitter’
access_token_secret=‘your’_access_token_secret_from_twitter’
Replace the things in quotes with the actual information on the Twitter Developers page (in the "API Keys" tab), but keep the single quotes. The API Key and API Secret are at the top of the page, and the Access Token and Access Token Secret are at the bottom of the page.
3) Now go to petfinder.com and scroll down. Click on the "For Developers" link in the footer.
4) Create an account, and then go to petfinder.com/developers/api-key. Request an API key.
5) Go back to your .env file and add the following lines:
petfinder_key=‘your_api_key_from_petfinder’
petfinder_secret=‘your_api_secret_from_petfinder’
Of course, replace what's in the single quotes with your actual API Key and API Secret.
6) On the right sidebar of the PetFinder page, search for your local shelter.
7) Click on your shelter from the list:
8) Look at the URL to find your shelter ID, like so:
9) Go back to .env and add the following line:
shelter_id=‘your_shelter_id’
Replace your_shelter_id with the shelter ID you got from the URL.
10) Lastly, go to your command prompt and type (pressing enter after each line):
git add .
git commit -m "Add .env info"
git push heroku master
You can type rake tweet to have your bot tweet now!
1) Go to addons.heroku.com and search for "scheduler". Click on "Heroku Scheduler."
2) On the Heroku Scheduler page, go to the drop-down list in the "Plans" section and select your app name. Click "Add Standard for Free." This will prompt you to enter you billing information, even though this add-on is completely free. Click on the link to add your billing information.
3) Enter in your billing information. Again, you will not be charged for this add-on.
4) Go back to the Heroku Scheduler page and click "Add Standard for Free." You will be given some text that reads:
heroku addons:add scheduler
5) Go to your command prompt and type heroku addons:add scheduler.
6) If you're not redirected to the web page as shown below, type heroku addons:open scheduler.
7) Click on "Add Job..."
8) Next to the dollar sign, type rake tweet. Select "hourly" under the "Frequency" column.
9) Click "Save". You're done!
Congratulations on setting up your very own Cute Pets Twitter bot!







