قالب وردپرس درنا توس
Home / Tips and Tricks / How to create a simple cure in Microsoft Teams – CloudSavvy IT

How to create a simple cure in Microsoft Teams – CloudSavvy IT



Microsoft Team logo cartoon

One of the most powerful features of Microsoft Teams is the ability to create and connect bots. These bots allow conversation and transaction functions to easily create more complex tasks.

In addition to the actual coding of a bot to make useful tasks, the implementation of the infrastructure has been a challenge. This is because bots usually require a web service support that is configured in a specific way, which makes it quick to create and test a bot.

Microsoft created a Web App Bot service that spins up all the necessary infrastructure so you can quickly get started developing a bot, testing, and ultimately publishing it to Teams. In this article, we explore how to get started quickly with the Echo bot template.

Create a web app bot

The fastest way to create a new web app bot is to use the Microsoft Portal search feature to find the web app bot in Marketplace under the Bot Services service.

Locate the Web App Bot on the Marketplace under the Bot Services service

Once you have clicked on the Web App Bot, you will come to a guide to provide your bot and its necessary configurations.

  • Both handle: lctestbot
    • This is a unique handle that must be different from existing robots because it lives on azurewebsites.net.
  • Subscription: {tenant subscription}
  • Resource group: {resource group for the bottom}
  • Place: {place to place the bottom}
  • Pricing: $ 1 (1k Premium Messages / Device)
    • There is also a 10k option as well.
  • App name: lctestbot
  • Botmall: Echo Bot (C #)
  • App Service Plan / Location: lctestbot/Central US
    • By default, you must click on this to create a new location.
  • Application Insights: On
  • Application Insights Location: Central USA
    • This is recommended to be the same as where you find the cure.
  • Microsoft App ID and Password: Automatically create app ID and password
    • This is recommended for Azure to handle this, unless you have a reason to use a specific app ID and password.

    Web App Bot Guide

You need to make sure you have two vendors registered for your subscription: Microsoft.Storage and Microsoft.BotService. These can be found under your subscription → resource providers. You may find that the first time you upload Web App Bot, it complains that Microsoft.BotService is not registered. But if you leave and reintroduce, it will probably work. This service is automatically registered the first time you upload it and it takes a while.

Build a Web App Bot

Once the Web App Bot has been created, you have access to the bot configuration pages. In this example, we will make a simple modification of the existing source code, rewrite the build script, test and then test in a Teams client.

Build Your Web App Bot

Navigate to the Build page and find the Open Code Editor Online link. Clicking on this link opens the App Service Editor, which makes it easy to quickly change the code and re-run the build script.

App Service Editor where you change and re-run the code

There is a lot of support code to make bot work, but the core of the code is in the Bots folder. This contains EchoBot.cs file that we will change. As you can see in the code below we will add Test text before the existing one Echo text. Changing the code saves the file as you go and you do not have to save the changes manually.

The file is saved as you go, so you do not need to save code changes manually

Navigate to the console and enter build.cmd command. This will run a series of commands, recompile the code and eventually copy the compiled files to where they need to be made available. Finally, you should see a Finished successfully message indicating that the compiled files are now available.

If a message Completed successfully, the change is successful

Test the web app’s bot

Thankfully, there is a test in web chat feature built into Microsoft Portal Web App Bot services. This useful tool allows us to test how the bottom responds to conversation dialogs and simple commands. In this case, our cure simply echoes back the text. To ensure that our change has taken effect, when you submit some text, you should see the same text echoed back with the previous text in Test Echo:.

The same text echoed back with the previous text in Test Echo if it succeeded

Then we want to test this bottom in an actual Teams client. By default, the only connected channel is web chat. Click the “Teams” icon to connect this bottom to the Teams channel.

click

In this case, we will use all the default settings, which is the Microsoft Teams Commercial messaging option, and all other options will remain the same. Click “Save” to make this available to the Microsoft Teams channel.

Click

To upload the bottom to a Teams client, just click on the Microsoft Teams link and it will be automatically loaded into your Teams client.

Upload the bottom of a Teams client by clicking the Microsoft Teams link

As you can see below, the cure is available to the client, and we can test by sending an instant message and see that the result is as expected.

Test by sending a chat message to see that the result is as expected

Conclusion

Microsoft Teams provides a powerful bot experience, but to facilitate development, use the Web App Bot service in Microsoft Azure. This allows you to create a test bot that is easy to use and quick to develop, either from the online code editor or an offline editor such as VS Code. Start developing Microsoft Teams robots today!


Source link