microsoft-teamsteams-toolkit

Host bot on-premise? Bot needs to communicate with another program


My bot (using Teams toolkit in vscode) needs to communicate with another program that's located on my server so I would like to host my bot on the same server. But, according to the docs I can only deploy it to Azure. I don't really want to build an API and would rather host the bot on my own server if possible.

I watched some videos on YouTube that were not helpful and looked at the documentation. I was expecting a clear "yes you can host it on premises if you do x" or a clear "no not possible" but got none.


Solution

  • Yes, it is possible to host it on premises. In order for a bot to work in Teams, it must have a registration in the Microsoft Bot Framework Services in Azure, but there are two options when creating your bot in Azure:

    1. Bot with Web App - this includes a bot registration AS WELL AS hosting, specifically using an Azure Web App

    2. Bot "Channels" Registration - this is JUST the registration, which allows a very decent free traffic option (number of messages), and then also allows you to host your bot wherever you like (Azure, AWS, local, etc.). Part of the configuration is an https web address where you bot 'lives', which could be served from your local server.

    So, it's possible to host locally, but it has several challenges/considerations:

    1. You need to make your local bot internet accessible. It's possible in several ways (e.g. IIS, NGrok, etc. depending on your platform), but it's more headache and possibly security risk.
    2. You are 100% responsible for security, uptime, failover, etc. etc.

    so consider careful before hosting locally, but yes it can be done.