Search code examples
facebookfacebook-graph-apifacebook-ads-apifacebook-permissionsfacebook-marketing-api

Facebook Ads API: instagram-ad-related response coming as an empty JSON


I'm in the middle of building an instragram-ads-crawling webservice. I mapped my functionality's way though the REST requests in the cryptic API's documentation and, after a crapload of authorizations and mixed old and new naming conventions (adgroup vs ad, for example), I finally managed to make my way to one very important call that behaves weirdly. I explain:

Firstly, for the sake of argument, I made the following call:

https://graph.facebook.com/v2.6/<adcreative_id>?fields=comment_count,like_count&access_token=<my_token>

It works beautifully, and I get something like this:

{
  "comment_count": 4,
  "like_count": 175,
  "id": "<adcreative's_id>"
}

When reaching for the adcreative's comments, one of two things deterministically happen. Say I submit the following call:

https://graph.facebook.com/v2.6//comments?fields=message,created_at,comment_type,instagram_user&access_token=

(1) When all the post has is its caption (which the API sees as a comment as well), it sends me a perfectly good reply like:

{
  "data": [
    {
      "message": "here goes the actual ad's caption, as written by the advertiser",
      "created_at": "2016-04-22T18:36:01+0000",
      "instagram_user": {
        "id": "0123456789"
      },
      "comment_type": "CAPTION",
      "id": "<actual_comment_id>"
    }
  ]
}

(2) When the post has actual comments (any number above zero not counting the CAPTION comment), I always get an empty response:

{
  "data": [
  ]
}

I double checked the permissions I ask the user to grant on authentication, which are currently ads_management, ads_read, page_management and read_insights. I also checked that I've authorized the involved AdAccount to use the Ads API. Lastly, I even verified that the User Account im logged in to has advertiser rights on the AdAccount I'm trying to read from.


Solution

  • Adding the answer from the comments. The solution in this case was to use <instagram_story_id> as opposed to <adcreative_id>.