usds / website

https://www.usds.gov
Other
55 stars 42 forks source link

Old Instagram API deprecated. Find replacement. #464

Closed jaredcunha-usds closed 5 years ago

jaredcunha-usds commented 5 years ago

Instagram accelerated deprecation of their API, so we can no longer use the script we were using to pull images from our instagram feed.

Instagram is now using the Instagram Graph API, so we will have to use that.

@dmethvin-gov Any chance you want to look into this if you have time?

dmethvin-gov commented 5 years ago

What does the timeline look like for this? It would be fun to investigate but it may be a week or two.

jaredcunha-usds commented 5 years ago

I don't think the world is going end if it takes us some time.

dmethvin-gov commented 5 years ago

@jaredcunha Looking at this today, I'll leave notes here.

Our current IG setup is in instagram.js and looks to have been built with someone's personal account number. The new API doesn't allow that.

The Instagram Graph API requires an Instagram Business Account or Instagram Creator Account, do we have either of those? Who would know? I'll ask on Slack. Those IG setups have to be linked to a Facebook account (and not a personal one).

From what I can gather the User of the IG account needs to create an IG Media Album and we need to put any photos that we want in the front-page carousel into that. These are the API instructions but I'm not sure of the create/authorize part that has to be done and what steps it takes to put photos in that album.

The best explanation I've found so far is this personal blog post which points out it's no longer possible to fetch photos via exclusively client-side code. We'll need to rewrite it to have the photos pulled by the server, or run some occasional job to update them somehow.

dmethvin-gov commented 5 years ago

Facebook hasn't answered us yet to "approve" our "app". There's no particular reason that we should need their permission to display our own Instagram photos so I've gone back to good old screen scraping. There's a JSON payload in the HTML page that has everything we need.