Monu Yadav
Monu Yadav

Reputation: 570

How do I get post enagement using facebook graph api

I want to get post engagement for the posts on my page. However I get the following debug message in graph API explorer

The engagement field does not exist on the PagePost object.

This is what my query looks like

MY_PAGE/posts?fields=id,from,message,engagement,created_time,permalink_url,likes.limit(0).summary(true),insights.metric(post_engaged_users).period(lifetime)&limit=10

I could not find any metric on the insights page but browsing previous stackoverflow questions I found that 'engagement' is what you pass in query. I'm able to see the engagement for my posts through facebook. How can I retrieve the same using graph API?

Upvotes: 0

Views: 1882

Answers (1)

Geoffrey Bourne
Geoffrey Bourne

Reputation: 620

The endpoint is:

/{object-id}/insights?metric={metric-1},{metric-2},{metric-3},...

where object-id is your Page Id. You can choose the different post level metrics: https://developers.facebook.com/docs/graph-api/reference/v13.0/insights#page-post-impressions

Note the different time periods for each metric.

Be sure you have the correct permissions: read_insights, pages_read_engagement

Upvotes: 0

Related Questions