Getting all comments in a Facebok fanpage


Hi there,

First thing I ought to do is to thank you guys for all the documentation and easeness of use of Datasift. I think you are really making a superb job here.

Now, my question. I am trying to capture all the posts getting written to a certain set of Facebook fan pages (e.g. McDonald’s page This includes not only the posts by the owner of the page himself, but also all replies and new posts by other facebook users in that page. Should be a pretty easy thing to do, but for some reason I am failing to achieve that.

My first attempt was to use in ""

but I am probably using it incorrectly, since it doesn’t seem to be working. I am unsure whether this captures all the posts in that URL or all the posts by the user that URL belongs to. Can you give me any advice on this?


Using or would be the best targets to use to filter for content being created by McDonalds. or will be the best targets to use to filter for content sent to McDonalds. 


Thanks for your answer Jason. I have been adding a clause to my streams, which I guess should produce all the messages posted to a fan page (except maybe those from the fan page owner himself), but I am still failing to receive those interactions.

I am using a query in this form: in “50245567013”

I suppose there must be a very basic error here, but I cannot spot it. Does “in” works for this kind of target, which is an array?

I have also tried to filter by words in content on all Facebook, and this works great, but I have noticed that the field is not present in the data I get. Is this to be expected?

#4 will only be present if the message was being sent to someone. 

The IN operator is the best operator to use in this case - yes. 

We currently use the Facebook Open Graph API to retreive Facebook data. Unfortunately Facebook do not guarantee that this will reliably return 100% of their posts, so there is a chance we will miss some Facebook posts.


Thanks again Jason, though I think I am missing the point on what kind of interactions refers to. Does this field tell which facebook users were mentioned in the post? I am afraid what I need is to know in which facebook page (fanpage / profile page) they were published to.

One way I could easily achieve all this would be by filtering by Facebook comment id, since it follows the structure [PAGEID]_[COMMENTID], and I know the ids of the pages I need to track. However, is not accepted by Datasift’s CSDL editor, even though this field is contained in the data. The full link to the Facebook comment would also work, but I can’t see it populated in the data…

#6* is the profile(s) mentioned or targeted in the post (taken from the Facebook Developers site). So, if I were to post any of the following:

- "Do you want to go to Buckingham Palace tomorrow?" (Posted on Jack's profile)

- "I'm going to Buckingham Palace with Jack" (Set as my status)

- "I'm at Buckingham Palace - with Jack" (Check-in via Facebook Places)

Jack would be the subject of*.

We can not filter by a Graph API post ID, as although we may know the ID of a page, we do not know what the ID of the comment will be until after it has been posted. There are certain elements you will find in the output data which you will not be able to filter on with CSDL, such as the ID of a post or the created_at time of a post. 


Thanks a lot Jason, that certainly helps.

What you say makes a lot of sense. But it seems to me, that the* target includes only posts, not comments. That is to say, if we have the following messages:

  • “Do you want to go to Buckingham Palace tomorrow?” (Posted on Jack’s profile)
    • “Sure!” (Posted as a comment to the post above)

Then I could catch the first post using = “Jack”, but probably not the second. At least this is what I can infer from Facebook Developers’s site, where comments are presented as not having a “to” field. Am I correct? And if so, how could I capture these comments through Datasift?


Unfortunately, using the Graph API Search, we are currently unable to return comments for posts. We are currently working on an improved version of the Facebook data source, which will include comments on posts.


Understood, thanks for all your help Jason. Fetching Facebook comments would be of great value for me, so I look forward to your improvements in your Facebook data source.


Hi Jason - If you were searching for posts to Jack and posts from Jack, would you capture that “Sure!” reply, and be able to ascertain that it was a reply to a post sent to him?


If the “Sure” reply is a comment on a post - yes, you would be able to see the association between the original post and this replying comment by looking at the post ID.If Jack were to write a status on Jill’s wall, and Jill replied by writing a status on Jack’s wall, there would be no connection between these two messages. I do not believe Facebook currently supports links between status posts in this way.



Does Datasift allow us to get all informations of a Facebook’s profile ?
The sample only presents informations for 1 comment and 1 like.

Can you give me a sample with some posts and comments ?

Thank you


You can gather some sample data by creating a stream to consume real Facebook interactions.


With a stream we can get all data in real time. It’s interesting but it’s not the question for the moment.

In this page it’s a good sample but it’s just for 1 comment and 1 like.
How does it work if they are some comments and some likes and some posts ?


An example of a like could be:

  "facebook_page": {
    "page": {
      "link": "",
      "category": "Athlete",
      "username": "Username",
      "name": "User name",
      "id": "347783"
    "post": {
      "created_time": "Tue, 18 Feb 2014 19:01:58 +0000",
      "content": "Helping direct my The Chia Co commercial:",
      "link": "",
      "type": "video",
      "id": "3477833...833204226"
    "type": "like",
    "from": {
      "name": "Some user",
      "id": "7123"
An example of a comment could be:
  "facebook_page": {
    "id": "1015196564...1936",
    "from": {
      "name": "User name",
      "id": "12572"
    "message": "Looks like cosy corner , coney beach Porthcawl to me?",
    "like_count": 0,
    "created_time": "Wed, 19 Feb 2014 08:12:18 +0000",
    "type": "comment",
    "post": {
      "id": "8126962...71481207058",
      "type": "photo",
      "link": "",
      "content": "Undisclosed location...  #photooftheday",
      "created_time": "Wed, 19 Feb 2014 00:00:00 +0000"
    "page": {
      "id": "81269622057",
      "name": "ASP World Tour Surfing",
      "username": "ASP",
      "category": "Sports league",
      "link": ""



Thank you Jason.

So if I understood the process with the stream I can refresh informations in real time and I can get all informations on a page with this sample.

It’s ok ?


When you subscribe to a Facebook Pages Managed Source, you will receive all posts close to real-time, and any likes and comments made on posts created in the last 7 days via your subscription. For a more detailed overview of what Facebook Pages Managed Sources can offer, take a look at our Managed Sources documentation.