Facebook post impressions are null in FQL stream query

According to the FQL Stream documentation the following query is supposed to return impression counts when run by an authenticated page owner, yet it never does. We have the page owner authenticating directly in the graph api explorer with extended permissions (read_stream, read_insights), but the impression counts are always null.

Is anyone able to get this working?

SELECT post_id, actor_id, message, impressions FROM stream WHERE actor_id = {owned_page} and source_id = {owned_page}

Answers


I think its missing in the documentation, but you should make this call using the page access token instead of user access token to get it worked.

So here are the steps:

  1. Get the following permissions from the user and get the user access_token:

    • manage_pages - to get the page access token
    • read_insights - to read the impressions (as mentioned in the doc)
    • read_stream - for all posts that the current session user is able to view
  2. Using that token, get the page access_token with the call-

    /{page-id}?fields=access_token

  3. (optional) Check out my answer here to extend this page access token that will never expire. (Basically to avoid some steps)

  4. Using the page access token, run your query-

    SELECT post_id, actor_id, message, impressions FROM stream WHERE actor_id = {owned_page} and source_id = {owned_page}

    This will fetch you the impressions(if any) in the result.

Hope that helps.!


Need Your Help

What is the proper way to handle imported files in iOS 9?

ios xcode xcode7 ios9

My app includes the ability to open .plist files in it. My info.plist file has all the necessary entitlements, and opening the document in my app works fine. The problem is I don't know the proper ...

Output in XML format in Microsoft Cognitive Service web search API

r api microsoft-cognitive

I m doing a search in the Api of web search with this URL in R