32

Facebook just released the new reaction button, but I can't figure out a way to get this information from the Graph API v2.5 as the /likes edge only returns the total count of interactions.

Has anyone figured out a way to get this detailed reactions per post?

3
  • 3
    There is no way as of now, reactions are being rolled out today. It will most likely come to the API soon.
    – andyrandy
    Feb 24, 2016 at 15:37
  • 1
    There is no official word from facebook when these will be available, but I am sure they will either remove the reactions altogether or provide an edge to get the data.
    – jimplode
    Feb 24, 2016 at 16:00
  • 1
    just wait for it to pop up in the changelog: developers.facebook.com/docs/apps/changelog
    – andyrandy
    Feb 24, 2016 at 16:24

7 Answers 7

11

EDIT: As of April 12th, 2016 Facebook has published a reactions endpoint for posts as part of their v2.6 release of the GraphAPI

GET /v2.6/{object-id}/reactions

More information can be found here: https://developers.facebook.com/docs/graph-api/reference/post/reactions

END EDIT

I'm not sure if Facebook has published this yet, but the reaction information is currently available in the Graph API v2.5. I pasted the response below. I achieved this result by hitting the insights endpoint. For each object listed in the response below, take a look at the 'id' property, it has more granular query endpoints.

GET /v2.5/{object-id}/insights

RESPONSE:

   {
  "name": "post_reactions_like_total",
  "period": "lifetime",
  "values": [
    {
      "value": 0
    }
  ],
  "title": "Lifetime Like Reactions",
  "description": "Lifetime: The total number of like reactions to your post.",
  "id": "{node_id}/insights/post_reactions_like_total/lifetime"
},
{
  "name": "post_reactions_love_total",
  "period": "lifetime",
  "values": [
    {
      "value": 0
    }
  ],
  "title": "Lifetime Love Reactions",
  "description": "Lifetime: The total number of love reactions to your post.",
  "id": "{node_id}/insights/post_reactions_love_total/lifetime"
},
{
  "name": "post_reactions_wow_total",
  "period": "lifetime",
  "values": [
    {
      "value": 0
    }
  ],
  "title": "Lifetime Wow Reactions",
  "description": "Lifetime: The total number of wow reactions to your post.",
  "id": "{node_id}/insights/post_reactions_wow_total/lifetime"
},
{
  "name": "post_reactions_haha_total",
  "period": "lifetime",
  "values": [
    {
      "value": 0
    }
  ],
  "title": "Lifetime Haha Reactions",
  "description": "Lifetime: The total number of haha reactions to your post.",
  "id": "{node_id}/insights/post_reactions_haha_total/lifetime"
},
{
  "name": "post_reactions_sorry_total",
  "period": "lifetime",
  "values": [
    {
      "value": 0
    }
  ],
  "title": "Lifetime Sorry Reactions",
  "description": "Lifetime: The total number of sorry reactions to your post.",
  "id": "{node_id}/insights/post_reactions_sorry_total/lifetime"
},
{
  "name": "post_reactions_anger_total",
  "period": "lifetime",
  "values": [
    {
      "value": 0
    }
  ],
  "title": "Lifetime Anger Reactions",
  "description": "Lifetime: The total number of anger reactions to your post.",
  "id": "{node_id}/insights/post_reactions_anger_total/lifetime"
},
{
  "name": "post_reactions_by_type_total",
  "period": "lifetime",
  "values": [
    {
      "value": {
        "like": 0,
        "love": 0,
        "wow": 0,
        "haha": 0,
        "sorry": 0,
        "anger": 0
      }
    }
  ],
  "title": "Lifetime Reactions by type",
  "description": "Lifetime: The total number of reactions to your post by type.",
  "id": "{node_id}/insights/post_reactions_by_type_total/lifetime"
}
4
  • Was this from a photo of a comment. I can't find it on a photo I'm looking at... and finding it hard to find the ID of one of my comments to double check. Apr 7, 2016 at 20:26
  • OK researched a bit more... insights are only available on page/domain/and posts... and posts with only 30 likes or more. src: developers.facebook.com/docs/graph-api/reference/v2.5/insights Apr 7, 2016 at 21:29
  • 1
    should add a note that the insights API has a pretty long delay and also will double count reactions if someone changes it (if someone first does a love reaction and then changes it to haha, both love and haha will be 1). If you are trying to get realtime results you are better off using the actual reactions API, unfortunately you have to parse the total numbers yourself
    – Dani
    Nov 11, 2016 at 21:05
  • Just for completion, you don't have to count total by yourself in reaction API. Here is example stackoverflow.com/questions/36906590/…
    – slawek
    Nov 21, 2016 at 10:18
6

Facebook just released Graph API 2.6 and the reaction endpoint is available like so

GET /v2.6/{object-id}/reactions

Which returned something like

{
  "data": [
    {
      "id": "ACCOUNT-ID",
      "name": "ACCOUNT-NAME",
      "type": "HAHA"
    },
    {
      "id": "ACCOUNT-ID",
      "name": "ACCOUNT-NAME",
      "type": "LIKE"
    }
  ],
  "paging": {
    "cursors": {
      "before": "TkRZAMU9EWTROakF6TmpBM01qYzJPak2TnpnNE5qUTRNRE0zT1RFek16RXkZD",
      "after": "TVRBd01EQTNOekEwTWpnME1EUTJPakUwTazJNVFl4TXc9PQZDZD"
    }
  }
}

More infos here : https://developers.facebook.com/docs/graph-api/reference/post/reactions/

6

Try

GET /v2.5/{post_id}/insights/post_reactions_by_type_total

Which returns

{
 "data": [
  {
     "name": "post_reactions_by_type_total",
     "period": "lifetime",
     "values": [
        {
           "value": {
              "like": 9,
              "love": 0,
              "wow": 1,
              "haha": 0,
              "sorry": 0,
              "anger": 0
           }
        }
     ],
     "title": "Daily total post reactions by type.",
     "description": "Daily total post reactions by type.",
     "id": "{post_id}/insights/post_reactions_by_type_total/lifetime"
   }
 ],
}

I have had some luck using the same in Facebook Graph API 2.3, but not for every request

1
  • This will only work if you have a page access token. Other use-cases might not have access to one.
    – Dean
    May 4, 2016 at 12:01
3

The next version of the GraphAPI (2.6) is due out in March/April timeframe -- so I would expect to see it there.

3

New reactions picture: https://i.stack.imgur.com/d6kcp.jpg

There aren't any information about this topic so I want to add somethings.

The next version of the GraphAPI (2.6) is due out in March/April timeframe -- so I would expect to see it there. (Thank you Justin Bowler)

Now at the graph api 2.5 new facebook reactions don't counting. If you look at post likes you can't see them so we must wait new api version.

3

The reactions are already available via insights API v2.5. You can get them on post level via post_reactions_by_type_total edge and on page level via page_actions_post_reactions_total edge.

1
  • Any idea how to call this API for live videos? I mean should I make an app for that or is there any other way like webhook or something, Please tell me how do I get started
    – Rickie
    Nov 14, 2016 at 11:53
1

The new reaction are not being counted at all right now. the current API is only surfacing the count for the like button, wow, sad, ETC clicks are not being counted in the likes bucket

Not the answer you're looking for? Browse other questions tagged or ask your own question.