Posting to Facebook using Python

In relation to my post, Trolling For Self Promotion, I have begun investigating utilizing the Facebook Graph API to post messages.

I found a GREAT reference article that walks through the steps necessary to post to Facebook: http://nodotcom.org/python-facebook-tutorial.html

In order to prevent spam (which makes sense, although this is what we want to do), the API only lets a user post messages to the user's own wall.

Here are some references:

We cannot use Facebook's API to post to other people's walls, but this does not mean we are blocked from accomplishing our goal! I have some ideas on how Selenium could be leveraged to accomplish the same task.

Facebook Example

Even though the task I set out to do was not possible, I learned a lot and have a great zero to one example on how to post to a page.

Per Nikhil's blog, I created a Page: https://www.facebook.com/DEV3LOPER/

I then created a GitHub project to post to a page: https://github.com/DEV3L/python-facebook-api-example

With the right configuration (access token + page id), I was able to post a "Hello, world!" message.

facebook_api_hello_world

To be fun, I looked up a sentence generator, and leveraged that to create a few sentences from the transcript of Anchorman and Romeo and Juliet combined.

facebook_api_hello_world_2

I will find a better sentence generator and content someday!


Get In Touch

We'd love to hear from you! Whether you have a question about our services, need a consultation, or just want to connect, our team is here to help. Reach out to us through the form, or contact us directly via social media.


Previous
Previous

The Reason For the Teardrops on My Twitter Bot

Next
Next

PyOhio Presentation 2016 - How To Create Your First PyPI Package