Join Sahil Malik for an in-depth discussion in this video Running your bot, part of Microsoft Teams Bot Development.
- [Narrator] Now, in order to run this bot, as you see the little package.json, I have a command called node index.js. That's npm start. So I'm just going to go ahead and run npm start. And that starts up my web service, assuming I have no errors in my code. I'll choose to allow access. And now my bot is running. If you were to visit local host 3978/api/messages, whatever you URL you would expose the bot on, the server should answer.
It won't make much sense because it doesn't accept a git request, but the server will answer. You could try that on your own. But now, how to I test the bot? Well, for that, I need a tool called the Bot Framework Emulator. Let's get that. So let's visit the GitHub rapid for Bot Framework Emulator. And this is just a tool that Microsoft has written. And this tool is a tool written in electron, so it works on Mac, Window's, Linux.
So you go to the download link here, and you search for the specific tool for your operating system. So in my case, that would be the Bot Emulator Setup. So I'm going to click on that. And I'm going to download and install this. And after the tool is installed, it'll run it.
And let's go ahead and connect to our Bot using this tool. It also created a shortcut on the desktop. I'll leave it there. So you click on here, and you see that this is the URL we had chosen to avoid some typing. So I'll choose this. And it's asking for a Microsoft App ID and App Password. Now, if I was running this Bot in Azure connected to say, Lewis, etc., then I would get an app ID and a password. I haven't done any of that yet. This is a very simple bot.
So I'll just leave these blank, and I'll click on Connect. Now, if you connect yes, then your bot is connected. Now, I can just say, hey there, and the bot responds with Hello World! I can click on any one of these messages, and it shows me exactly what was sent and what was received. And this way I can examine the back and forth interaction of the bot. Now, this Bot Framework Emulator doesn't support everything, but it's an easy way for me without going over the Internet, or exposing anything on the Internet.
I can do some basic testing with this. And yes, all of that is being run through here, and you see that it is writing things out. So it got star routing, "Hey there" from emulator. And what we're responding to was "Hello World!"
- 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