1) External apps is enabled in Office Admin Portal
If I install a bot in Teams, I'm able to talk to my bot via a private chat without issue. If I navigate to Office Admin Portal and toggle the "allow sideloading of external apps" from on to off, save it, and then toggle back to on, the bot fails to respond. I can however communicate to my bot via a Teams channel chat, by "@" the bot.
Things I did to try troubleshoot:
1) Uninstalled and installed bot again - didn't work
2) Logout and log back in - didn't work
3) Restart bot app service in Azure - didn't work
4) Local debug using ngrok - unable to solve issue
When I debuged the bot using ngrok I got the following error when sending a message to the bot via a private chat:
Name Value Type
Exception thrown: 'Microsoft.Bot.Schema.ErrorResponseException' in System.Private.CoreLib.dll ("Operation returned an invalid status code 'Forbidden'")
Ngrok returns a error 500 messages. However, if I send a message via a Teams channel to the bot I get a 200 message and the bot returns the expected message to me. Referring back to the error, it occurs at the spot where the bot is trying to reply to the user. So my theory is, somehow Teams still thinks that the policy of not allowing external apps is still in place and denies the bot from send the message to the user.