Creating a Facebook App

In order for us to retrieve post content from your Facebook page, you will need to create a Facebook app.

  1. Go to https://developers.facebook.com/apps/ and sign in with an account which has access to manage your Facebook page.
  2. Click the Green Create App button in the top right.
  3. Select None and click the Next button.


     
  4. Enter a name for the app and your contact details. You do not need to associate this with a business account. You will need to enter your password after clicking the green Create app button.


     
  5. Click on Settings and then Basic in the left navigation bar. Note the App ID and App secret fields. You will need to copy these into Drupal later on. This is where they are located. Enter a Privacy Policy URL in the appropriate field (you can use Middlebury's if your Facebook page is for an official Middlebury entity) and click the blue Save changes button.


     
  6. Click App Review and then Permissions and Features in the left navigation bar. Next to the email and public_profile rows. Click the Return to standard access button. You do not need advanced access to this user information in order for us to retrieve posts. By removing the advanced access, you will not need to conduct annual data usage reviews for Facebook to keep the app working. You will need to enter your password each time to confirm.


     
  7. You can now toggle the app to "Live" mode.


     
  8. In a new tab, go to the Facebook Graph API Explorer at https://developers.facebook.com/tools/explorer/. Select your new app from the Facebook App dropdown. Next click the Permissions dropdown and add the pages_read_user_content permission so that you have it along with pages_show_list and pages_read_engagement. Now change the User or Page dropdown to Get Page Access Token. You will then be asked if you want to continue as the currently logged in user. Click the Continue button.


     
  9. You will then be asked which page you want to get posts from. Select it from the list and click Next.


     
  10. You will be told you need to give the app permission to read the contents of that page. Click Next to do so. You will then see a confirmation page where you can click OK.


     
  11. Now back on the Graph API Explorer page, select the page from the User or Page dropdown and click the blue Generate Access Token button.


     
  12. You will be asked to give the app permission to view your profile. Click the blue Continue button.


     
  13. The Access Token field will now be filled in. This, along with the App ID and the App Secret from earlier are the three pieces of information you need to set up the link to Facebook, but this access token is temporary. We need to make it permanent. In a new tab go to https://developers.facebook.com/tools/debug/accesstoken/. Copy the Access Token from the Graph API Explorer tab in here and click the blue Debug button, then click the Extend Access Token button. You should be given a new, possibly permanent, access token.


     
  14. Sometimes the extended token still has an expiry date. If that is the case, go to this URL: https://graph.facebook.com/v14.0/APP_SCOPED_USER_ID/accounts?access_token=EXTENDED_ACCESS_TOKEN replacing the two bolded parts with the values from the Access Token Tool screen you were just on. You will see a screen like the one below. Copy the value of the access_token. This is your new, permanent access token.


     
  15. Now that you have your App ID and App Secret (from the basic settings page here https://developers.facebook.com/apps/ and the new User Access Token from the last step, you can go into Drupal and create a new Facebook Account node. Paste those values in, along with the last part of your Facebook page's URL as the title.