1
votes

I have set up a bot registration channel that connects to my bot's endpoint. It works perfectly fine in Bot Framework Emulator.

I am having problems connecting to my bot through the "Test in Web Chat" page on the Azure Portal. I try to send a message, but nothing happens and all I see under the message is "Sending".

I will then go to the "channels" tab in the blade and see an error for web-chat: There was an error sending this message to your bot: HTTP status code Unauthorized.

When I try sending a message to the bot in Microsoft Teams, absolutely nothing happens. I do not even get an error. Under health on the Azure Portal it just says "Running".

Getting my bot to work in the web chat is not top priority though. I really want it to work in teams in the end.

2
Have you added the Microsoft App Id and Microsoft App Password?Marc Asmar
Is that something I do with my manifest?a135
Have you added your Microsoft App ID and password to your bot code(appsettings.json in C# / .env in JS)? When you create a BCR, it generates an AppId for you but you need to generate a new password which you need to add to your bot code in order to test on other channels.ranusharao
@ranusharao Okay so in my '.env' file, I did the following: For "MicrosoftAppId", I put the Microsoft App ID. For "MicrosoftAppPassword", I put the secret key that I created (it will last a year). Am I doing this correctly? I restarted my bot but it still doesn't work in Teams...a135
Could you please share you app manifest so we can check he issue?Trinetra-MSFT

2 Answers

1
votes

Wanted to comment but don't have enough points. There's a few different reasons for authorization. When creating the bot registration there's an option to 'only allow accounts from this organization', this needs extra configuration so if you picked this then change it to any account.

Also, you can often get more detailed error messages from the server's side (which aren't revealed to the user who gets hit with 403). Go to the bot's App service in Azure portal and go to "App Service Logs" near the bottom of the left menu. Enable "Application Logging (Filesystem)" (I also like to Level to Verbose and enable "Detailed Error messages" as well). Now go to "Log stream" in the left menu. It should now be connected. Try to access bot again and see what messages come in the log stream.

If you enable Application Insights that can also help

0
votes

The main reasons for bots not getting called are either the address is incorrect (either the root location of some part of the address, depending on how you're hosting it. As an example, an Azure Function will automatically add an extra "/api" early in the path) or, as you're finding, something to with the AppId and AppPassword not getting picked up correctly.

If it's the latter, which is what it sounds like here, then in principle it's a simple fix - you just need to make sure your AppId and AppPassword are (a) correct from the portal and (b) getting used correctly in your bot configuration.

The problem comes in with (b) above - there are a whole bunch of different samples on the internet, from Microsoft and others, both for C# and Node, and they use a ton of different ways to instantiate the bot and set it's AppId and AppPassword. Some of the examples, for instance, use an implementation of an "ConfigurationCredentialProvider" internally, which will try pull the appid/apppassword from your configuration file, but of course expect them to be in a specifically-named set of values (see here for more).

So, can you check in however you've implemented your bot, to see where/how the credentials are getting set exactly?