Ho to detect reactions in bot

lakshmi 651 Reputation points
2024-06-14T05:25:34.24+00:00

Hi Team,

We are working on a team bot which is built in a bot framework. We are using personal chat as a user and teams channel as an agent to implement user agent conversation. We wanted to use the reaction feature in such a way that reaction in user or personal chat should be send to the specific agent to whom the user is connected or vice versa.

Would it be possible to detect the reaction in bot framework and send it to the connected user or agent.

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
788 questions
{count} votes

1 answer

Sort by: Most helpful
  1. YutongTie-MSFT 48,166 Reputation points
    2024-06-18T05:02:18.68+00:00

    Hello @lakshimi

    Thanks for reaching out to us, I have added Teams Development tag for more visibility, below is some points you may want to refer to -

    1. Set Up Event Handling

    Most bot frameworks provide mechanisms to handle events, including message reactions. For Microsoft Teams, you typically use a webhook to receive events.

    • Register Webhook: Ensure your bot is set up to receive events from Microsoft Teams. This involves registering a webhook endpoint where Teams can send events, including reactions.
    1. React to Message Events

    When a message with a reaction (like a thumbs up) is sent by a user, Teams generates an event. Your bot needs to:

    • Receive Event: Handle the incoming event payload from Teams. This payload will contain information about the reaction, such as who reacted and to which message.
    1. Identify the Reaction Context

    To determine the context of the reaction (user to agent or vice versa):

    • Context Tracking: Your bot needs to keep track of the conversation context between users and agents. This could involve maintaining state (e.g., in a database or memory) that links users to their respective agents or channels.
    1. Send Reaction to Relevant Party

    Once the bot has received the reaction event and identified the context:

    • Send Notification: Use the bot framework's capabilities to send a notification or message to the relevant agent or user. This might involve crafting a message that indicates someone has reacted to their message or notifying them in the appropriate channel.

    Example Scenario

    Let’s say a user sends a message to the agent in a Teams channel, and the agent reacts with a thumbs-up emoji:

    • The bot receives an event indicating that the agent has reacted to the user's message.
    • Using the context information (stored or tracked by the bot), it identifies the user who sent the original message.
    • The bot then sends a notification or message to that user, informing them that the agent has reacted (e.g., "Agent liked your message")

    I hope this helps!

    Regards,

    Yutong

    -Please kindly accept the answer if you feel helpful to support the community, thanks a lot.

    0 comments No comments