How to get facebook comments of ads posts using Facebook Graph API - facebook

I am the admin of my companies Facebook page. I'm trying to get all the ads for the Facebook page using the Graph API. The access token that I use has the following permissions:
read_insights
manage_pages
ads_read
ads_managment
...
How can I get the comments below the ads posts?
This is what I tried using Graph API:
my_page_ID/ads_posts
What I get is this:
{
"data": [
{
"created_time": "2020-03-26T14:42:38+0000",
"message": "We have the best price. Please come to us!",
"id": "4353425346_5634563463622263"
},
{
"created_time": "2020-03-26T12:28:35+0000",
"message": "This is some add",
"id": "65464567_687456456"
},
{
"created_time": "2020-03-26T12:19:34+0000",
"message": "This is the message of the ad.",
"id": "123456789_463456534623"
},
{
"created_time": "2020-03-20T08:06:44+0000",
"id": "34534588605_358563733107"
},
{
"created_time": "2020-03-20T08:06:44+0000",
"id": "388533217888605_3586754538066441"
},
{
"created_time": "2020-03-20T08:06:44+0000",
"id": "34353417888605_5844534530"
},
{
"created_time": "2020-03-20T08:06:44+0000",
"id": "38854535405_230852376563421"
},
{
"created_time": "2020-03-20T08:06:18+0000",
"id": "382342345605_358677843899"
What I do not understand:
Why are most fields empty? Am I doint sth. wrong? Do I need more permissions?
How can I retriev all ads posts and not just a few?
How can I retriev the user comments below these posts?
Hope you can help me with this.

Easy peasy!
/{page-id}/ads_posts?include_inline_create=true
Includes all Ads Posts (Dark Posts)

Related

How can I get all photos in one post in a page using Graph API?

For example this graph
https://graph.facebook.com/audi/posts?access_token=[ACCESS TOKEN]&fields=id,message,picture,link,name,description,type,icon,created_time,from,object_id&since=2016-10-14T17:54:17+0000&limit=1
will give you this result(after replace ACCESS TOKEN with your access token ) :
{
"data": [
{
"id": "96585976469_10153772437221470",
"message": "Take a night tour of Capitol Hill with the #AudiRS7. #AudiDuel",
"picture": "https://scontent.xx.fbcdn.net/v/t1.0-0/s130x130/14680669_10153772435521470_6025374941796908984_n.jpg?oh=3654e74f79914c9bb0fa596ce8434c46&oe=589E82B4",
"link": "https://www.facebook.com/audi/photos/a.101113351469.101662.96585976469/10153772435521470/?type=3",
"name": "Photos from Audi USA's post",
"type": "photo",
"icon": "https://www.facebook.com/images/icons/photo.gif",
"created_time": "2016-10-14T17:54:17+0000",
"from": {
"name": "Audi USA",
"id": "96585976469"
},
"object_id": "10153772435521470"
}
],
"paging": {
"previous": "https://graph.facebook.com/v2.5/96585976469/posts?fields=id,message,picture,link,name,description,type,icon,created_time,from,object_id&limit=1&since=1476467657&access_token=[ACCESS TOKEN]&__paging_token=[ACCESS TOKEN]&__previous=1",
"next": "https://graph.facebook.com/v2.5/96585976469/posts?fields=id,message,picture,link,name,description,type,icon,created_time,from,object_id&limit=1&since=2016-10-14T17\u00253A54\u00253A17+0000&access_token=[ACCESS TOKEN]&until=1476467657&__paging_token=[ACCESS TOKEN]"
}
}
and this is the link of the post
https://www.facebook.com/audi/posts/10153772437221470
it gave me just the first one photo but I need all photos in this post
attachments is the field you are looking for.
(Seems not officially documented, perhaps because those aggregate posts are special. But Graph API Explorer suggests it as one of the available fields.)

In FaceBook Graph API v2.4, how can I include pictures/icons of the posts in the JSON feed?

I'm able to get JSON posts feed for a Public Group Page in FaceBook. However, the feed is limited to the following:
{
"data": [
{
"message": "RT Ad Age: Creatives rejoice! The need for speed in digital is putting copy testing under fire http://buff.ly/1NCNUYm",
"created_time": "2015-09-16T19:17:22+0000",
"id": "100893736659527_876911945724365"
},
{
"message": "Smart Design Means Treating Your Users Like Friends.",
"created_time": "2015-09-15T19:17:07+0000",
"id": "100893736659527_876382499110643"
},
{
"message": "Amazon Puts Another Nail in Flash\u2019s Coffin http://buff.ly/1NzwFal (via Digiday)",
"created_time": "2015-09-14T17:25:52+0000",
"id": "100893736659527_875881985827361"
},
{
"message": "Is Belvedere Vodka Good Enough For James Bond?",
"created_time": "2015-09-11T19:17:14+0000",
"id": "100893736659527_874377899311103"
},
{
"message": "RT MailChimp: Our GIPHY integration makes it easy to upload GIFs into your campaign. Exciting, right? http://buff.ly/1JQChqz",
"created_time": "2015-09-10T19:17:14+0000",
"id": "100893736659527_873864092695817"
}
}
I'm able to get the message text, created_time, and id. How can I include pictures/icons of the post?
After #WizKid responded above, this what worked for me: https://graph.facebook.com/v2.4/[page-id]/feed?access_token=[access_token]&fields=picture,id,message

Permissions to get comments of post user is tagged in on facebook

I'm attempting to do some analysis of a user's Facebook data, so I'm attempting to collect as much as possible. Using the Facebook graph api, which permissions do I need to request in order to get the comments for a post the user is tagged in. If the post is on the user's wall, it isn't a problem, but if the user is tagged in a post on a friend's wall no comments are there, and the count is set to 0.
I'm making a request to //feed with what I believe to be a valid access token from my application. However, using the graph explorer tool from Facebook the same situation happens. I assume the problem is a permission I am missing, but can't seem to figure out which one I should add.
I'm currently requesting the following permissions:
friends_photos
friends_likes
friends_checkins
friends_status
user_photos
user_likes
user_checkins
user_status
read_mailbox
read_stream
{
"id": REDACTED,
"from": {
"name": REDACTED,
"id": REDACTED
},
"to": {
"data": [
{
"name": REDACTED,
"id": REDACTED
}
]
},
"message": REDACTED,
"message_tags": {
"121": [
{
"id": REDACTED,
"name": REDACTED,
"type": "user",
"offset": 121,
"length": 11
}
]
},
"privacy": {
"value": ""
},
"type": "status",
"created_time": "2013-03-13T14:25:44+0000",
"updated_time": "2013-03-13T14:25:44+0000",
"comments": {
"count": 0
}

Access social readers' posts in a facebook App

How can a facebook app, have access to a social reader's post in the feed? For example, I want to have access to Washington Post's social reader post (when someone else reads an article there and it gets shown up in my news feed) from an app that I am writing. Is it possible to do so, using FQL?
It's easily available in the Graph API (i'll check if it's in FQL)
Basically, either way you'll need to request the user_actions.reads permission from your users. (NB: not user_actions:reads which would be for an app whose namespace is 'reads', for news, music and video apps using the build-in actions there's a special scope)
Then, for the Graph API, just make a call to /USER_ID/news.reads - the response includes the recently read articles from all apps using the built-in 'read' action, example response for my account below:
{
"data": [
{
"id": "REMOVED_ID",
"from": {
"id": "REMOVED_MY_USER_ID",
"name": "REMOVED_MY_NAME"
},
"start_time": "2012-05-10T00:05:10+0000",
"end_time": "2012-05-10T00:05:10+0000",
"publish_time": "2012-05-10T00:05:10+0000",
"application": {
"id": "235586169789578",
"name": "The Independent"
},
"data": {
"article": {
"id": "10150697347986736",
"url": "http://www.independent.co.uk/life-style/food-and-drink/features/the-10-best-scotch-whiskies-1488408.html",
"type": "article",
"title": "The 10 Best Scotch Whiskies"
}
},
"likes": {
"count": 0
},
"comments": {
"count": 0
}
},
.... //more articles

How do you retrieve the "Place" field of a Facebook Graph Post object?

I am trying to retrieve the "Place" field of a Facebook Graph Post object from a Facebook friend. After obtaining an access token with the friends_status and read_stream permissions, I request from the Graph API like so:
http://graph.facebook.com/[user_id]_[post_id]
What is returned are some of the fields described in the Graph API docs for Post:
{
"id": "1164358582_2458311174854",
"from": {
"name": "Joe Blo",
"id": "1164358582"
},
"message": "Is pretty bummed today",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/1164358582/posts/2458311174854"
},
{
"name": "Like",
"link": "http://www.facebook.com/1164358582/posts/2458311174854"
}
],
"type": "status",
"application": {
"name": "Facebook for Android",
"id": "350685531721"
},
"created_time": "2011-11-20T03:23:04+0000",
"updated_time": "2011-11-20T12:12:49+0000",
"comments": {
"data": [
{
"id": "1164358582_2458311174852_2962531",
"from": {
"name": "Sue Candy",
"id": "1056617421"
},
"message": "OMG I'm so sorry!!!",
"created_time": "2011-11-20T03:25:06+0000"
}
],
"count": 1
}
}
This is all fine and dandy, except for the fact that when I see this Post within my Facebook stream, it also shows a location accompanying the post:
9 hours ago near El Reno, OK
I expected the El Reno, OK Place object returned as a field within this Post, but I don't see it.
In the Facebook Graph API Explorer, I've tried enabling almost every permission and I am not seeing any difference in the response (no "Place" field returned). Am I going about this incorrectly?
Not 100% sure but I think you can only get the "place" info if it is of type "checkin". I totally get where you are coming from, I wondered about that myself.
https://developers.facebook.com/tools/
Try the Graph API Explorer Tool if you haven't already looked at it.