How to use data from a database with a MS Bot - botframework

I am going to do my next project on ChatBot for my client. I am a .net person, so planning to use MS Bot with C#.
My question is on creating the Database part. We have a existing Database which has data related to Project Management and others which is currently being used for a web application.
What we are expecting from the Bot is, if a person(say, a manager of particular project)wants to know the count of people under him, he can use the Bot to get the count, rather than go to the web application and figure out.
How will this database work for Bot application.
How will I create the table structure to identify the questions to be asked to BOT and its responses and fetch data and then display to user.
How can we make my Bot fetch data from this DB, if someone asks question.
How can I store these responses.
I am totally confused. My Client do not want to use LUIS, but want similar thing to be built with our Database and can be called via RestAPI.
Kindly help with any article or advise to start my work with.

Consider the bot you made as a back-end server written in C#.
It just gets requests and sends responses.
So nothing special is needed for connecting it to DB.
Simply connect it to DB as you'd connect a ASP.NET website to DB.

Related

How to deploy a Question Answering BERT Model as a chat bot on MS Teams

I have a Text2SQL model (EditSQL: https://github.com/ryanzhumich/editsql) which I have configured to take a sentence as input and return a SQL query as output.
Now, I want to deploy this program as a chat bot application in Microsoft Teams.
I understand there's Microsoft bot framework that enables publishing a bot and the 3 options are described here.
https://learn.microsoft.com/en-us/learn/modules/choose-bot-building-tool/
However, I am not finding any of them suitable for my use case since I need to deploy a Question-Answering Bot where the Questions from users need to be sent to an external server like AWS and the response from AWS (could be an excel file) needs to be sent back to the user. Multiple questions can be the part of a conversation, so the chat client should be able to mark start and end of a conversation.
My problem:
What are the basic steps of exposing a ml model via a server so that it can be queried in production.
What are the tools that will allow me to make a client on Teams and a server for this model on AWS?
Please let me know if I should add more information on this.
Thanks
As you've seen, there are a bunch of tools/approaches to creating bots in the Microsoft world, for Teams or otherwise. Underneath, these all use the Bot Framework, but you can develop directly (i.e. write code), or use a higher-level tool like Bot Framework Composer - the choice is yours depending on your own internal skills. If you want to work with code directly, here are a bunch of bot samples, in multiple languages: https://github.com/microsoft/BotBuilder-Samples/tree/main/samples . For isntance, here is an example of integrating the Microsoft QnAMaker service into your bot: https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/python/49.qnamaker-all-features
Basically, if you go the development approach, your bot is just a web service. Once it receives the message, it can call out to any other service behind the scenes. That means it can receive a message, call out to an AWS service, receive the response, and send a reply to the user.
For multiple questions as part of a 'set' of chats, Bot Framework provides an idea called "dialogs" that should work for you.

How i can share data which i connected with Heroku connect with other salesforce users

I have my website in PHP and DB in MySQL. I want salesforce users to search on my database from within their salesforce. For that, heroku connect seems to be the option. So i am thinking of converting my MySQL DB to PostGre and then use heroku connect to share my data with my salesforce account. The question i have is, how can i share same data with other salesforce users ? Those users are my website clients and i don't want them to go through this process of heroku connect. Is there was of sharing my data with other salesforce users ?
You cannot and should not expose your database directly to your customers. That would allow them to change the data as well as read it.
Your solution here is to create a public API which exposes endpoints that will make it possible for anyone (with proper authentication hopefully) to query your data.
There are many ways you can design an API, whether it's a REST or a GraphQL one. This is something which can absolutely be done in PHP though.

How to get user device type accessing skype for business bot built in MS Bot Framework

Does anyone know how to get the information about user device that access the bot deployed in S4B channel and built using MS Bot Framework (C#).
I need to know about the options to detect the user device (Device type and OS) accessing the Skype For Business Bot. If there's a way to know whether user device is desktop or mobile. In bot framework the User-Agent header formatted similar to the string below:
SFBUserAgent (Microsoft-BotFramework/3.1+https://botframework.com/ua)
(The user agent from Connector returns the following:
fxversion/4.7.2563.0 osname/windowsserver2016datacenter osversion/6.3.14393 microsoft.bot.connector.connectorclient/3.14.1.1)
I want to know if UCWA can be used to detect the device type accessing Skype For Business bot.
UCWA is not able to do so, actually no client or client-facing api can provide such information. It's because User-Agent information is not part of the presence so the client doesn't publish it to other clients. The main purpose of this User-Agent information is for monitoring reporting purpose.
However there is still some space from server side to allow us to do something. If you have access to the Skype for Business server, you have several workarounds.
Get-CsConnections.ps1 is a well-known script to pull current logged in user from Lync server side. It was written in 2011 while we only had Lync 2010, but good news is it works fine with new version of Lync like Lync Server 2013, Skype for Business server 2015. This script needs to be run in Lync/Skype management shell or a Powershell session with Lync/Skype modules imported. It needs to run by using an Lync/Skype admin account.
To retrieve user agent for a particular user by using sip uri.
$UserHomePool = (Get-CsUser -Identity [sip address]).RegistrarPool
Get-CsConnections.ps1 -SipAddress [sip address] -Pool $UserHomePool
Connections.ps1 is the prototype script of the above Get-CsConnections.ps1, it's simpler but doesn't provide advanced features. You can look at it and decide which one you need.
Do it yourself. If you don't want to use 3rd party script or just want to do it in a simplest and pure way, it's possible to do it by querying it from server database. Lync/Skype server stores this user agent information in the dynamic database in Front End server. It's in the table dbo.RegistrarEndpoint of the database rtcdyn of the instance rtclocal.
Please notice that there is no public document about the database schema so you need to do a little guess and hacking yourself. Good news is all data in the database is strored in readable format so it shouldn't be a big issue.
In a very rare chance that you are not wanting this information in real-time, the monitoring report and database can be the best approach. It's not real-time data, the data is generated within 10 mins after a conversation is ended.
If you want to get it from monitoring database, you should look at SessionDetails view for P2P conversation and ConferenceSessionDetails for conference conversation. There are straighforward fields in the views called something like UserClientType to point out the user agent information for the certain session.
At last one thing I would like to remind is Skype allows user to logged in multiple clients simultaneously, so no matter how you make it work you still need to face the question which logged in client really matters to you if the user has multiple clients logged in.

How to update data for bot

I have create a bot which tells release data for any movie.
Should I be using conventional SQL DB to keep bot answers up to data?
I read about Document DB, is it good to try?
My Suggestion would be use some API if your data source has any. Like IMDB or some other source of data.
With that you will not have to manager database.
If you use DocumentDB or any other DB you have to make sure that data in that DB is upto date now for that you will reply on some API or web scraping. However you can directly do that in your bot itself.

Is there a way to get data from Oracle to a form stored on SharePoint 2007?

I need the document or form to be automatically updated when the data in the Oracle database is updated. If not possible, could anyone give me guidance to a solution similar to this?
Thanks for the help.
Oracle supports triggers in Java, so you could execute some code when data is changed in the DB. Sharepoint 2007 does support WebServices, so you could create a client which calls the web service to update the form.
But that sounds more simple than it is. The documentation for the web services in Sharepoint ... uh ... could be better. Many installations of Sharepoint insist on domain logins, so you would need to figure out a way to run Oracle with a Windows Domain logon.
In the end, it's probably more simple to create an email when the data changes in Oracle and have someone manually update the form.
That said, you paid a lot of money to Microsoft for Sharepoint, so they are obliged to tell you which API to use and they can probably even provide an example in, say C#. If all else fails, you can run a little server in C# which updates the form and which listens to data packets sent by a Java trigger in Oracle.
[EDIT] [Here is a blog post]2 to get you started with Java, Apache Axis and Sharepoint. Post a comment if you have any updates. LuUnfortunately, I'm no longer working at a company which uses Sharepoint.

Resources