Instagram for LiveWhale

LiveWhale CMS connects to Instagram to pull images and captions from your account(s) into one or more Instagram widgets on your site.

Before you can do those things, though, you’ll need to setup a Instagram App in the Facebook App Tools, and then plug the Instagram App credentials into your LiveWhale configuration file.

Note: These instructions are updated as of March 2020 to comply with changes to the Facebook/Instagram API.

Setting up an Instagram App

We use the new Instagram Basic Display API and User Token Generator to pull your posts. From the Facebook/Instagram docs (emphasis added).

The Instagram User Token Generator is a tool you can use to quickly generate long-lived Instagram User Access Tokens for any of your public Instagram accounts. This is useful if you’re testing your app and don’t want to bother with implementing the Authorization Window, or if you’re using copy and pasteable code supplied by a third-party service (for example, to display your own Instagram data on your own website).

The tool works by triggering the Authorization Window, which you can sign into with a public Instagram account that you have designated as a tester account. After signing in, the tool will generate a long-lived access token that you can copy and paste. Note that tokens can only be generated for public Instagram accounts.

To setup your account(s):

  1. First, follow steps 1–3 on this page to create your app and assign your Instagram user(s) as test accounts.

  2. Then, go to My Apps and click your App Name, then from the Dashboard find Products > Instagram > Basic Display

    Instagram User Token Generator

    Once you login with your account(s) to approve the test access, you can click “Generate Token” to get an access token. Copy that token.

  3. Edit livewhale/core/config.php to add the “INSTAGRAM” section to the Credentials array, replacing my_instagram_username with your Instagram username and pasting in your access token in place of my_access_token:

    1
    2
    3
    4
    5
    6
    $GLOBALS['LIVEWHALE_CONFIG']['CREDENTIALS']=array(
    ...
    'INSTAGRAM'=>array(
    'my_instagram_username'=>'my_access_token',
    )
    );

    To support multiple accounts, you can add additional lines to this area:

    1
    2
    3
    4
    5
    6
    7
    8
    $GLOBALS['LIVEWHALE_CONFIG']['CREDENTIALS']=array(
    ...
    'INSTAGRAM'=>array(
    'my_instagram_username1'=>'my_access_token1',
    'my_instagram_username2'=>'my_access_token2',
    'my_instagram_username3'=>'my_access_token3',
    )
    );

With those changes saved, you can now login and create/edit an Instagram widget for each username you added in the above steps.