Calling an external API from MS Teams chat - microsoft-teams

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.

Related

Possibility of using specific Teams features in a custom web chat app

Our internal employees are all using Teams. I'm researching how feasible it would be to use certain features of Teams for a custom web chat app. The actual back and forth conversation would not take place in Teams...it would be something I would build, possibly using SignalR.
The custom web chat application should allow our customers the ability to:
See the Teams status of an employee (Online/Offline)
Click on the employee to enter a chat room. (This chat room would be something I would create, possibly using SignalR)
I was wondering if it is possible to do the following with Teams:
Get the Online/Offline status of a user in Teams and display that in a custom web app.
Send data to a specific Teams user from a web app. (For example: when a customer clicks on an employee in the custom web app to start a chat, send a link to the employee that would send them to the chat room.)
Are these two things possible using Teams?
Wow, this is an unusual scenario, had to think a bit about that! In terms of (1) I'm not sure about anything for that it Teams (it might exist, but not something I'm aware of), but perhaps the Microsoft Graph has a capability for that. This might help.
Regarding item 2, do the customers have Teams? If so, you can deep link directly into a chat with the specific employee. If not, are you wanting the end user to use, say, a bot on the web app, but the employee to be using Teams? If so, who would they be "Chatting" to? Would it be ok for the chat to be with a custom bot inside Teams? If so, you should look more at the concept of "Pro-active chat" in Teams (to initiate the new/latest conversation from the bot to the user). The only drawback is if they are "chatting" to multiple people at once this wouldn't work, because each customer's interaction would come in to the same chat window in the Bot.

Call and Chat in MS Teams from Bot Framework

I would like to know if is possible to run a Call with someone else in Microsoft Teams from the BotFramework. Specifically I have an adaptive card where I want to perform this action. Then MSTeams client should open the call with the person I want. Is there a way for that. Same thing would be great for chatting.

How to get Microsoft Graph access token using email id in the skype for business bot to add an event to Calendar

In Skype for Business Bot , User is pre-authenticated, need to get Microsoft graph access token , in order to perform Microsoft Graph operations (such as adding events to calendar) in programmatic way..
Please suggest how Microsoft Graph Apis can be integrated with Azure Bot for Skype for business channel.
We want Skype for Business bot to book the meeting just like described here
But instead of Teams need to use Skype for Business. but basically this code line will ask user to explicitly in this code sample
"await context.Forward(new AzureAuthDialog("
There is another sample that need Adminconsent to update the calendar of specific user
Swati
You cannot reuse anything from the pre-authentication. Like any other channel, you have to go through a specific authentication phase.
You have a great sample on the official repository to do this, here: https://github.com/Microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/24.bot-authentication-msgraph

Sharing same conversation with multiple bots

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?

Does a Bot Framework bot need to be registered every time it changes, or only once?

I have created Bot 'MyFirstBOT' where my backend is QnA maker application data. I have given a name to this bot called 'TestJPBOT' and I have enabled the Teams channel for this bot so that we can use this bot on Teams applications. Right now in our organization we are working to register this bot with Microsoft so that we can start using it. I would like to know going forward if I want to make any changes in the bot, like changing its name, profile picture, or something similar, do I need to reregister it every time with Microsoft? Or is there no need?
Per my simple testing using Azure Bot Service env, we don't need register again after change our bots.
Actually, register your bot is populate your bot on Microsoft, equivalent to create a index for your bot I think. You change your bot's profile or code, should not effect the index.

Resources