Manage reactions

Learn how to manage message reactions on Facebook using Unipile API.

Users can react to messages with emojis.

To react to posts and comments, see Manage post reactions.


List detailed reactions

To get details on who reacted with which emoji, use List all Message's Reactions.

const { data } = await messagingApi.getMessageReactionsList({
  path: {
    account_id: "acc_123456789",
    chat_id: "chat_id",
    message_id: "message_id",
  },
  query: {
    limit: 20,
  },
});
reactions = messaging_api.get_message_reactions_list(
    "chat_id",
    "message_id",
    "acc_123456789",
    limit=20,
)
curl --request GET \
     --url 'https://api.unipile.com/v2/acc_123456789/chats/chat_id/messages/message_id/reactions?limit=20' \
     --header 'X-API-KEY: api-key' \
     --header 'accept: application/json'

React to a message

To react to a message, use Add a Message Reaction with the native emoji.

const { data } = await messagingApi.addMessageReaction({
  path: {
    account_id: "acc_123456789",
    chat_id: "chat_id",
    message_id: "message_id",
  },
  body: {
    reaction: "🔥",
  },
});
messaging_api.add_message_reaction(
    "chat_id",
    "message_id",
    "acc_123456789",
    {"reaction": "🔥"},
)
curl --request POST \
     --url https://api.unipile.com/v2/acc_123456789/chats/chat_id/messages/message_id/reactions \
     --header 'X-API-KEY: api-key' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '{"reaction":"🔥"}'

Remove a reaction

To remove the account's reaction, use Remove a Message Reaction.

const { data } = await messagingApi.removeMessageReaction({
  path: {
    account_id: "acc_123456789",
    chat_id: "chat_id",
    message_id: "message_id",
  },
  body: {
    reaction: "🔥",
  },
});
messaging_api.remove_message_reaction(
    "chat_id",
    "message_id",
    "acc_123456789",
    {"reaction": "🔥"},
)
curl --request DELETE \
     --url https://api.unipile.com/v2/acc_123456789/chats/chat_id/messages/message_id/reactions \
     --header 'X-API-KEY: api-key' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '{"reaction":"🔥"}'

Be notified about reactions

To be notified when a reaction is added, set up a Webhook that listens for message.reaction.new events.

The message.reaction.delete event is only sent for encrypted chats.


Did this page help you?