Manage reactions

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

Users can react to Messages. WhatsApp use Emojis as message reactions.


List detailed reactions

Each Message object have a reactions counter. But if you want a detail on who reacted what emoji, use List all Message's Reactions and provide the Message ID.

const { data, error } = 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/account_id/chats/chat_id/messages/message_id/reactions \
     --header 'accept: application/json'

React to a message

To react to a message, use Add a Message Reaction. Provide the message ID and the native Emoji.

❗️

Provider limitations

WhatsApp allows only one reaction per user. Adding a new reaction to a message will replace any existing reaction from the user.

const { data, error } = 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/account_id/chats/chat_id/messages/message_id/reactions \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '{"reaction":"🔥"}'

Remove a reaction

To remove a reaction from a message, use Remove a Message Reaction. Provide the message ID and the native Emoji to remove.

const { data, error } = 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/account_id/chats/chat_id/messages/message_id/reactions \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '{"reaction":"🔥"}'

Be notified about reactions

To be notified when a new reaction is added to any message, setup a Webhook that listen for message.reaction.new events.