Forum Discussion
Teams bot with dynamic endpoint url
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?