Forum Discussion
Query Regarding Bot Development and User Impersonation in Microsoft Teams
Hello,
I am currently working on a project where I want to integrate a bot with Microsoft Teams. However, instead of the bot having its own identity, I want it to use a specific user account to send and receive messages.
The goal is for the bot to process incoming messages, perform some computations or lookups based on the content of the messages, and then send responses back to the sender. All of this should happen under the guise of a specific user account, not a bot. The bot is supposed to use a custom framework already design by us to serve as a virtual assistant.
I understand that bots and users are treated as separate entities within Microsoft Teams for security, privacy, and compliance reasons. I also understand that bots operate under the Microsoft Bot Framework and have their own set of capabilities and restrictions.
However, I am wondering if there is any way to achieve what I am trying to do while still complying with Microsoft’s policies and guidelines. Is it possible to use a user account to send bot messages and process the messages received as that user? If so, could you please guide me on how to do this?
Any help or guidance would be greatly appreciated.
Thank you!
- LeonPavesicSilver Contributor
Hi SomeUser404,
Microsoft Teams intentionally restricts bots from impersonating users to maintain transparency, privacy, and security.
The described scenario, where a bot forwards a message from User A to User B while making it seem like it's coming from User A, is not allowed in Teams. This restriction is in place to ensure the integrity of user interactions.Although achieving this specific functionality is not supported in Microsoft Teams, alternative approaches can be considered.
For example, the bot can send messages as itself while explicitly indicating in the content that it is acting on behalf of a particular user. While it may not replicate the desired behavior exactly, it aligns with the platform's guidelines and maintains transparency in communication.
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)- SomeUser404Copper Contributor
LeonPavesic thank you for your fast reply. I have to clarify that we do not intend to impersonate a user at all. We are developing a virtual assistant for the company using artificial intelligence techniques and we need this virtual assistant to be able to interact with the rest of the company's employees who use Teams. We want it to be able to process and answer both voice calls as well as chat messages. What we want is to make a user for that bot, so it can participate in voice and video calls, and have chat conversations with all the company's users, behaving like a real employee.
With that being said, is there a way to achieve this while complying with the platform's guidelines?
Thank you!
- Prasad_Das-MSFTMicrosoft
SomeUser404 - To create a bot that can participate in voice and video calls and have chat conversations with all the company's users, you need to use the Microsoft Graph APIs for calls and online meetings and the Real-time Media Platform.
- Create a bot using the Bot Framework SDK and register it in the Azure portal.
- Specify the additional settings
supportsCalling
andsupportsVideo
in the Teams app manifest for your bot. - Specify the required Graph permissions for your bot's Microsoft App ID.
- Obtain tenant admin consent for the required Graph permissions.
- Implement the necessary code to handle voice and video calls using the Microsoft Graph APIs for calls and online meetings.
To create a bot that can have chat conversations with all the company's users, you can use the Teams platform's messaging capabilities. You can use the Bot Framework SDK to handle chat messages and implement the necessary code to process and respond to chat messages.
You can refer to the Microsoft Teams documentation on Microsoft Graph APIs for calls and online meetings and Real-time Media Platform.
Thanks,
Prasad Das
------------------------------------------------------------------------------------------
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.
- Prasad_Das-MSFTMicrosoft
To achieve your requirements, we recommend you give your feedback in Teams Feedback Portal.
Thanks,
Prasad Das