I am trying to GET IG User insights from the Facebook Graph API within R, but unfortunately my script returns an error. I did my best to solve this issue by myself was wasn't able to do so.
I already tried other metrics in my script, but the same issue occurs.
access_token <- *[my user access token]*
user_id <- *[my IG user ID]*
insights <- GET("https://graph.facebook.com/",
path = "me/insights/",
query =list("metric" = "audience_city", "access_token" = access_token))
content(insights)
I expected data about my audience, but received the following error:
$error
$error$message
[1] "(#100) The value must be a valid insights metric"
$error$type
[1] "OAuthException"
$error$code
[1] 100
$error$fbtrace_id
[1] "xxxxxxxxxxxxxxxxxxx"
You cannot use the me shorthand here because it'll refer to token not the actual IG account. Replace "me" with the actual IG user/account ID and it'll work fine.