Teams bot with dynamic endpoint url

Copper Contributor

I want to develop a teams chat bot which should be able to connect to different service instances. In app manifest editor we can configure single url. This bot service url is separate per organisation, is there any way in MS teams that we can configure service url at app setup time on org level or for a user

6 Replies

@SujayBawaskar , What do you mean by different endpoint instance? Do you mean to set different messaging endpoint for your Bot? A bot listen on an endpoint given while setting up the Bot. Please clarify

@Trinetra-MSFT , yes I need set different messaging endpoint instance per organisation.

A Bot listens the request on a single endpoint, you can specify only one endpoint in a Bot

@Trinetra-MSFT , thanks for clarification

@SujayBawaskar  That's true that Bot can listen to only one Messaging endpoint. In case if you want to customize your app you may achieve this task like below. 

I am also developing one Teams App so Let me try to suggest one workaround for your request.


1) create one endpoint which listens to you a Bot

2) create Bot command as per the demand of your App (let's say Command ABC, XYZ, PQR)

3) Execute the Bot command and you can easily identify which command is executed (on the event called OnTurnAsync )

4) Based on the command you can identify the Command and make REST request for your desired endpoint and response back to the same bot. (You should have mapping of your endpoint i.e. Bot Command vs Endpoint) . Keep all this somewhere in config file.

This just workaround your problem statement.

I hope it might help!! Happy Coding

@NadirRiyani We are doing something nearly identical to what you suggested, but running into an issue where the context provided to us from `TeamsAdapter (context) => {}` changes when we pass it through our global forwarding endpoint.


We have a single endpoint => looks up which API to forward the Microsoft payload/request to (we pass along the request body and headers exactly as they arrive via cURL) => API Server fails to send message/


When we add a single API Server endpoint the problem goes away -- but we have to route traffic to our forwarding endpoint service in order to figure out which API to forward to.


When we console.log(context) it is different from one method to the other, so we're sure it's with the teamsAdapater.processActive JS function.


Any ideas?