A bot on DigitalOcean that makes daily wall posts to the R a n c h Facebook page.
First, it searches tumblr for ranch related pictures.
Next, it gets a random quote using the quotesondesign api and processes it using the Natural Language Toolkit to replace any and all nouns with ranch
And finally it combines the two to make a wall post.
##Making posts to a facebook page To make posts to a page you are an admin of, you will need to get a series of short-lived tokens which ultimately lead you to a never-expiring token. Rather than do all of that, you can just use the get_token.py script in this repo, here's how:
-
Create a Facebook app
-
Open the config-example.py file and replace your_id and your_secret with your app id and secret. Then rename the file to config.py
-
Next, go to to the Facebook Graph API Explorer and select your app on the dropdown next to Application. Then click get access token. When the permissions page pops up, be sure to check off manage_pages under the extended permissions.
-
Set up a python virtualenv
-
Install the python packages in
requirements.txt
by runningpip install -r requirements.txt
. If this results in an error, runsudo apt-get install python-dev
and try again. -
Once you have the token, run
get_token.py
along with your token and the name of your page, and the permenant token will generated into the file perm_token.cfg.
##Resources Digital Ocean, Facebook Graph API, Natural Language Toolkit, Quotesondesign, Python facebook-sdk