I am developing a Bot Framework application that integrates with Slack using Microsoft Bot technology. In the bot project, I was trying to get the user location when the user sends a message.
What I am trying to achieve is that, when a user types the message "Show me nearby hospitals", I want to get the users Geo coordinates and pass them to an API that will return a list of hospitals near that location. So any idea on how to get the user's current location in the Microsoft Bot project?
I tried using the Geo location class, however I am not able to add the class reference directly and when I add the external DLL for the Geo location class, Visual Studio throws some errors.
Is there any way to get the users current location in Bots?
The Bot Framework is getting updated every minute!!!
The Bing location control for Microsoft Bot Framework makes the process of collecting and validating the user’s desired location in a conversation easy and reliable.
The control is available for C# and Node.js and works consistently across all channels supported by Bot Framework.
Check the documentation here.
Click to view the code sample
This question is old but this is now a thing that exists to help with location hope it will help someone looking for this answer. https://github.com/Microsoft/BotBuilder-Location
Channels vary on whether they support location information. There is currently no way to get location information for users on Slack. Telegram, for instance, does. When location data is available it will returned in the Attachment data structure and in the channel's native format in the ChannelData field. Note that the user needs to opt into sending this data (to protect their privacy). The bot developer can send a message to the user requesting that they share their location data, but they cannot get it from the channel it w/o user action to share it.
This is currently not handled by the BotBuilder well. I've opened an issue to get this standardize across platforms. Regarding Slack, they don't have an option to send a location as an attachment as Telegram, Messenger and Kik do, so you might want to use Google Geocode API to derive coordinates from a string.
Related
I have created a chat bot using Bot Framework Composer, and I’m trying to get the plain text of the different conversation turns, for logging purposes.
I have found this resource, where it explains how to do it, but it only applies for the Microsoft Bot Framework v4 sdk.
However, since the code generated by Framework Composer and Bot Framework SDK is different I don’t know how to access the Activity object or the turnContext info.
Is there any way to access this info from the code generated by Bot Framework Composer?
I have tried printing from SkillController.cs and BotController.cs. However, the Activity object that might contain the turnContext is empty.
Follow the following steps:-
1.Ask for input text and than store it using "Set a property".
2.If you want you can give different variable names each time whenever you want to store user response.
3.You can use the variable name to access the response.
Here is the output:-
And you can also merge it in a loop for storing multiple response.
Write the custom middleware to access turn context object
here the video steps how to create custom middleware using bot composer
The last few days, I checked dozens of samples, docs, blog posts, youtube videos (courses, that I couldn't fine) and I can say I'm still confused and I still without a Teams bot.
Every example I've checked is different in approach, and now I'm pretty sure there are many others like me.
Frequently problems: required input/parameters like service Url, conversation Id, etc. 1. You can't find a explanation for them. 2. You can't find a place where it's explained how to get them.
What I want to achieve
I want a bot on Teams, with a API, with 2 parameters: user email, message. The bot has to send the message to the specified user. That's it.
I'm looking how to:
Create/Setup the Application
Create the actual Bot
Install the application to Teams
I used to create a Teams conversation bot. Hope my experience will help you.
First, download sample provided by microsoft. I uses c# to create this bot, so I copy the '57.teams-conversation-bot' folder and opened it with vs studio. In this sample, I need to modify the configuration in appsettings.json. I need to enter the appid and apppassword.
So the next step is creating an Azure ad application in Azure portal. But if you never create Bot Framework registration resource before, you can create the azure ad application when you create a Bot Framework.By the way, You can leave 'Messaging endpoint' empty now. Please note, when you creating Azure ad application, you can choose to set this application as a multitenant app if your account creating the app is in a different tenant with your teams account.
Now I have a bot framework and an Azure ad app, I can modify appsettings.json, enter the appId and app password. I can get appId in app overview page and get app password when creating client secrets in Certificates & secrets tag.
Now, I need to debug my sample with web chat in the azure portal(Enter the bot framework created just now, you can see Tag 'Test in web chat' in the left panel). So I need to use ngrok to make the bot visit my code in local environment. Running the sample by pressing F5 in vs studio. Opening ngrok.exe and running the command ngrok http -host-header=rewrite 3978. Then I can get a https url, copy that and paste in the 'Messaging endpoint'. Don't forget to add '/api/messages'.
Now sending 'hello' to the bot and you will get default result. When you get the picture below, it means you have made a correct configuration.
Next step is to add this bot to Teams client. First, I add the Teams Channel in the bot I created in the azure portal.
Then I need to modify the manifest file. Replacing the "YOUR-MICROSOFT-APP-ID" with appId creating just now. And creating manifest.zip file which contains the three file in folder TeamsAppManifest.
Next step is uploading the zip file to Teams client. Click the 'Apps' in the lower-left corner and click the 'Upload the custom app' in the bottom of the left panel, then click add. Ok, now I get a team conversation bot.
There -are- a ton of approaches, partly because Teams development is still relatively new, partly because the Bot Framework (the set of tools for buildings Bots in the Microsoft world, both for Teams and otherwise) has also undergone some major changes. That's aside from the various language options (dotnet, node, python, etc.).
What's looking to be a good place to get started though, is the new Teams Toolkit, a plugin for Visual Studio and Visual Studio Code, for building a new Teams project (Tab, Bot, etc.). Have a look here for a link. It's very new though, so some rough edges, but it's aiming to be very comprehensive to get up and running quickly (does a lot of Azure registrations behind the scenes, for example). Check out the latest monthly Teams Developer call, from earlier this week, for a visual run-through: https://www.youtube.com/playlist?list=PLWZJrkeLOrbbTKzV1sQOFAXd_s0BHJDiL (this week's call isn't up yet, but it should be very soon).
I am developing a chat bot using MS bot framework V4 and virtual assistant.I am looking for ways to add avatar.
1) Bot avatar
in Azure Web Chat I updated the bot icon, but the avatar is showing up only when I test in azure web chat.How to setup my bot avatar so that it will show up consistently in every bot channel
2) User avatar.
I am authenticating my user making use of MS graph API and I can find the profile image in token, but not sure where to configure it so that it will show user's avatar along with each response/message
I have gone through the Demo for setting the bot framework server and the webchat for the bot by following the samples provided
bot server == https://github.com/Microsoft/BotBuilder-Samples
webchat == https://github.com/Microsoft/BotFramework-WebChat
but there is no proper example or documentation on how to set the user image after the user has signed in. using the signed user object.
I looked into the discussions mentioned here, here and here. Any suggestions ?
Bot avatar: avatar management is different given channels. There is no way to globally modify your bot avatar for every channel:
For Teams, it is a property of your app package
For the webchat, you can setup the image on your webchat code
Etc
User avatar: same here, there is no quick way of changing the image of the user in the webchat after its start. You pointed the right topic, you will have to dig in the webchat code
Nicolas is correct regarding avatar management across different channels. This answer specifically addresses the "User avatar" question.
Updating the user avatar in Web Chat is possible, however it will require you to use React (or similar) for re-rendering, as well as for state management. This Stack Overflow solution (located here) details how to achieve this.
It does use AAD for obtaining the user photo (for use as the avatar). If you are not using AAD, then change the code to make the appropriate service and API call(s).
Hope of help!
If you are following the webchat samples available at: https://github.com/Microsoft/BotFramework-WebChat. User avatar can be changed by creating a style set using createStyleSet method where you can put many style properties to customize your webchat UI. Among those properties is userAvatarImage which will take the image url for user avatar.
hope this helps.
I am developing a location-based recommender system, which uses a chatbot which:
Situation
Gets the users current location via a channel such as telegram/facebook messenger or other
Uses the chatbot, which shares this location with a backend azure serverless function, and which sends a set of personalization multiple-choice questions with options to the chatbot.
The chatbot asks those questions( according to the questions sent from the backend), to the users, and sends the user's selected answers back to the backend. Note: the questions and their choices, are entirely dynamic, and a static questionnaire cannot be assumed.
The backend personalizes the recommendation for the landmarks around the user, according to the answers, and displays the recommendation to the user.
Questions:
I read lots of tutorials on doing this with microsoft botbuilder( which is a requirment) but dynamic form-dialogs dont seem to be possible ( I only saw statically coded form). The questions and their options should be retrieved via a back-end REST API call and the json will be parsed to make the Q and A dialog. With the option for each question being sent back to the server to store. how do I make this happen?
Since its a user-location-dependent service, how do I take the current location of the user, from the deployed channel(i.e. telegram),into the chatbot ( and then send it to server backend). is there any way to do this using the microsoft botbuilder framework?
Since I am very new to azure and botbuilder framework, thanks in advance for any help!
Now
1) The text for a message can be retrieved from anywhere. This example pulls messages from a mocked up service, and walks the user through the steps one at a time: https://github.com/EricDahlvang/MultiTurnHelpStepsBot
2) This library might help: https://github.com/Microsoft/BotBuilder-Location
I am using Microsoft Bot Framework to create a chatbot.
How to know user's Timezone and his IP to trace location.
This will help me give better service to the user.
The only way you could get this is from the channel client, so it is dependent on channel.
There is a ChannelData object that shows you what you can get, but I'm not sure if these are on there.
https://learn.microsoft.com/en-us/bot-framework/rest-api/bot-framework-rest-connector-channeldata
https://github.com/Microsoft/BotBuilder-Samples/tree/master/CSharp/core-ChannelData
If you have implemented your own client, for example for webchat, then you could gather this information from there and pass it down or send it to your analytics solution.