How to get the specific userId for communication between a bot and a particular user

Anonymous
2021-07-24T15:50:23.743+00:00

A microsoft teams bot uses a specific user id for communication between bot and a user. This ID is unique for communication between these two. I am trying to get this ID for proactive messaging. I have seen many samples where we get this ID from a particular team channel or between a group chat. But, the problem is i want to get the userID of a user who is not a part of this chat.

Example -: If an employee submits a request using bot then his manager should be notified about that request proactively by the bot. How can i achieve that using the Application scope.

The bot is installed for bot employee and manager.

I couldn't find any example where i can send a message from bot to user of AD or any teams user for that matter even if the bot is installed for them.

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

Accepted answer
  1. Hunaid Hanfee-MSFT 981 Reputation points
    2021-07-30T18:17:59.577+00:00

    Hey,
    If the bot is installed for both of them already, then you will need conversationId to send notification. You can get the conversation Id from turnContext.Activity.Conversation.Id and store it. You can get this when user install the bot (using OnConversationUpdateActivity)or when user interacts with the bot.

    You can get user details from turnContext when user install the bot. If using OnConversationUpdateActivity then you can get it by turnContext.Activity.From. (have a look at available properties)
    Thanks,

    Hunaid Hanfee


    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.