Microsoft teams add custom text handlers - microsoft-teams

Is there a way to add custom text handlers in Microsoft Teams? For example when I Type # in chat then I can pick from users. Similarly want to bind a key to another option when I can lookup something from our web service and add it to the chat window. Following documentation describes how to write connectors for Microsoft Teams but doesn't say anything about what I am looking for.
https://msdn.microsoft.com/en-us/microsoft-teams/connectors

mayank, the closest direct thing to what you want is what we call compose extensions. That feature is in preview and is available here. That will let you call a web service and interactively show results from a search in a popup list, not unlike our Giphy integration.
Under the covers, it's a special kind of bot as mark-lafleur-msft described. With a bot, the difference is that the results from the web service don't appear in a popup window.
Last but not least, the simplest way of all, if all you want to do is execute commands from within a channel and return information, is to create a "Custom Bot" (similar to an "Outgoing webhook" in Slack). Details here.
Hope that helps.

What you're describing here is what Bots in Teams are intended for. Once built, you simply reference the bot by #botname and your query: #botname look up something from web service.

Related

Azure QnA Bot Knowledge base filter using metadata

I've created a bot after publishing the Azure QnA service knowledge base. I've added the metadata to each question answer pairs to denote the source of information. Now, I want to change the bot code to limit the knowledge base search using the metadata filter. Basically, Bot would initially prompt users to input source (for eg HR, Finance, Legal) and use that input further to only search through question answers pairs tagged to it.
bot source code that is used ->
https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/javascript_nodejs/48.customQABot-all-features
How can I change this code to return answers linked to specified metadata/user input dynamically?
please note README.md does provide information about how to filter answers by passing metadata but it has used static value ({ key: 'Language', value: 'Javascript' }).
I want to pass user input from CustomQABot.js to rootDialog.js so that it will be used in rootDialog.js to filter answers.
any input would be greatly appreciated. Thanks.
ps - I don't know much about node.js so it's very hard for me to understand the program flow.
Here's some documentation that explains how MSFT Bot Framework bots work.
Essentially, the bot invokes dialogs based on the user's input. Each dialog contains some form of conversation on a specific topic. Once a dialog is complete it exits and the user can ask for a new dialog, or just leave.
For example, a travel booking bot may have multiple dialogs, one for each activity. They might have one for booking airlines, one for cruise lines, and one for long distance buses, plus another for modifying or cancelling tickets.
In the example bot you have, there is just one dialog called rootDialog. You could start by trying to modify this dialog to ask the user what filter they wish to use and use that for the rest of the dialog. The user would be asked this question every time the dialog starts.
I'd highly recommend you read through some of the documentation and play with some of the other samples to understand how bots work first.

Chatbot with map/location picker

I am planning to build a chat bot using either azure framework composer, aws lex or google dialogflow but none seem to offer an easy way to have a map/location picker. It should be an straight forward interaction with user where based on a button click the user can then pick the precise location from the map.
Has anyone done something like that?
Many thanks.
I don't believe that any pure NLU framework is going to offer you that level of functionality.
The true purpose behind the likes of Amazon Lex, Google Diaglogflow is to perform intent detection and classification. It is up to the developer to build out the desired functionality associated with each of the configured intents.
What it may practically come down to is presenting the chat user with a map/location popup within the chat widget. The user could then select their current/desired location which gets sent back to the NLU framework for fulfillment.

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.

How to create dynamic dialogs from REST API in botframework

I wan't to build a bot that gather its answers and questions from a rest API.
Bot: How are you?
User: I'm fine, how are you?
Bot: I'm fine, also.
So the questions from the bot (even the first one) is gathered via REST API from an external service. Also the answer of the user is sent to this service and the Bots answer "I'm fine, also" is the result of a REST request.
I've first implemented it without using dialog feature at all. Works great, but without a dialog it's impossible to finish a dialog.
Looking around for some example I could only find some with WaterfallDialog. WatefallDialogs are build with steps - and I don't know the number of steps.
Is it possible to build such a dialog or isn't botframework not designed for such things?
In bot framework V4, the dialog/conversation flow you pick for conversations is optional, and you don't need to use them (https://learn.microsoft.com/en-us/azure/bot-service/bot-service-design-conversation-flow?view=azure-bot-service-4.0). All you NEED to do is implement bot state (https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-howto-v4-state?view=azure-bot-service-4.0), so you can store either conversation data (or user data - depends on what state you need.)
I implemented conversational flow using a single activity handler and an FSM (https://en.wikipedia.org/wiki/Finite-state_machine) - I use recognizers for common dialogs (help) but for the most part, my transition handler does regex comparisons to extract keywords and then hit the next state. So, if you can graph out your FSM, and list out all your dialog options, you can build a dialog that appears conversational and natural.
I can't share code at this time, but hopefully you don't need it.

How to extend MS Health Bot existing scenarios?

I am evaluating MS Health Bot service and able to create and test custom scenarios. However, I was looking at extending existing in-built scenario like "I have a headache" and customize based on my need. I could see product features say we can extend existing scenarios but I don't see any documentation on how to do it. Anyone aware of how to extend existing scenario?
Thanks
Monu
Additional Information:
Health Bot Service provided three templates in the catalog - Provider Lookup, File a claim, Handoff to a human. There are few others with Coming Soon tag.
Scenarios template catalog
However, I thought, I can use any of the already trained bot scenario to handle medical conditions like "I have a headache" as shown in the diagram below.(which shows up in empty designer page on the right chat widget)
Demo chat for "I have a headache"
So my revised question is "we will be able to extend only scenario that is part of template catalog and our own created scenario". Is that correct understanding?
Thanks in advance
You can customize pre-built scenarios in the Healthcare Bot through the Scenario Designer. In the Healthcare bot service you created, click on Manage Account. If you do not have any scenarios configured, either select a template scenario or create a new blank scenario. Otherwise, click on the name of the scenario to open the designer. From here, you can customize the scenario as needed by either adding more scenario elements from the top pane or modifying elements in the scenario.
At the moment it appears that you are only able to modify the three provided templates. You do not have access to the other scenarios like 'I have a headache' in the healthcare manager. The Healthcare Bot Service is relatively new so that might change in future updates.
I would recommend looking at the topics under Scenario Authoring in the Healthcare Bot Documentation for more details on creating and editing scenarios.
Hope this helps!

Resources