Skip to content
ivanchak edited this page Jun 22, 2013 · 3 revisions

Welcome to the snsapi wiki!

Facebook

How to gain access to your Facebook Timeline

Unlike other platforms, Facebook gives a convenient way to gain an access token which can be used to get or post message on your timeline. An access token is a random string that identifies a User session. With this access token, one can access their timeline. There are several ways to generate your access token.
Generating your access token

  1. GraphAPI Explorer
    Visit https://developers.facebook.com/tools/explorer, you can easily get your access token by clicking Get access token. After that, a dialog is shown for a user to select what permissions you are asking for. In our cases, we need to include "publish_actions" under User Data Permissions and "read_stream" under Extended Permissions. "Publish_actions" allows user to post message on the timeline while "read_stream" allows reading user's timeline. After selecting the permissions, one should click get access token again and the access token will be generated. Copy this access token and you will need it to config the Facebook channel in snsapi.
    Three steps to connect to Facebook:
  1. Create a channel. Set the platform as "FacebookStatus".
  2. Add an attribute named "access_token" to the channel. E.g. "access_token" = "your_access_token_here"
  3. Done. You can now use the function home_timeline to read your timeline and function update to share your status.
    Example:
    nc = new_channel()
    nc["platform"]="FacebookStatus"
    nc["access_token"]="your_access_token_here"
    add_channel(nc)
    Done!
    Also, you can config the channel in the file channel.json.
Clone this wiki locally