{"id":77890,"date":"2020-09-29T18:00:03","date_gmt":"2020-09-29T15:00:03","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-create-a-simple-bot-in-microsoft-teams-cloudsavvy-it\/"},"modified":"2020-09-29T18:00:03","modified_gmt":"2020-09-29T15:00:03","slug":"how-to-create-a-simple-bot-in-microsoft-teams-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-create-a-simple-bot-in-microsoft-teams-cloudsavvy-it\/","title":{"rendered":"#How to Create a Simple Bot In Microsoft Teams \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a23e72929422\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a23e72929422\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-create-a-simple-bot-in-microsoft-teams-cloudsavvy-it\/#Creating_a_Web_App_Bot\" >Creating a Web App Bot<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-create-a-simple-bot-in-microsoft-teams-cloudsavvy-it\/#Building_a_Web_App_Bot\" >Building a Web App Bot<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-create-a-simple-bot-in-microsoft-teams-cloudsavvy-it\/#Testing_the_Web_App_Bot\" >Testing the Web App Bot<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-create-a-simple-bot-in-microsoft-teams-cloudsavvy-it\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#How to Create a Simple Bot In Microsoft Teams \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-7088 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/6bef64d0af52e50c2bad11bc1d70ec2c\/p\/uploads\/2020\/09\/8b1648fb.png\" alt=\"Microsoft Teams logo cartoon\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>One of the most powerful features of Microsoft Teams is the ability to create and connect bots. These bots allow conversational and transactional capabilities to easily create more complex tasks.<\/p>\n<p>Beyond the actual coding of a bot to do useful tasks, implementing the infrastructure has been a challenge. This is because bots usually require a web service backing configured in a specific way, which makes quickly creating and testing a bot is more of a challenge.<\/p>\n<p>Microsoft created a Web <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">App<\/a> Bot service that spins up all of the necessary infrastructures to allow you to quickly get started with developing a bot, testing, and ultimately publishing that bot to Teams. In this article, we explore how to quickly get started using the Echo bot template.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Creating_a_Web_App_Bot\"><\/span>Creating a Web App Bot<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The fastest way to create a new Web App Bot is to use the Microsoft Portal search ability to locate the Web App Bot in the Marketplace under the Bot Services service.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-7071 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/21f4bd2d4ff7b4bd4cf214d92b2f43d5\/p\/uploads\/2020\/09\/98c1a959.png\" alt=\"Locate the Web App Bot in the Marketplace under the Bot Services service\" width=\"1057\" height=\"529\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Once you have clicked on the Web App Bot, you are brought to a wizard to provision your bot and its necessary configurations.<\/p>\n<ul>\n<li><strong>Bot Handle:<\/strong> <code>lctestbot<\/code>\n<ul>\n<li>This is a unique handle that needs to be different than existing bots because it lives on <code>azurewebsites.net<\/code>.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Subscription:<\/strong> <em>{tenant subscription}<\/em><\/li>\n<li><strong>Resource Group:<\/strong> <em>{resource group for the bot}<\/em><\/li>\n<li><strong>Location:<\/strong> <em>{location to place the bot}<\/em><\/li>\n<li><strong>Pricing Tier:<\/strong> $1 (1k Premium Msgs\/Unit)\n<ul>\n<li>There is also a 10k option as well.<\/li>\n<\/ul>\n<\/li>\n<li><strong>App Name:<\/strong> <code>lctestbot<\/code><\/li>\n<li><strong>Bot Template:<\/strong> Echo Bot (C#)<\/li>\n<li><strong>App Service Plan\/Location:<\/strong> <code>lctestbot\/Central US<\/code>\n<ul>\n<li>By default, you need to click on this to create a new location.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Application Insights:<\/strong> On<\/li>\n<li><strong>Application Insights Location:<\/strong> Central US\n<ul>\n<li>This is recommended to be the same as where you locate the bot.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Microsoft App ID and Password:<\/strong> Auto Create App ID and password\n<ul>\n<li>This is recommended to let Azure manage this, unless you have a reason for using a specific app ID and password.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-7072 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/a961cfa66bb9099392eb266536367d1f\/p\/uploads\/2020\/09\/06500def.png\" alt=\" Web App Bot wizard\" width=\"1274\" height=\"835\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>You will need to make sure you have two providers registered for your subscription: <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" class=\"notion-link-token notion-enable-hover\" href=\"http:\/\/microsoft.storage\/\">Microsoft.Storage<\/a> and Microsoft.BotService. These are located under your Subscription \u2192 Resource Providers. You might find that the first time you load up Web App Bot it complains about not having the Microsoft.BotService registered. However, if you exit out and reenter, it will most likely work. This service automatically registers the first time you load it up and takes a moment.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Building_a_Web_App_Bot\"><\/span>Building a Web App Bot<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Once the Web App Bot is created, you have access to the configuration pages for the bot. In this example, we are going to do a simple modification to the existing source code, rerun the build script, test, then test in a Teams client.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-7073 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/1d1a5a732d2a8ab43757f9a5fdb5098e\/p\/uploads\/2020\/09\/33341b80.png\" alt=\"Building your Web App Bot\" width=\"1278\" height=\"781\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Navigate to the Build page, then locate the Open online code editor link. Clicking on this link opens the App Service Editor, making it easy to quickly modify the code and rerun the build script.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-7074 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/73f9db38446a18e998593c8a7d55b0bf\/p\/uploads\/2020\/09\/bb946b98.png\" alt=\"App Service Editor where you modify and rerun code\" width=\"1291\" height=\"529\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>There is a lot of supporting code to make the bot work, but the core of the code is in the Bots folder. This contains the <code>EchoBot.cs<\/code> file, which we are going to modify. As you can see in the code below, we are going to add the <code>Test<\/code> text preceding the existing <code>Echo<\/code> text. By modifying the code, the file will be saved as you go and you do not need to manually save the changes.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-7075 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/886f900c9c267dbea278ba65e9d9bc2b\/p\/uploads\/2020\/09\/bbc0995c.png\" alt=\"The file is saved as you go, so you don't need to manually save code modifications\" width=\"1297\" height=\"897\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Navigate to the Console, and enter in the <code>build.cmd<\/code> command. This will run a <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/watch-movies-tv-seriess\/\" data-internallinksmanager029f6b8e52c=\"8\" title=\"Watch Movies &amp; TV Series\" target=\"_blank\" rel=\"noopener\">series<\/a> of commands, recompile the code, and ultimately copy the compiled files to where they need to go to make the bot available. In the end, you should see a <code>Finished successfully<\/code> message indicating the compiled files are now available.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-7076 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/0b38a0ffc657701ae26c87e989778cf1\/p\/uploads\/2020\/09\/59a3957a.png\" alt=\"If you a Finished successfully message, the modification is successful \" width=\"1302\" height=\"639\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Testing_the_Web_App_Bot\"><\/span>Testing the Web App Bot<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Thankfully, there is a Test in Web Chat feature built right into the Microsoft Portal Web App Bot services. This useful tool allows us to test how the bot reacts to conversational dialogue and simple commands. In this case, our bot simply echoes back the text. To make sure our change has taken effect, when sending in some text you should see the same text echoed back with the preceding text of <code>Test Echo:<\/code>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-7077 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/892a0c211ab54b34f73f8bd6ddd5d08e\/p\/uploads\/2020\/09\/1e1aeb5a.png\" alt=\"The same text echoed back with the preceding text of Test Echo if successful\" width=\"1297\" height=\"837\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Next, we want to test this bot in an actual Teams client. By default, the only connected channel is the Web Chat. Click on the \u201cTeams\u201d icon to connect this bot to the Teams channel.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-7078 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/617096bf8691fb6ecd558cd6344c4699\/p\/uploads\/2020\/09\/e396a1c8.png\" alt=\"Click on &quot;Teams&quot; icon to connect bot to  Teams channel\" width=\"1287\" height=\"817\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>In this case, we are going to use all defaults, which is the Microsoft Teams Commercial messaging option, and all other options stay the same. Click \u201cSave\u201d to make this available to the Microsoft Teams channel.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-7079 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/f90eda6a557fc18c8eef55441dd8d21a\/p\/uploads\/2020\/09\/b762c60c.png\" alt=\"Click &quot;Save&quot; to make this available to the Microsoft Teams channel\" width=\"1283\" height=\"835\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>To load up the bot into a Teams client, simply click on the Microsoft Teams link, and it will automatically load the bot into your Teams client.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-7080 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/5573f61d106e6c0dfc758da7652122b3\/p\/uploads\/2020\/09\/6b269188.png\" alt=\"Load up the bot into a Teams client by clicking on the Microsoft Teams link\" width=\"1290\" height=\"499\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>As you can see below, the bot is available to the client, and we can test by sending a chat message and seeing that the result is as expected.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-7081 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/2f63101077e6061aac5d5200530d4101\/p\/uploads\/2020\/09\/258455c3.png\" alt=\"Test by sending a chat message to see that the result is as expected\" width=\"1253\" height=\"906\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Microsoft Teams provides a powerful bot experience, but to ease development, take advantage of the Web App Bot service in Microsoft Azure. This lets you 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 bots today!\n<\/p><\/div>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener noreferrer\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/7070\/how-to-create-a-simple-bot-in-microsoft-teams\/\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#How to Create a Simple Bot In Microsoft Teams \u2013 CloudSavvy IT&#8221; One of the most powerful features of Microsoft Teams is the ability to create and connect bots. These bots allow conversational and transactional capabilities to easily create more complex tasks. Beyond the actual coding of a bot to do useful tasks, implementing the&#8230;<\/p>\n","protected":false},"author":1,"featured_media":77891,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2020\/09\/8b1648fb.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-77890","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/77890","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=77890"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/77890\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/77891"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=77890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=77890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=77890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}