Bot Not working after embedding it into our website using webchat iframe embed code

Abdhaheer Kabeer 20 Reputation points
2024-11-26T09:06:03.11+00:00

I developed a bot using Microsoft bot framework and tested it locally in the emulator. After that, I deplyed my code in the IIS server and configured Azure bot service with URL endpoint. Then utlized provided web chat iframe code for embedding into our website. But Bot is not working.

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
{count} votes

1 answer

Sort by: Most helpful
  1. navba-MSFT 27,605 Reputation points Microsoft Employee Moderator
    2024-11-27T12:55:27.1333333+00:00

    @Abdhaheer Kabeer Thanks for getting back and sharing the updates on the suggested action plans.

    Observation 1:
    If the test in webchat ,itself is failing with InternalServer error there seems to be an application level exception which is triggered. To troubleshoot exceptions in the Azure Bot Service follow this article. You can enable the diagnostic logging for your Azure App service as explained in this article and check for any errors.

    Observation 2:

    You can try to isolate this issue by disabling the Enhanced token authentication for now and try directly accessing it using the directline secret (Though its not recommended). Atleast this will help you to isolate and track the issue. Update the secret in the below and test your endpoint and check in console and Network tab for any errors.

    <!DOCTYPE html>
    <html>
      <head>
        <script
          crossorigin="anonymous"
          src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js">
        </script>
        <style>
          html,
          body {
             height: 100%;
          }
          body {
            margin: 0;
          }
          #webchat {
            height: 100%;
            width: 100%;
          }
        </style>
      </head>
      <body>
        <div id="webchat" role="main"></div>
        <script>
          window.WebChat.renderWebChat(
            {
              directLine: window.WebChat.createDirectLine({
                token: 'JuU8ygZh_h0XXXXXXXXXXXXXXXXXXXXXcxvkNQr6xbmVs'
              }),
              userID: 'YOUR_USER_ID',
              username: 'Web Chat User',
              locale: 'en-US'
            },
            document.getElementById('webchat')
          );
        </script>
      </body>
    </html>
    
    

    Awaiting your reply.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.