0

I'm implementing webhook subscription to receive notifications about new comments on Instagram media (so, the solution assumes server side environment). Webhook payload contains a comment ID. Fetching a comment node via Facebbok API Graph call I can get author's username. From this point I need to get author's profile picture.

Currently I can use Business Discovery API to get information about user by username like this

GET graph.facebook.com/%PAGEID%
    ?fields=business_discovery.username(%USERNAME%){...fields...} 

But this method is working only for Instagram Business accounts.

Recently, this task can be accomplished with https://www.instagram.com/%USERNAME%/?__a=1 call, but now this request requires authorization.

Olegas
  • 10,349
  • 8
  • 51
  • 72

1 Answers1

0

You cannot get the user profile picture by using the username, because facebook denies querying users by their username:

(#803) Cannot query users by their username

Even if, indeed, getting the facebook picture of a user does not require an access token or any permissions.

You need to get the userid (10000xxxxxxxxxx), and then you'd be able to:

GET https://graph.facebook.com/v3.2/{userid}/picture
Adelin
  • 7,809
  • 5
  • 37
  • 65
  • So, now the question is "Is it possible to get userid by instagram username" ) – Olegas Apr 24 '19 at 17:27
  • That would defeat the purpose of the restriction. There are multiple topics on that, here is one of them https://stackoverflow.com/questions/25306754/how-to-get-user-id-by-username-in-facebook-graph-api-v2-1 – Adelin Apr 24 '19 at 17:51
  • 2
    This endpoint appears to require authorization and my Instagram Basic Display token returns an `Invalid OAuth access token`, `190` response. Can you provide more context for your solution? – Luke Pighetti Oct 22 '19 at 15:20
  • @LukePighetti i just retried and it works the same way, no authorization required with a GET req over an id of this format `10000xxxxxxxxxx`. – Adelin Oct 23 '19 at 03:32
  • 1
    Does this work with a normal instagram userid? I've got it here in postman failing every time. – Luke Pighetti Oct 23 '19 at 22:42
  • 2
    `GET https://graph.facebook.com/v3.2/15239448540/picture`. `"message": "An access token is required to request this resource.",` – Luke Pighetti Oct 23 '19 at 22:50