How to access Instagram feed of any user with new Graph API?

一世执手 提交于 2019-11-29 19:59:30

Prerequisite: You first need the business Instagram account to be linked with FB Page. https://help.instagram.com/356902681064399 - That one can do from the profile page of Instagram account.

  • Get the Instagram business account id: graph.facebook.com/v2.8/<fbPageId>?fields=instagram_business_account. (the fbPageId is the page id of the facebook page the account is linked)

  • To fetch instagram media feed: graph.facebook.com/v2.8/<igBusinessId>/media to fetch the media feed of the Instagram account. (the igBusinessId is the id returned in above linked instagram_business_account) - This is still owned media as per the page access_token. Not any other user's feed.

  • All other endpoints (such as comments moderation, detailed insights API) mentioned here works on the business media list returned on above call.

Please note: This still does not allow to fetch un-authenticated user's Instagram feed. That is not possible via API now. There is no valid way via API to get to public_content scope. There can be few Instagram Marketing partners for which this is enabled. But, in general the scope is deprecated now!

Currently, for FB graph API to work we need linked business page to Instagram account. As above apis uses page tokens.

You can get information about any IG business account using your FB access_token using the business_discovery API as given here.

  • You must have an IG business account to read other users data like user_info or media details using the id of your IG business account as a node.

Ex:

GET graph.facebook.com/[YOUR-IG-BUSINESS-ACCOUNT-ID]?fields=business_discovery.username(USERNAME){media{caption,media_url,media_type,like_count,comments_count,id}}

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!