How to embed 3rd party chatbot with Employee Center

Otgonsuren
Tera Contributor

Hello,

I'm configuring to embed 3rd party chatbot with Employee Center. But I've no success. I've reviewed and made some configuration on our dev instance through "feasibility of embedding thirty-party chatbot into... - ServiceNow Community"

But when I refresh the Employee Center, in Network tab of F12 console it gives error which "404 Not Found". How can I solve this issue? Is it possible to embed 3rd party chatbot with Employee Center?

1. Created UI Script that name is "EmbedKhagantoSN"

// UI Script: EmbedKhagantoSN (API Name: sn_dt.EmbedKhagantoSN)

(function(window) {
  // Fetch dynamic values from data attributes or configuration object
  var widgetContainer = document.getElementById('widget-container-id');
  var token = widgetContainer ? widgetContainer.getAttribute('data-token') : '';
  var baseUrl = widgetContainer ? widgetContainer.getAttribute('data-baseurl') : '';

  window.difyChatbotConfig = {
    token: token,
    baseUrl: baseUrl
  };

  // Create a script element to load the external script
  var script = document.createElement('script');
  script.src=baseUrl + '/embed.min.js';
  script.id = token;
  script.defer = true;

  // Append the script to the document head
  document.head.appendChild(script);
})(window);
2. Created widget that name is "EmbeddingKhagantoSN"
in body html template of widget

<div id="widget-container-id" data-token="{{::c.data.token}}" data-baseurl="{{::c.data.baseUrl}}">
<!-- Your widget's HTML content -->
</div>

<!-- Reference the UI Script using sys_ua directive -->
<script type="text/javascript" src="/scripts/sn_dt.EmbedKhagantoSN.jsdbx"></script>

in server script of widget

(function() {
  // Server-side code to set dynamic values
  data.token = 'dpkJvPLk4SB1JMtS';  // You can fetch or generate this dynamically
  data.baseUrl = 'http://192.168.121.181';  // This can also be fetched or set dynamically
})();
3. And I added widget into Employee Center through Designer.
4. When refresh the Employee Center, it gives an error. Attached screen shot of error that name is 404 err.jpg
 
How can I solve this issue and where did I wrong configuration or is configuration less? Help me experts 🙂
 
1 REPLY 1

bhavana_menonp4
Tera Contributor

Hi, were you able to get a solution for this.I have a similar requirement.