Getting Facebook Reactions with Graph API

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?

Answers


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"
}

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/


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


New reactions picture: http://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.


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.


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


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


Need Your Help

What does the question mark mean in GSP/Grails?

grails groovy operators gsp

I saw this in my generated GSP pages. What does the ? mean?