Facebook Page Posts read_insights Permissions

70 views
Skip to first unread message

Glen Noworyta

unread,
May 26, 2020, 8:56:16 PM5/26/20
to PythonForFacebook
Hello,

First off, I'd like to give thanks for this great SDK -- it's been very helpful for getting FB/Instagram post Insights. However, I'm currently stuck on something and Facebook Developers Community has not been able to assist -- I've successfully obtained FB Page Post Insights for a FB Page which I am an Analyst on. My coworker is also an Analyst for that page, but is unable to obtain those same Insights. So my question is: are there additional permissions or additional code I need to implement to give read_insights access to another user of my app? I realize this might not be an issue with the SDK, but I figured I'd post here anyway because I'm running out of ideas. Thank you in advance! The code I've written to first obtain a User Token, then obtain the Page Access Token for the Page in question, then call the Graph API to get the needed Insights is below:

access_token = g.user['access_token']
fb_id = session.get('fb_id') //this is the FB Page ID
graph = facebook.GraphAPI(access_token)
page_token = graph.request(fb_id+'?fields=access_token&access_token='+access_token)
graph2 = facebook.GraphAPI(page_token['access_token'])

... //I've omitted code which obtains FB Posts from the Page in question within a certain date range

post_metrics = graph2.request(post_id+'?fields=permalink_url,created_time,icon,message,likes.summary(1).limit(0),comments.summary(1).limit(0),shares,insights.metric(post_video_views,post_consumptions_by_type)')
Reply all
Reply to author
Forward
0 new messages