Usman Ali Zafar
Usman Ali Zafar

Reputation: 1

How do we can get story insights of Instagram with graph api?

I want to get Instagram stories insights which published in the last 24 hours. I currently only access to story basic details alike, story image, owner id, etc with this api:

https://graph.facebook.com/story_id/?fields=id,media_type,media_url,owner,timestamp,caption&access_token={access_token}

Actually i want to get all details which is that: exits,impressions,reach,replies,taps_forward,taps_back

but when I try this with this api:

https://graph.facebook.com/story_id/insights?metric=exits,impressions,reach,replies,taps_forward,taps_back&access_token={access_token}

it show me that error. always.

{
  "error": {
    "message": "(#10) Not enough viewers for the media to show insights",
    "type": "OAuthException",
    "code": 10,
    "fbtrace_id": "AvZdhqaXB1_Dij7B1DD-pSR"
   }
}

even that on reference of graph api they tell us do same like : Reference: https://developers.facebook.com/docs/instagram-api/reference/media/insights#create

I dont know how to fill butt it shows me error always

https://i.sstatic.net/55rBy.png

Upvotes: 0

Views: 5966

Answers (1)

andyrandy
andyrandy

Reputation: 73994

You need to set up a webhook for it:

Your webhook URL will get the insights of a story (or media object, to be specific) right when it disappears, with a POST request from Instagram.

Careful though, you cannot access the story details anymore if you get the webhook, so you have to get the stories when they exist (for example, with a cron job that runs at least every 23h to get all stories) and add the insights data later by matching the media id.

Upvotes: 0

Related Questions