Creating a Chat Bot with Microsoft’s QnA Maker and Azure Bot Service

Image

Microsoft has a service in preview, called QnA Maker. It is a free (presently) service, which provides a REST and web-based service that trains AI to respond to questions asked of it. You’ve seen these on other sites, as these have become quite common, and ease the burden on support for SharePoint, or any other service out there. Chat bots can field common questions, freeing up time and energy spent on answering common asks.

They make it very easy to use – you can point it to a URL, type in your questions and answers, or upload a document (.docx, .doc, .pdf, .xlsx, and .tsv). The tricky part, is getting this from loading your knowledge base, to actually having a chat bot on your site. This is what this blog post is for, is to show you how to do it. They do have directions, but not a full walk-through on what to do.

This post assumes that you have at the very least, an Azure Account. If not, you can start one for free.

QnA Maker Setup

First, go to http://qnamaker.ai, this is where you will get started. Click on Create New Service

image

Then sign in with a Microsoft ID, or organizational account like you would into Azure, Office365, Outlook.com, etc.

image

It will then ask you to provide permissions to QnAMaker, click Accept

image

Then you must agree to the terms and privacy statement, check the box and hit Continue

image

Enter in a name for your bot. I am choosing Testbot 9001

image

You now have 3 options for loading data into your Chat Bot…

  1. From a URL that links to a resource which has a clear Q&A format, like a FAQ
  2. From a file, in Question/Answer format (supported file types are .TSV*, .PDF, .DOC, .DOCX, and .XLSX format)
    *TSV stands for Tab Separated Values. Like a CSV, but, you know, with Tabs. You can do this in Excel.
  3. Enter them in manually

For our Testbot 9001, we will be uploading from Excel. So, let’s create a new Excel file. In the first column, type in the question, or phrase, which the chatbot AI will hit on and use to provide the answer. Use the second column to provide that answer. Here is my example file:

image

Now, save the file. And go back to the QnA Maker setup, and choose Select file… next to the FILES section

image

and select the XLSX file from your local computer you just saved

image

Then scroll to the bottom and select Create

image

You will then see a dialog window appear while the service scans your file, and imports your Questions and Answers
image

Once complete, it will take you to the Testbot 9001 Knowledgebase.

image

Select Test from the side bar, and you can test the functionality with your questions
image

Cool, huh? The testing also allows you to train the bot as well. Such as choosing the best answer based upon what you had typed
image

Or providing multiple alternative phrasings, or synonyms

image

When done, click Save and Retrain to save your changes

image

You can see back in the main Knowledgebase, that it has been updated by what we asked and what we updated the suggestions and phrasings with

image

You can also add new Q & A pairs by clicking on Add new QnA pair

image

image

When done, Save & Retrain again to save your settings.

Once you are ready… click Publish

image

It will then show you what will be published… and then when ready, click Publish

image

The deployment confirmation screen will show you the example HTTP request for using your bot through the REST API. These are also available in the Settings link on the sidebar of the Knowledgebase.

image

We will need some f this information in a few minutes, so take down the Knowledgebase ID

image

And the Subscription Key

image

and put those aside for a few minutes…

Azure Bot Service Setup

Next we’re going to use the Azure Bot Service to setup our bot. To do so, we’ll be following these instructions: https://docs.microsoft.com/en-us/bot-framework/bot-service-quickstart

Log into the Azure Portal

Click on New > AI + Cognitive Services > Web App Bot

image

Now, let’s configure the botimage

  • Name: Testbot9001
    So you can identify the soldiers in your bot army!
  • Subscription: GeoffOps
    Choose your own subscription. This one is mine. You can’t have it.
  • Resource Group: Testbot9001
    Use an existing or create a new one
  • Location: East US
    Select the data center region you would like to use
  • Pricing Tier:  FO (10K Premium Messages)
    This defaults to S1 Standard, change this to F0 Free. Or else you will pay for the service
  • App Name: Testbot9001
  • Bot template:  Question and Answer
  • App service plan/Location: Testbot9001
    You will need to create a new one, or use an existing. For this example, I created a new one also in East US
  • Azure Storage: testbot9001a325
    I am letting Azure create a new one for me. This is a data storage account, like a fileshare. You can use an existing one if you have one as well.
  • Application Insights: Off
    This is not free. So I turned it off.

Then click Create to bring life to your Azure Bot. I twill validate your choices, and then when complete, will begin deployment.

image

When deployment has completed, you can find the bot and associates Azure resources under the All Resources blade of the left, or, if you have other stuff in Azure, go to the Resource Groups blade, and click on your Resource Group we created in the Bot setup above. In my case, the Resource Group is Testbot9001

image

Ok. So, we’ve created our bot with QnA Maker, and created a Bot Service in Azure… now what? We need to connect the two.

Select your bot, it’ll be the one which has a TYPE of Web App Bot

image

On the left hand side, click on APP SERVICE SETTINGS > Application Settings

image

And then scroll down to App settings. You will see two blank settings called QnAKnowledgebaseId and QnASubscriptionKey

Now, remember those things we copied off earlier? Pate these in there.

image

And then click Save up top

ScreenClip

Now, click on Test in Web Chat on the left side, and test out your new bot!

image

Pretty neat! But… now what?

Click on Channels on the left side. You will see Web Chat setup and running by default. You can also see, you can extend this out to Teams, Skype, and more pretty easily.

image

Click on Edit, and copy the Embed Code

image

And show one of the keys at the top

image

and replace the YOUR_SECRET_HERE in the embed code

image

And you can now drop that into a site, web part, whatever you’d like. It’s just an iFrame, so the possibilities are endless.

A simple example – using Embed Code on a SharePoint page:

image

image

image

Would I implement it like this for a client? Likely not… I’d be more apt to have a sliding pop-up window, similar to Facebook chats that can be minimized and maximized as needed. This was just an example to show how to build one of these.

 

References

Registration open for the August 9, 2017 Boston Area SharePoint Users Group Meeting

Registration is now open for the Boston Area SharePoint User Group (BASPUG) taking place on August 9th, 2017, at the Versatile office at 450 Donald Lynch Blvd., Suite B, Marlboro, MA​ from 7:00-8:30 PM. Click here to register!

Paul Schaeflein will be presenting "Elevate Search from a list of links to a 1st Class Experience"
Session Abstract

​In most SharePoint publishing sites, the search page is an after-thought. But with some planning and simple customizations, the Search Center can be a showcase experience. This session will cover simple configuration changes and html/javascript customizations that are sure to impress.

About the Speaker

​Paul Schaeflein is a solution architect/developer with experience in all versions of the SharePoint platform. He has more than three decades experience in architecting, designing and developing software solutions. This experience covers a vast range of technologies, languages and industries.

Paul is a top-rated speaker, having presented at numerous conferences including the Microsoft SharePoint Conference and TechEd conferences. Paul has participated in local user groups and SharePoint Saturdays and various online events. In recognition of community efforts, Microsoft has awarded Paul as a Most Valuable Professional (MVP) seven times, most recent in the Office Developer category.

MEETING SPONSOR – Versatile

At Versatile, we understand your IT solutions require careful consideration, whether you’re making traditional IT or cloud decisions. By focusing on clarity, simplicity, and support, we help you align your computing decisions with desired business outcomes. We take great pride in helping your organization run smoother, more efficiently, and more profitably by helping you find the right balance between traditional IT and cloud computing.

Versatile is more than our name – it’s who we are.​​​

SUSTENANCE

Food and beverages will be provided at the meeting free of charge from our meeting sponsor. We generally have pizza (with and without meat), as well a salad, water, and sodas. Beer and wine will also be available.​​

RAFFLE PRIZES

We will be handing out raffle tickets at the BASPUG meetings.

LOCATION

We will be meeting at the Versatile office at 450 Donald Lynch Blvd, Suite B, Marlboro, MA. Parking is free.

LINKED IN

Join our group on LinkedIn today to connect with the rest of the BASPUG members, and spread the word!

FACEBOOK
We are also on facebook!
http://www.facebook.com/#!/pages/Boston-Area-SharePoint-User-Group/113652405354617

TWITTER
Follow news about the Boston Area SharePoint Users Group on twitter by following us
@BASPUG, and by using the hashtag #BASPUG

WEB
Visit the Boston Area SharePoint Users Group website at
http://www.bostonsharepointug.org

ORGANIZERS
Event meetings are organized by
Geoff Varosky and Bob German of BlueMetal, James Restivo of Crow Canyon Systems.

Please visit The Boston SharePoint Area Users Group page for more event details!

Registration open for the May 10, 2017 Boston Area SharePoint Users Group Meeting

BASPUG_195square_initialsRegistration is now open for the Boston Area SharePoint User Group (BASPUG) taking place on May 10th, 2017, at the BlueMetal office at 9 Galen St, Suite #300, Watertown, MA​ from 6:30-8:30 PM. Click here to register!

Dimitri Ayrapetov will be presenting “How to Approach SharePoint Governance”

Session Abstract

​The term governance means different things to different people. There are many ways to define what governance means to your organization as you start on the journey of planning, implementing, and monitoring it. This session will provide the key fundamentals for approaching Governance in SharePoint with lessons from the field and practical best practices.​

About the Speaker

​Dimitri Ayrapetov is a Digital Partner with TrnDigital. He comes with over 10 years of consulting experience working with SharePoint, Office 365, and related technologies.

MEETING SPONSOR – BlueMetal

​Modern technology, craftsman quality. We’re an interactive design and technology architecture firm matching the most experienced consultants in the industry to the most challenging business and technical problems facing our clients. We seek to understand your business strategy and technical foundation to craft modern applications that holistically blend strategic vision, creative design, architecture, and innovation, to exactly meet your needs and ensure your success.​​

SUSTENANCE

Food and beverages will be provided at the meeting free of charge from our meeting sponsor. Food arrives at about 6PM. We generally have pizza (with and without meat), as well a salad, water, and sodas.​​

RAFFLE PRIZES

We will be handing out raffle tickets at the BASPUG meetings.

LOCATION

The meeting will be held at the BlueMetal Boston Office at 9 Galen St, Suite 300, Watertown, MA.​ Parking is FREE, and available in the main lot, and behind the building along the river.
Walk in the main building entrace (not the side of the bus stop), go to the back, take the elevator up to the 3rd floor, and the BlueMetal office is right in front of the elevator.

LINKED IN

Join our group on LinkedIn today to connect with the rest of the BASPUG members, and spread the word!
FACEBOOK 
We are also on facebook! http://www.facebook.com/#!/pages/Boston-Area-SharePoint-User-Group/113652405354617
TWITTER
Follow news about the Boston Area SharePoint Users Group on twitter by following us @BASPUG, and by using the hashtag #BASPUG
WEB
Visit the Boston Area SharePoint Users Group website at http://www.bostonsharepointug.org
ORGANIZERS
Event meetings are organized by Geoff Varosky and Bob German of BlueMetal, James Restivo of Crow Canyon Systems.

Please visit The Boston SharePoint Area Users Group page for more event details!

VR:1 is Complete!

This is kind-of off topic… but not too far off topic. It is SharePoint related!

I collaborated with fellow SharePointer Keith Richie (http://music.krichie.com) recently on an ambient album, and we just completed it.

I have been producing ambient music on the side via Musical Nature (http://musicalnature.net) for 20 years, and Keith and I have been friends since the SharePoint Conference back in 2009. He also produces ambient music, and we finally got around to collaborating on it.

If you’re not familiar with ambient music… think along the lines of relaxing textured background music, like a soundtrack in a movie.

So, please give it a listen, and let us know what you think! We hope you like it.

musical nature

I am pleased to announce that Keith Richie and I are pleased with VR:1 enough, that we are marking it complete. And we have left it with the “Name your price” feature enabled! I will be updating my discography shortly to list this release.

VR is a music collaboration project between fellow SharePoint Developer and Musician Friends Geoff Varosky and Keith Richie.

Geoff currently produces and releases experimental ambient music, ranging from long slowing soundscapes to beat and heavily sampled ambient house via Musical Nature which is his “ambient project in experimental sound”.

Keith Richie produces Ambient / Chill-out / Symphonic and Soundtrack music.

Together, we are “VR”.

VR is obviously a combination of the initials of our last names (Varosky and Richie), but as most know, it is also the abbreviation for “Virtual Reality”.

Virtual Reality typically refers to computer technologies that use software to generate realistic images, and…

View original post 65 more words

Replacing a Drop-Down List in Nintex Forms 2010 with an Autocompleting Textbox – Fix for Version 1.11.4.0 Update

SharePoint Sig wrote a great post about creating an autocompleting textbox in Nintex Forms 2010 using a Drop-Down list as the source. This was awesome code that did not require much hassle to implement. Until version 1.11.4.0 was released in January of this year.

That is right, this threat that is on every Nintex release finally came to pass:

image

The changes did indeed require adjustments to custom JavaScript.

We had a client that this functionality broke on, so the SWAT team was called in to figure out a solution. After a few frustrating hours, I was able to figure it out. When configuring your variables that are linked to your textbox and drop-down list, let’s call them simply mylist and mytext for the drop-down list and textbox respectively… the ID for the drop-down list element had changed and added _hid on the end of it. So as an example, the ugly ID for the element:

ctl00_m_g_53210a58_ac0b_4f63_be11_47018c3b62f1_ctl00_ListForm2_formFiller_FormView_ctl26_ca219dc8_8328_4480_b26c_fabd21a218d9

Now becomes:

ctl00_m_g_53210a58_ac0b_4f63_be11_47018c3b62f1_ctl00_ListForm2_formFiller_FormView_ctl26_ca219dc8_8328_4480_b26c_fabd21a218d9_hid

So I needed to add in a replace on the string to fix it:

mylist = mylist.replace("_hid","");

That’s the first issue. The second issue is iterating through the options in the dropdown did no longer work. The original code used the following to iterate through:

        $(dropDown1).children().each(function() {

This was no longer working in our implementation, so we did this:

Now, I tried several (well, a lot more than several) options to get ahold of the element, this seemed to be the only one that worked. I built up the element selector in a variable, and then passed it in:

var dropDownOptions = "#" + mylist + " > option";

NWF$(dropDownOptions).each(function() {

The final code ended up being close to this… this was the working prototype, so it can probably be cleaned up a bit more, but, the most important thing is that it worked (changed bits highlighted):

NWF$(document).ready(function(){

    var textbox = NWF$("#" + mytext);

    mylist = mylist.replace("_hid","");

    var dropDown1 = NWF$("#" + mylist);

       
    textbox.autocomplete({

        source: function(request, response) {

            var autocompleteVals = [];

            console.log("autocomplete1");

           
            var dropDownOptions = "#" + mylist + " > option";

            NWF$(dropDownOptions).each(function() {

                if (NWF$(this).text() != "(None)" && NWF$(this).text().toLowerCase().indexOf(request.term.toLowerCase()) >= 0) {

                    autocompleteVals.push(NWF$(this).text());

                }

            });

           
            response(autocompleteVals);

        },

        minLength: 1,

        select: function(event, ui) {

            console.log("autocomplete3");

            var fieldOption = NWF$("#" + dropDown1Id + " option").filter(function() {

                return NWF$(this).html() == ui.item.value;

            });

           
            NWF$(fieldOption).attr("selected", true);

            NWF$(dropDown1).change();

        }

    })

});   

Hope this helps someone else out struggling with this issue!

Registration open for the April 12, 2017 Boston Area SharePoint Users Group Meeting

BASPUG_195square_initialsRegistration is now open for the Boston Area SharePoint User Group (BASPUG) taking place on April 12th, 2017, at the Versatile office at 450 Donald Lynch Blvd., Suite B, Marlboro, MA​ from 7:00-8:30 PM. Click here to register!

Jared Matfess will be presenting "Enhancing Your SharePoint Business Solutions using JavaScript & REST"
Session Abstract

​This demo-heavy session is going to focus on showing you how to enhance your current business solutions using JavaScript & libraries such as DataTables, Google Charts, MomentJS, and more. Learn how to grab data from SharePoint Lists using the SharePoint REST API and display that information in a more meaningful way on the page.​

About the Speaker

Jared is a Solution Principal working for Slalom Consulting, a Microsoft Managed Partner providing national Business & IT solutions headquartered in Seattle, Washington. He is a Microsoft Certified Professional (MCP), and has over a decade of experience building technical solutions, and solving business problems. He is a regular speaker at user groups & SharePoint Saturdays all up and down the East Coast. Jared is also a Microsoft Most Valuable Professional (MVP) in the Office Servers and Services category. He can be reached through his blog or on Twitter (@jaredmatfess).

MEETING SPONSOR – Versatile

At Versatile, we understand your IT solutions require careful consideration, whether you’re making traditional IT or cloud decisions. By focusing on clarity, simplicity, and support, we help you align your computing decisions with desired business outcomes. We take great pride in helping your organization run smoother, more efficiently, and more profitably by helping you find the right balance between traditional IT and cloud computing.

Versatile is more than our name – it’s who we are.​​​

SUSTENANCE

Food and beverages will be provided at the meeting free of charge from our meeting sponsor. We generally have pizza (with and without meat), as well a salad, water, and sodas. Beer and wine will also be available.​​

RAFFLE PRIZES

We will be handing out raffle tickets at the BASPUG meetings.

LOCATION

We will be meeting at the Versatile office at 450 Donald Lynch Blvd, Suite B, Marlboro, MA. Parking is free.

LINKED IN

Join our group on LinkedIn today to connect with the rest of the BASPUG members, and spread the word!

FACEBOOK
We are also on facebook! http://www.facebook.com/#!/pages/Boston-Area-SharePoint-User-Group/113652405354617

TWITTER
Follow news about the Boston Area SharePoint Users Group on twitter by following us @BASPUG, and by using the hashtag #BASPUG

WEB
Visit the Boston Area SharePoint Users Group website at http://www.bostonsharepointug.org

ORGANIZERS
Event meetings are organized by Geoff Varosky and Bob German of BlueMetal, James Restivo of Crow Canyon Systems.

Please visit The Boston SharePoint Area Users Group page for more event details!

Registration open for the March 8, 2017 Boston Area SharePoint Users Group Meeting

BASPUG_195square_initialsRegistration is now open for the Boston Area SharePoint User Group (BASPUG) taking place on March 8th, 2017, at the BlueMetal office at 9 Galen St, Suite 300, Watertown, MA from 6:30-8:30 PM. Click here to register!

Bob German will be presenting "Is it Safe to Customize SharePoint?"
Session Abstract

​Since 2007, SharePoint has been billed as a platform for developing custom solutions. And who wants to be limited to just what’s in the box? The thing is, sometimes the customizations break when you upgrade SharePoint, which might be at any moment if you’re in SharePoint Online. Just ask anyone who used the "Fab 40" web templates and then couldn’t upgrade from SharePoint 2007! It’s gotten so crazy that some people just won’t customize SharePoint at all, even as new development technologies are introduced.

In this talk, we’ll review all the major options for customizing SharePoint since 2003, and the strengths and pitfalls of each. You’ll learn which options are "safe" and which are headed for a long trip down a short pier. This talk is for everyone who makes decisions about SharePoint – admins, business decision-makers, architects, and developers alike. You’ll learn what’s possible from each type of customization, and what the future has in store. The goal is to make it easy for you to navigate through all the options without stepping on any land mines!​

About the Speaker

Bob German is Principal Architect at BlueMetal Architects, where he leads SharePoint architecture and development engagements for enterprise customers. Bob has been developing on the SharePoint platform since it was called “Site Server”, and is a Microsoft MVP for Office Development and Office Services and Servers. Over the last few years, Bob has demonstrated "future-proof" client side solutions that allow code reuse from legacy SharePoint to the Add-in model and the forthcoming SharePoint Framework.

Prior to joining BlueMetal, Bob was an architect at the Microsoft Technology Center in Boston, MA; he also worked for Microsoft Consulting Services building and performance tuning web sites and other networking solutions.

DATE

Wednesday Mar 08, 2017.

TIME

6:30 PM – 8:30 PM.

LOCATION

The meeting will be held at the BlueMetal Boston Office at 9 Galen St, Suite 300, Watertown, MA.​ Parking is FREE, and available in the main lot, and behind the building along the river.

Walk in the main building entrance, go to the back, take the elevator up to the 3rd floor, and the BlueMetal office is right in front of the elevator.​​

MEETING SPONSOR – BlueMetal

Modern technology, craftsman quality. We’re an interactive design and technology architecture firm matching the most experienced consultants in the industry to the most challenging business and technical problems facing our clients. We seek to understand your business strategy and technical foundation to craft modern applications that holistically blend strategic vision, creative design, architecture, and innovation, to exactly meet your needs and ensure your success.​​

SUSTENANCE

Food and beverages will be provided at the meeting free of charge from our meeting sponsor. Food arrives at about 6:00. We generally have pizza (with and without meat), as well a salad, water, and sodas.​​

RAFFLE PRIZES

We will be handing out raffle tickets at the BASPUG meetings.​​

"Sticky" System Tray Icons in Windows 10

So, I just got a new laptop for work. And this is really my first time using Windows 10 on a daily basis. I know… I know… I am way behind the times for someone that works with technology for a job… but really, the only time I upgrade my work laptop OS is when I get a new one. I just have far too much going on usually to take a couple days out to install a new OS and redo everything that comes along with it. It takes things like the entire USB bus, networking, and hard drive failing out on me every 20 minutes to get me to do something…

Anyways, now that you are caught up on the backstory here, one of the main things I was lacking in Windows 10 that I need (or really really really wanted), is quick access to system tray icons.

As a consultant, I am constantly jumping from client VPN to client VPN, and also need tools like PureText, because I do a lot of copying and pasting, so I need quick access to these things. Clicking the chevron, and then finding the icon I want, then right clicking it is far too much for me apparently now that I’ve been so used to being able to do so.

I could not figure out for the life of me how to duplicate the "Show icon and notifications" option that I had in Windows 8.1. So, I went to the googleverse… and came across a Lifehacker article. The article itself did not help… but down in the comments, I found this gem:

Image

Hah! Look at that! Easy and simple, and now I am happy. Just wanted to share this nugget!

Creating New Service Application Proxy Groups and Associating Services and Sites

Sometimes the need arises to create separate Service Application Proxy groups in SharePoint. Starting with SharePoint 2010, you’ve been able to do this. In SharePoint 2007, you would have created different Shared Service Providers. Your needs might be, that you are exposing web applications to a different group of users, and need separate applications such as Search and the User Profile Service. This also allows you to run those service applications under different accounts, if you needed to for security reasons.

First, let’s create the proxy group we want to use. And lets give it a name.. in the example, I’ll be using "Redacted"… because all my screenshots have had the real service application group identity redacted 🙂 But you can name this anything you’d like. Load up the SharePoint Version Management Console… and call the New-SPServiceApplicationProxyGroup PowerShell cmdlet.

New-SPServiceApplicationProxyGroup "Redacted"

Once you have your new Service Application Proxy Group created, you can then change the web application subscriptions to the proxy groups. To do so, go into Central Administration > Application Management > Web Applications > Manage web applications and select one of your sites. In the ribbon, then select Service Connections under the Management group.

Image(5)

You can always verify this by then going into Central Administration > Application Management > Service Applications > Configure service application associations

Image(6)

Select the Web Applications view, and then you should see your sites, and their associated applications with their Application Proxy Groups.

Image(7)

When you create a new service application, by default, it is going to get tossed into the default group. There is no way in the UI presently to allow you to change associations in the UI once you have created your new proxy group, so, what you need to do is to handle this in PowerShell. The best way to get the IDs for your service applications is to use Get-SPServiceApplication, and then only display the two columns you need, DisplayName (so you know what ones you are looking for), and the Id.

Get-SPServiceApplication | select-object DisplayName,Id

Image(8)

Once you have the ID’s that you need for your Service Applications, you now need to add them as members to the new proxy group you created earlier. You can do this by using the Add-SPServiceApplicationProxyGroupMember PowerShell cmdlet, like so:

Add-SPServiceApplicationProxyGroupMember "Redacted" -Member "f166672c-24b5-4f1a-bd2d-e8436d966abb"

This will add the "Secure Store Service – Redacted" Service Application to my new proxy group Redacted.

If for some reason, one of the service applications do not want to move out of the default group after adding them into the new group, you can remove them with the Remove-SPServiceApplicationProxyGroupMember PowerShell cmdlet. Just an FYI – the default group is referenced as "", so, if you needed to now remove the above service from the default group, you will need to address it as:

Remove-SPServiceApplicationProxyGroupMember "" -Member "f166672c-24b5-4f1a-bd2d-e8436d966abb"

SharePoint Patterns and Practices Cmdlet Reference Guide Now Available

Finally here! Microsoft has released a reference guide for the over 200 Patterns and Practices Cmdlets!

ScreenClip

Check it out here: http://aka.ms/sppnp-powershell

%d bloggers like this: