icon Facebook Albums
Created by Orckestra

How to use the Facebook Albums package

Before you begin, make sure you have:

  1. obtained a long-lived user access token.
  2. learned how to find a Facebook page's unique ID - if you are going to show images associated with a specific Facebook page.
  3. learned how to find a Facebook album's ID - if you are going to show images from a specific album on Facebook.

There are a few scenarios of using the package to show images from Facebook:

  1. Showing images from public Facebook pages
  2. Showing images from your own Facebook account
  3. Showing images from a public Facebook album

Important. You need to obtain a long-lived user access token to use in these scenarios.

How to show images from public Facebook pages

To show images from the albums linked to a public Facebook page (including those linked to your own Facebook account), you need:

  1. the unique ID of this page
  2. and a long-lived user access token.

Now use the Composite.Media.ImageGallery.Facebook.AlbumsGallery function:

  1. Edit a page.
  2. Insert:
    1. the "Facebook Albums" component (Components | Media),
    2. or the Composite.Media.ImageGallery.Facebook.AlbumsGallery function ( Insert | Function),
    3. or the following code:
      Expand code
  3. Specify its required parameters:
    • Access Token: The long-lived user access token
    • Object Unique ID: The unique ID of a Facebook public page
  4. If necessary, specify these optional parameters:
    • Album types: One or more types of albums to show on a page: normal, wall, profile, mobile, cover, app ('normal, wall, profile' by default).
    • Use Facebook links to albums: When 'True', albums will be opened externally on their dedicated Facebook pages; otherwise, right on the current page ('False' by default)

Apart from images in regular Facebook albums, there are also images from to specific Facebook albums: those shared on the Wall, those used as profile images, those used uploaded via mobile devices etc. You can choose to include or exclude these specific images by selecting corresponding option in the Album Types parameter.

How to show images from your own Facebook user account

To show images from your Facebook user account, you need:

Rather than using the unique ID of your account (e.g. "MySuperUserAccount"), you can simply specify "me" in the "Object Uniquie ID" parameter.

Note. "me" is a special endpoint that translates to the user_id of the person (or the page_id of the Facebook Page) whose access token is currently being used to make the API calls.

Now use the Composite.Media.ImageGallery.Facebook.AlbumsGallery function:

  1. Edit a page.
  2. Insert:
    1. the "Facebook Albums" component (Components | Media),
    2. or the Composite.Media.ImageGallery.Facebook.AlbumsGallery function ( Insert | Function),
    3. or the following code:
      Expand code
  3. Specify these parameter:
    • Access Token: The long-lived user access token.
    • Object Unique ID: The unique ID of your user account ("me" by default).
  4. If necessary, specify these optional parameters:
    • Album types: One or more types of albums to show on a page: normal, wall, profile, mobile, cover, app ('normal, wall, profile' by default).
    • Use Facebook links to albums: When 'True', albums will be opened externally on their dedicated Facebook pages; otherwise, right on the current page ('False' by default)

How to show images from a public Facebook album

To show images from a specific public Facebook album on a page or in your Facebook account, you need:

Now use the Composite.Media.ImageGallery.Facebook.Photos function:

  1. Edit a page.
  2. Insert:
    1. the "Facebook Photos" component (Components | Media),
    2. the Composite.Media.ImageGallery.Facebook.Photos function ( Insert | Function),
    3. or the following code:
      Expand code
  3. Specify its required parameters:
    • Album ID: The ID of a Facebook image album
    • Access Token: The Facebook App's access token.

Getting a long-lived user account token

To get a long-lived user token account, you should:

  1. Create a Facebook app.
  2. Configure the app.
  3. Obtain a short-lived user access token associated with this app.
  4. Extend the short-lived token into a long-lived one.

First, create a Facebook app:

  1. Go to http://developers.facebook.com/apps
  2. Click "Add New App".
  3. Follow the steps in the wizard to create the app.

You can reuse any existing app in your Facebook account but we recommend that you create a dedicated one for this purpose.

Next, configure the app:

  1. Open the app in your Facebook account.
  2. On the "Settings" tab, click "Add Platform" and select "Website" (if you don't have a website added as the platform yet).
  3. In the "Site URL" field specify the URL to your website where you are going to show images form Facebook.
  4. Save the changes.

Then, generate a short-lived user access token:

  1. Go to https://developers.facebook.com/tools/explorer/
  2. Select your app from the "Application:" drop-down list (top-right).
  3. Click "Get Token" > "Get User Access Token".
  4. In the "Select Permissions" window, enable "user_photos" and click "Get Access Token".

The token will appear in the "Access Token" field. This is a short-lived user access token and will expire in about an hour.

Finally, extend this token:

  1. In the left part of the "Access Token" field, click the access token info button () and,
  2. in the "Access Token Info" popup window, click the "Open in Access Token Tool" button.
  3. On the "Access Token Debugger" page that opens, click "Extend Access Token".

Now you can copy the token and use it with the functions that show Facebook images in Orckestra CMS.

Important. The "long-lived" access tokens are valid for about 60 days. These tokens will be refreshed once per day when the person using your app makes a request to Facebook's servers. If no requests are made, the token will expire after about 60 days and then you will have to go through the flow again to get a new token.

Getting a public Facebook page's unique ID

The public Facebook page's unique ID can be one of the following:

  • The last part of a custom URL of the Facebook page: e.g. MySuperPage in http://www.facebook.com/MySuperPage
  • Or the number appended to the name of your page (for a page without the custom URL), e.g. 248170027867477 in http://www.facebook.com/pages/MySuperPage-248170027867477

Getting a public Facebook album's ID

To get the ID of a public album associated with a Facebook page or your account:

  1. Open the album on Facebook.
  2. Copy the second part (separated with periods ) of the set query parameter, e.g. 170150170651630 in http://www.facebook.com/media/set/?set=a.170150170651630.34091.100002019540784&type=3