Join Sahil Malik for an in-depth discussion in this video Testing one-on-one Teams bot, part of Microsoft Teams Bot Development.
- [Instructor] Now our bot code changes that initiate a one-on-one dialog with me are done. It's time to test this. Well, let's see how we can test this. First, I'd like you to make sure that ngrok is running and that your bot registrations are indeed pointed to this URL. Next, I'd like you to go back to the previous terminal where we had killed node index.js and you need to restart it. So, I'll say npm start and that should bring up node js again listing on port three, nine, seven at which ngrok is exposing on the internet.
Now, we need to launch teams. Now there are two different ways you can do this. One simple way is that you simply go to your bot's registration and I'll show you again just like before in the new portal and the old portal. Let's start with the old portal first. So, you go to my bot, you find your bot, and then you find the channel Microsoft Teams and simply click on it. This should launch Microsoft Teams. And not only will it launch Microsoft Teams, it will also launch a one-on-one chat base interface with your bot.
Another way of doing this, if you're using the new portal is that you go to channels and look for the Microsoft Teams channel added here and simply click on the channel and again this will also launch Microsoft Teams and it'll start a one-on-one chat with your bot. A third way of testing one-on-one chat is to simply go to Microsoft Teams and go ahead and sign in. And here go ahead and click this new chat button and here simply type the good of the bot that you wish to chat with.
So, anyone of these approaches is fine, but I'm going to pretend that I am going to launch this from my old portal since that's where my registration is. Go ahead and click on that link. It'll prompt you to open Microsoft Teams. At this point, if Teams wasn't running it should start. Please make sure you have the latest version of Teams. Some of the older versions of Teams don't properly interact with the latest versions of the bot framework. So, if you see an update message appear go ahead and update Teams. Now, down here let's go ahead and talk to our bot, but before I talk to the bot let me go ahead and also look at what ngrok is telling me in parallel because I want to make sure that the messages are indeed coming to my machine.
Talk to me. Looks like the message came in and at this point it says, "Welcome, this is the start of a new dialog." So, you see that our bot was able to initiate a brand new conversation with us. Now, if you go back here into our code, this new dialog could've been initiated, not just with the result of our message coming in, but also any other event that could've happened in your code.
Like I said, "If a document matches with a certain phrase, alert me." And if I was not even in the conversation with the bot you'd have seen this activity area light up and when the bot mentions me, then yes I would see that notification. So, this is how one-on-one chats work with Microsoft Bots and Teams.
- What are bots?
- Creating bots
- Testing using ngrok
- Deploying bots to Microsoft Teams
- Testing bots
- Bots as Azure AD applications
- Updating bot registration in Azure
- Building the bot package