Manage post reactions
Learn how to list, add, and remove reactions on Facebook posts and comments with Unipile API.
Facebook posts and comments use the following reaction types:
reaction value | Reaction |
|---|---|
facebook_like | Like |
facebook_love | Love |
facebook_care | Care |
facebook_haha | Haha |
facebook_wow | Wow |
facebook_sad | Sad |
facebook_angry | Angry |
List reactions
On a post
To list the reactions on a post, use List all Post's Reactions.
const { data } = await postsApi.getPostReactionsList({
path: {
account_id: "acc_123456789",
post_id: "post_id",
},
});reactions = posts_api.get_post_reactions_list("post_id", "acc_123456789")curl --request GET \
--url https://api.unipile.com/v2/acc_123456789/posts/post_id/reactions \
--header 'X-API-KEY: api-key' \
--header 'accept: application/json'
Partial listsEach page holds at most 10 reactions: a higher
limitreturns 10. Usenext_cursorto get more.Some posts, often from very large Pages, only show the account's friends among the people who reacted. The list can then be partial or empty, while the post's reaction counters are not.
On a comment
To list the reactions on a comment, use List all Comment's Reactions. Each page holds at most 10 reactions.
const { data } = await postsApi.getPostCommentReactionsList({
path: {
account_id: "acc_123456789",
post_id: "post_id",
comment_id: "comment_id",
},
});reactions = posts_api.get_post_comment_reactions_list(
"post_id",
"comment_id",
"acc_123456789",
)curl --request GET \
--url https://api.unipile.com/v2/acc_123456789/posts/post_id/comments/comment_id/reactions \
--header 'X-API-KEY: api-key' \
--header 'accept: application/json'Add a reaction
To react as a Page, set react_as to its Page ID. The Page must be activated on the account.
To a post
To react to a post, use Add Reaction to a Post.
await postsApi.addPostReaction({
path: {
account_id: "acc_123456789",
post_id: "post_id",
},
body: {
reaction: "facebook_love",
react_as: "1357020157484056",
},
});posts_api.add_post_reaction(
"post_id",
"acc_123456789",
{
"reaction": "facebook_love",
"react_as": "1357020157484056",
},
)curl --request POST \
--url https://api.unipile.com/v2/acc_123456789/posts/post_id/reactions \
--header 'X-API-KEY: api-key' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"reaction": "facebook_love",
"react_as": "1357020157484056"
}
'To a comment
To react to a comment, use Add Reaction to a Comment.
await postsApi.addPostCommentReaction({
path: {
account_id: "acc_123456789",
post_id: "post_id",
comment_id: "comment_id",
},
body: {
reaction: "facebook_like",
},
});posts_api.add_post_comment_reaction(
"post_id",
"comment_id",
"acc_123456789",
{"reaction": "facebook_like"},
)curl --request POST \
--url https://api.unipile.com/v2/acc_123456789/posts/post_id/comments/comment_id/reactions \
--header 'X-API-KEY: api-key' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"reaction": "facebook_like"
}
'Remove a reaction
If the reaction was added as a Page, set react_as to the same Page ID.
From a post
To remove a reaction from a post, use Remove Reaction from a Post.
await postsApi.removePostReaction({
path: {
account_id: "acc_123456789",
post_id: "post_id",
},
body: {
reaction: "facebook_love",
react_as: "1357020157484056",
},
});posts_api.remove_post_reaction(
"post_id",
"acc_123456789",
{
"reaction": "facebook_love",
"react_as": "1357020157484056",
},
)curl --request DELETE \
--url https://api.unipile.com/v2/acc_123456789/posts/post_id/reactions \
--header 'X-API-KEY: api-key' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"reaction": "facebook_love",
"react_as": "1357020157484056"
}
'From a comment
To remove a reaction from a comment, use Remove Reaction from a Comment.
await postsApi.removePostCommentReaction({
path: {
account_id: "acc_123456789",
post_id: "post_id",
comment_id: "comment_id",
},
body: {
reaction: "facebook_like",
},
});posts_api.remove_post_comment_reaction(
"post_id",
"comment_id",
"acc_123456789",
{"reaction": "facebook_like"},
)curl --request DELETE \
--url https://api.unipile.com/v2/acc_123456789/posts/post_id/comments/comment_id/reactions \
--header 'X-API-KEY: api-key' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"reaction": "facebook_like"
}
'Updated 16 days ago