I have a group chat on Microsoft Teams with 4 members: 3 people and a bot. Is it possible for the bot to add a new member to the existing group chat?
I found the method deleteConversationMember of the class BotFrameworkAdapter
, which should remove an existing member. Well, I would need the opposite, adding a new member.
I have also checked Microsoft Teams Graph API, but it seems to be possible only to get members and not add a new one.
2 Answers
As I see from your comment, you're trying to have the bot escalate, or "hand off" to a service desk agent. If that's correct, you can have a look at another model for this altogether, where the user continues to chat with the bot, but the messages are being sent, by the bot, to an agent behind the scenes. This is referred to as a "handoff", and you can see a blog post here and source code (from the blog author) here on github
The BotFrameworkAdapter
methods use the Bot Framework REST API, which itself calls channel-specific API's. As you've seen in the Teams Graph API, adding a member to a group chat is not currently supported and even if it was that Graph API is in preview and not suited for production applications. This document explains how to give feedback if you want to request this feature.
As a workaround, I recommend having the bot give the existing group members some instruction on adding the new member to the group themselves.
If you'd like to go with a bot-to-human handoff solution like Hilton suggested, you might be interested in this new sample: https://github.com/arturl/lpproxybot