Forum Discussion

XDeveloper29's avatar
XDeveloper29
Copper Contributor
Mar 27, 2024

How to deploy a Bot/Message extn app developed with Teams Toolkit (5.6) to a self-managed server?

I'm developing a Bot/Message Extension App for use in our organization. Using Teams Toolkit, I have created a project and using Typescript for it. Local testing is automatically supported from app registration without much consideration, so it seems very convenient. However, when I try to deploy this, I am a bit confused. Teams Toolkit seems to support deployment according to Azure Bot Service by default.(.dev)
I can't use the Bot Service for a number of reasons and should consider running the bot on a self-managed host. First of all, is this possible?
In this case, what steps should I take in Teams Toolkit, Azure portal, Teams development portal?
If this is not possible with Teams Toolkit, how should I configure the bot's hosting?

I have checked, we have to mention the endpoint URL but seems confuse to where it has to be mention.

5 Replies

  • You can host your application logic where you want. However, for bots, you still need two things and that is a registration with Bot Framework and the Bot ID is an Entra App ID, all of these things are cloud resources. They are required to run on the platform.

    You don't have to use Azure Bot Service right now, although it is recommended.

    The way the local hosting works in Teams Toolkit is to use dev.botframework.com/bots/new to create a bot registration instead of Azure Bot Service.

    If your scenario, self-hosting your application logic means you still need to register with Bot Framework, via either dev.botframework.com or Azure Bot Service. Either way, a "bot" is an Entra ID App registration which happens in Azure (free). Your self-hosted application will need to be accessible to Bot Framework/Azure Bot Service via the "messaging endpoint" that is configured. For local hosting, we create a developer tunnel to expose localhost to Bot Framework.
  • Dinesh-MSFT's avatar
    Dinesh-MSFT
    Iron Contributor

    Hi XDeveloper29 - Sorry for the delay in the response. To deploy a Bot/Message Extension app developed with Teams Toolkit to a self-managed server, follow these steps:

    Prerequisites:

    • Install ngrok to create an externally addressable URL for your bot.
    • Update your bot's messaging endpoint to use the ngrok URL. 

    Steps to Deploy:

    1. Update Bot Messaging Endpoint:
    1. Update Code References:
    • Replace all URL references in your code, configuration, and manifest.json with the ngrok URL.
    1. Configure ngrok:
    • Run ngrok http 3978 --host-header=localhost:3978 in the terminal to get an externally addressable URL.
    1. Deploy to Self-Managed Server:
    • Host your bot on a server that supports Node.js applications.
    1. Update Bot Registration:
    • Update the bot registration in Azure or the Teams development portal to the new endpoint on your server.
    1. Test the Bot:
    • Ensure the bot functions correctly on your self-managed server.

    Additional Information:

    • Use the Bot Framework SDK for messaging schema and secure communication.
    • Ensure your app manifest defines the message extension with necessary commands and locations.

    By following these steps, you can deploy your bot to a self-managed server, hosting it independently of Azure Bot Service. Please refer to the Bot Framework SDK. If you need further assistance, feel free to ask.

Resources