Search code examples
c#botframeworkbotsmicrosoft-teams

Bot framework Emulator - deploy bot on premise and install on teams


I'm trying to create a Microsoft Teams Bot using Bot framework Emulator that I can deploy on premise and install on Microsoft Teams.

I have a simple Bot, that I start on Bot Framework Composer, and works just fine when I click "Start bot".

  1. I've exported the bot as zip enter image description here

  2. I've run it using Visual Studio 2019, which works ok.

  3. I've tried to connect using the Bot Framework Emulator, which works ok.

  4. I've deployed the same bot on local IIS, I've managed to connect to the bot using Bot Framework Emulator.

What doesn't work

I've deployed the bot to a remote server. When I try to use the emulator, it doesn't work anymore. The error I get is Error: The bot is remote, but the service URL is localhost. Without tunneling software you will not receive replies.

In Microsoft Teams using App Studio I've done the following steps:

  1. Create new app using the following feature enter image description here
  2. Fill the inputs in the "App Details" and generate a new App ID, the generated AppId, i set on appsettings.json for the key MicrosoftAppId enter image description here
  3. On "Bots" menu, I've set up a new bot. enter image description here
  4. Configure the "Messaging endpoint address"
  5. On "Test and distribute" click on install your app in teams for testing.

The bot is really quiet, what am I doing wrong?


Solution

  • If I understand your problem correctly, you are trying to run a bot on Teams from local. I didn't understand why you are trying to do with Bot Framework Emulator.

    In order to debug and run bot on Teams from local, here are the two ways you can do that:

    1. Debug a bot from any channel using ngrok. It requires a subscription to Microsoft Azure.
    2. If you don't have azure subscription, you can try doing with App Studio. You are doing all right just you need to put https://example.ngrok.io/api/messages URL or public facing URL of service your bot is deployed, in messaging endpoint.

    To run ngrok, here is the command ngrok http 44327 -host-header=localhost:44327. Change the port accordingly, you can checkout Properties -> launchSettings.json to know your port or to change(in c#).

    Some useful docs:

    1. Prerequisites: Get started with Microsoft Teams app development
    2. Build your first conversational bot for Microsoft Teams