Reputation: 21
We have a solution where we use facebook graph API to handle the company fb-page for our customers. We read the comments and messages written on the page och may reply via the graph api. So far - no problem.
Now the customer is buying ads that is pushed into the newsfeed of fb-members. These ads have the pageid as sender. We want to access the comments that these ads generate from people.
I'm not sure how to access these comments thru the api!?
I tried with: /{page-id}/comments This return an error message: Tried accessing nonexisting field (comments) on node type (Page)
Or do I need to use the Marketing API?
Anyone that can point me in the right direction?! :o
Upvotes: 0
Views: 530
Reputation: 81
You should use Marketing API in order to get the ads. Some thing like this:
AdAccount account = new AdAccount(ACCOUNT_ID, context);
Map<String, Object> extraParams = new HashMap<>();
extraParams.put("fields", "creative{object_story_id},created_time,status");
APINodeList<Ad> ads = account.getAds().execute(extraParams);
for (Ad ad : ads) {
String objectStoryId = ad.getFieldCreative().getFieldObjectStoryId();
//now you can use /{objectStoryId}/comments
}
I used the facebook ads java api in this Example. Here https://github.com/facebook/facebook-java-ads-sdk.
Upvotes: 2