Sharing same conversation with multiple bots - botframework

Question: How to have multiple bots supplying answers to the same Teams chat window a user has with an aggregator bot.
Description:
Several different teams have created bots that can answer questions related to their areas. Picture a services bot, a catalog bot, etc. All of these bots are maintained by their individual area owners, have their own sets of LUIS intents, etc. That works great, but you have to know where to look for each type of question.
Now we'd like to have a single bot for anyone to connect to, to get their questions answered no matter what area the question falls into. The idea is that this aggregator bot would then forward the questions to the appropriate area bot, which would then provide the answer. The scenario here is that someone troubleshooting an issue could ask questions crossing multiple areas in the same place without having to know about each individual area's bot.
The bots are currently hosted in Teams and are C#. So far, our solution has this flow:
Aggregator bot receives the question and asks each bot (through another endpoint specific to this flow) how confident it is that it can answer the question.
Aggregator bot decides which bot(s) to ask the question to, and sends the question off to the regular /api/messages endpoint for the bot.
[Broken] Area bot posts the answer/ auth prompt if needed/ or the start of a conversation to clarify the eventual answer.
We found the bot-to-bot handoff project, but in the readme.MD, it says:
Note: The main bot and each of the sub-bots share the same AppID and
AppPassword. This allows all the bots to share the same conversation
ID, Dialog
Stack,
and Bot State
Data.
This is not possible in Azure, because you can't create multiple bots with the same AppId.
Trying a hack based on that, we found that if we change the bot configuration to use the same MicrosoftAppId and MicrosoftAppPassword in the Application Settings in Azure for all the bots, then everything works fine through the aggregator bot. At that point, you can no longer connect directly to the individual bots anymore. While that is clearly a hack and not a solution, it implies that the problem is authentication based and not something that is implicitly impossible.
There are lots of pieces around that seem like they might help, but we haven't found the documentation to fit them together. This seems like something that should be a common scenario. Ideally we could specify some kind of bot trust at a higher level and not have to specify AppId and AppPassword directly, though we're willing to do that in this case since we're all the same company.
Things we've tried:
Using TrustServiceUrl to trust the aggregator bot from each area
bot, and all the area bots from the aggregator bot. The call was
made in Application_Start in Global.asax for each bot.
The hack described above
Specifying AppId and AppPassword in the BotAuthentication attribute
Number 3 actually solved the auth problem for letting the aggregator bot ask each bot for it's confidence in answering the question when we used it to tag those functions. Specifying the AppId and AppPassword for the aggregator bot in the specification for that endpoint in the individual area bots worked great. But it didn't fix the ability for the individual area bot to post back to the conversation owned by the aggregator bot. In that case, the aggregator bot itself is consuming the answer, and it is an answer and not a flow.
What do we try from here? Is there something we've missed, or is there something fundamentally wrong with the approach we've started with?

Related

Calling an external API from MS Teams chat

Can anyone offer guidance on how to call an external API from within MS Teams chat/posts initiated by an #mention or #hastag? The service I want to build would use the mention/hastag to call an API and return various types of meta data that would then be added to the chat, post, etc. Wondering if Flow or Yo Teams is the best way to go.
The best approach for this would be to create a bot, which gets a name that can be '#' mentioned (e.g. if you bot is called MyBot, you could mention #MyBot in a Teams channel, and it will get notified). Once it receives the notification, the bot can do anything you need it to do.
If you have development skills available (yourself or someone on your team), have a look at the Teams Bot development documentation to get started. If not, Power Virtual Agents could suit your needs (it's like a "drag and drop" bot creator.

Microsoft Teams: Is at all possible to create a app/connector/bot for broadcasting?

Trying to parse through the Microsoft Documentation of this is a bit of a challenge.
Our use case is that we want the app to receive broadcasts from an external service. On that broadcast we want it to send a personalized message to every person in the team/org.
Is that at all possible? Doing this in Workplace and Slack was fairly straight forward but i'm going nowhere fast with Teams. Connectors seem weird and user-based, not team based, requiring you to set up a config page for it? Bots seem centered around AI interactions and on demand features and general apps? Not sure.
So yea the question is, is it possible. If so i would appreciate to know where to look for how to do this.
Yes, this is definitely possible. If you're wanting to send to a Team (i.e. a Channel within a Team) you can use either a bot or a webhook. If you want to send to individuals or to group chats, then you'd be looking to use a bot.
For webhooks, see Post external requests to Teams with incoming webhooks. For bots you can start here, and in that case you'd want to look into something called "Pro-active messaging", where the bot is sending a message on it's own, rather in response to a user's initial message.
The Pro-active messaging can be a bit tricky, so if you do want to go that approach (1 to 1 messaging), let me know in the comments and I give you some more guidance. However, I'd suggest rather looking at messaging the Team, and creating/using a relevant channel, rather than sending every user a 1-1 message.

Bot Framework - add member to Teams group chat

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.
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

Slack API : Ability to view all recently added users to Slack Channel

I am working on a POC to proof out the ability to get a list of all the new users who have been added to a specific Slack Channel. From my initial review of the Slack API I am not seeing anything that showcases this ability, I was curious to see if anyone had worked on something similar or could point me to resources that would be a viable solution.
I believe there is no ready-made API method available, that will give you that specific information. However, Slack is very flexible and you can use the existing building blocks to easily add additional features as needed.
E.g. To get the requested information you can develop a small Slack app that listens to the member_joined_channel and member_left_channel events to keep track of when members joined a channel.
If you need a historical record of membership in a channel, you could use the Slack API's groups.history method, page through results, and build a membership log by looking for events of type member_joined_channel and member_left_channel through time.

Skype Bots - Please tell me I'm missing something

Working on an application and developing chat integration bot. Note that contrary to some news bots or other tools, there is no central website or server that the bot gets its data from. The software installation comes with a repository, and that is where the bot connects to. Thus, every user, upon installing the software, will basically get their own copy of the bot, alongside with their own repository, etc.
Now, having done that for Telegram: You open the telegram client, initiate a chat with the botfather, get the token for your new bot with one or two commands, and then add that token to my application. Done. Easy for the user to follow, takes a few minutes at most and they have a working bot.
Trying to do the same with Skype, the users must:
Sign up for an Azure account
Provide credit card and phone number verification (that's probably where some users will stop right away)
Log on to the Azure Portal
Create a bot channel, through a myriad of different screens I have to guide the user through.
Have the user obtain the bot's password, again through a variety of different screens he needs to be guided through. (if the user hasn't given up yet, at this point he'll definitely get grumpy)
Enable the Skype channel, and enable the bot to be added to group chats.
Attempt to locate the bot via Skype and eventually add it in.
Now, if I wanted to document this properly, this will be a 10-15 page document with tons of screenshots and all. To do what Telegram does in two minutes or even less. There's so many opportunities in all of this for something to go wrong, that I can't even consider forcing my users to go through this.
Surely, I must be missing something? It can't be that you have to go through this horrible mess of an over-engineering spectacle that is second to none, just to get the most basic bot to function?
All I need is a means to say "this is the bots name, give me its token and API URL so that it can send messages using the REST API". But I can't seem to find this for Skype.

Resources