0
votes

I am trying to get a bot working in Microsoft Teams, hosted in azure, written in Node / Javascript.

To eliminate the issue being my code I am currently just trying to host one of the microsoft sample bots... https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/07.using-adaptive-cards

I'm finding the bot is working on localhost. It also working through NGROK and if I use the bot emulator and load the bot from azure at endpoint... https://cnbeaconbot.azurewebsites.net/api/messages This works too.

What isn't working is when I add the bot to my MS Teams app through the app studio application. Initially to get a demo working I haven't added secrets / passwords or authentication to my bot at this point. I'm looking to set up the simplest possible demo that I can build from.

I havent made any customisations to the MS sample, the code for can be found here... https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/07.using-adaptive-cards

In the bot service console in Azure, within the Test in Web chat channel I have an error "There was an error sending this message to your bot: HTTP status code Unauthorized"

But no errors have been logged within my Teams channel. I've checked the endpoints, they all match what I'm using in Bot emulator and I'm not sure what else to check.

In teams when I summon my bot with the @mention it doesn't respond as expected. There is no response from the bot at all.

I've using Teams web app in chrome along with fiddler hoping it would return a HTTP error, 404, 500 but there's nothing outputting there.

If anyone has deployed an azure app in node and using Teams App Studio I'd appreciate any insights.

Thanks in advance :) Andy

Got some more info, here's what the test in Web Chat is returning

Utj-TW1baCBV.js:9 [Microsoft_Azure_BotService]  1:01:13 PM 
MsPortalFx.Base.Diagnostics.ErrorReporter 1         
MsPortalFx.Base.Diagnostics.ErrorReporter: _errorData: undefined
_sourceErrorLevel: undefined
baseTypes: ["MsPortalFx.Errors.AjaxError","MsPortalFx.Errors.Error"]
code: undefined
data {"uri":"https://botservice.hosting.portal.azure.net/botservice/api/ClientTrace","type":"POST","pathAndQuery":"","requestId":"5738e762-2aa1-4640-b086-495936e70007","failureCause":"","sessionId":"40a3f6eb3b284c5fa66db8b8fe21a06a","status":404,"statusText":"error","duration":47.82500024884939}
errorLevel: 2
errorThrown: 
extension: Microsoft_Azure_BotService
handled: undefined
innerErrors: []
jqXHR: {"readyState":4,"responseText":"Not 
Found","status":404,"statusText":"error"}
message: ajaxExtended call failed
name: Error
source: undefined
stack: null
textStatus: error
timestamp: 80466.26000013202
type: MsPortalFx.Errors.AjaxError https://webchat.botframework.com/v3/directline/conversations/8hFWddDOnZm5fuIih3b4Sz-a/activities 502

and also...

b2bn3_EAuRkB.js:19 POST https://botservice.hosting.portal.azure.net/botservice/api/ClientTrace 404

Seem to mention both a 502 and 404 there so'll I'll post more info if I find anything out.

1
I am now considering if the lack of authentication is the problem. I initially put no authentication on the web app in order to get it working with the plan to add it before developing the bot further. Looks like the errors may be due to the lack of encryption.andy moore

1 Answers

0
votes

I decided to start from scratch but this time I created my bot from the Web App Bot. creator in azure. Previously I'd been building the bot as a Azure hosted web app and registering it. The bot template I used was Echo Bot.

Initially nothing was working until I downloaded the code. I didn't change anything I just wanted to have look at it. I decided to redeploy the same code using the VS Code Azure extension.

This now appears to be working in Emulator, localhost and a Teams app created in app studio.

Something I hadn't done in my effort described above was use a appId and PW/Secret to secure the app.