Sonntag, 8. Januar 2017

Use Instafeed.js after Instagram policy update 2016

Hello world, yesterday i tried to integrate the Instagram feed of the male model Lukas Bachert into the rework i'm currently doing for his website. I stumbled upon the gorgeous api Instafeed. When i started to use it i had some trouble regarding the authentication so i wanted to just sum up what a did to get everything working.

Become an Instagram Developer

Login to your Instagram account and go to https://www.instagram.com/developer/. Create a client by filling out the form. Afterwards you need to invite the user whose feed you want to integrate to the website as a sandbox user. To do so "manage" the client you just created and go to the Sandbox tab. Please mind that the user won't get notified about this invitation. He needs to login to the developer page aswell and afterwards he can accept the invite using the "Sandbox Invites" tab in the header.

Generate a token

In order to not make your visitors login to their instagram account you need to generate a static token to access the Instagram api with. Go to https://instagramtoken.com/ and follow the instructions.

Retrieve User ID

A simple way to get the user ID is to visit https://smashballoon.com/instagram-feed/find-instagram-user-id/ and just fill out the form.

Making the call

Now that we prepared everything we are able to actually show the feed on our website and like the Instafeed description states: it's dead-simple! Add a div with the id instafeed to your website or just use the target property of the Instafeed configuration and run this javascript snippet:
feed = new Instafeed({
    get: 'user',
    userId: 'USER_ID',
    clientId: 'CLIENT_ID',
    accessToken: 'ACCESS_TOKEN',
});
feed.run();
That's all the magic. Like i said, dead-simple! Review the Instafeed documentation to see how you can configure Instafeed. Cheers, Loris