question

NorbertAnnus-0631 avatar image
0 Votes"
NorbertAnnus-0631 asked LawHuiSheng-5854 commented

Why am I getting a 502 while trying to test a bot in Test in Web Chat?

I'm trying to create a bot to get started with policy based recording for Teams but no matter what guide I follow I'm always getting back a 502 (for the activities endpoint) when trying to test my bot in Test in Web Chat.

These are the guides I've tried so far:
https://docs.microsoft.com/en-us/azure/bot-service/bot-service-quickstart-registration?view=azure-bot-service-4.0
https://docs.microsoft.com/en-us/azure/bot-service/abs-quickstart?view=azure-bot-service-4.0
https://docs.microsoft.com/en-us/azure/bot-service/javascript/bot-builder-javascript-quickstart?view=azure-bot-service-4.0

This is the endpoint which is causing me headaches:
https://webchat.botframework.com/v3/directline/conversations/{conversationId}/activities

And this is the error I end up with:

 {
   "error": {
     "code": "BotError",
     "message": "Failed to send activity: bot returned an error"
   },
   "httpStatusCode": 500
 }


Can you please advise?

azure-bot-service
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, thanks for reaching out. Can you confirm that you are using the correct token? Only the token which was received against start conversation can be used to send an activity. Here's information on generating a token. Hope this helps.


0 Votes 0 ·

Hi! So the 'Test in Web Chat' is a built-in feature of the Azure Portal therefore I don't have much influence on the flow of things. Nevertheless I've just verified and the Bearer token which is used to send an activity against the conversation id that had been created earlier is the one that I've received as part of creating the conversation itself, which matches up with the requirements although it still returns a 502. Any other ideas?

0 Votes 0 ·

Hi, Feel free to let us know if the troubleshooting steps below helped or if you found a workaround. Thanks.

0 Votes 0 ·

1 Answer

GiftA-MSFT avatar image
0 Votes"
GiftA-MSFT answered LawHuiSheng-5854 commented

Here are some resources that may be useful:

  • The Messaging endpoint specified on the Settings page for your bot in the Bot Framework Portal is incorrect. Make sure you have included the proper path at the end of the URL (e.g., /api/messages).

  • The Messaging endpoint specified on the Settings page for your bot in the Bot Framework Portal does not begin with https or is not trusted by the Bot Framework. Your bot must have a valid, chain-trusted certificate.

  • The bot is configured with missing or incorrect values for app ID or password. Verify that the bot configuration settings specify valid values for app ID and password.

You can also try creating a new web app bot and test the bot for a response.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

I have the same issue.

  1. Created a bot using Echo Bot Template using Visual Studio.

  2. Published to an App Service: I can see the bot page at https://#######.azurewebsites.net/

  3. Added Messaging endpoint https://#######.azurewebsites.net/api/messages

  4. Enabled Web Chat channel.

  5. Replace App ID and Secret in bot configuration file.

  6. Took the iframe code and replace the Secret.

  7. Tried the iframe but not working.

Error:

 *{
   "error": {
     "code": "BotError",
     "message": "Failed to send activity: bot returned an error"
   },*
   "httpStatusCode": 500
 }


What else can I check?

Thanks.




1 Vote 1 ·