Get Reactions from Timeline Post via Facebook Graph API – Swift – iOS

Facebook Reactions
Facebook Reactions

New version of SDK is 4.16.x(Swift) and Graph API Version is 2.8.

With the Graph API 2.6 Facebook has given support to fetch (read only) the Reactions on Timeline Posts.

Post is updated for iOS 10 and Swift 3

API documentation is available here.

Let’s learn how to get reactions from the post

Install pods

Login with Facebook

I have already written a tutorial on Facebook Login.

Get Facebook Posts via Graph API

We can get the Facebook post via graph API : /me/posts for that we have to add user_posts permission with login.

Get Reactions from one of the Post

We can get the Facebook post reactions via graph API : /{post-id}/reactions. We have to pass parameters like fields and summary as described in getReactions function.

Note : Here I am writing sample for only first post.

Response should be like

Type of reactions : NONE, LIKE, LOVE, WOW, HAHA, SAD, ANGRY

#Like #Share #React ๐Ÿ™‚ ๐Ÿ˜› ๐Ÿ˜€

Happy coding ๐Ÿ™‚

  • Karzan Ahmed

    hello bro can you help me how i can make this for Reactions
    it is working only likes
    https://graph.facebook.com/{post-id}/likes?method=POST&access_token= TOKEN

    for Reactions ??

    https://graph.facebook.com/{post-id}/?????????????????????????????????????????????

  • Karzan Ahmed

    hello bro can you help me how i can make this for Reactions
    it is working only likes
    https://graph.facebook.com/{post-id}/likes?method=POST&access_token= TOKEN

    for Reactions ??

    https://graph.facebook.com/{post-id}/?????????????????????????????????????????????