Unable to add chat-widget though index.html for a website

Unable to add chat-widget to index.html,widget is not visible after adding old or new script from

GitHub - botfront/rasa-webchat: A feature-rich chat widget for Rasa and Botfront.

i followed every relatable blog and previous issues on it. and when i copy paste the old script i.e

>  WebChat.default.init({
>     selector: "#webchat",
>     initPayload: "/greet",
>     customData: {"language": "en"}, // arbitrary custom data. Stay minimal as this will be added to the socket
>     socketUrl: "http://localhost:5055",
>     socketPath: "/socket.io/",
>     title: "EESL Support Assistant",
>     subtitle: "A complaint Console",
>     params: {"storage": "session"} // can be set to "local" or "session". details in storage section.
>     })

no widget is visible to the webpage. but when i added the new script which is available now on the above link i.e

 <script>!(function () {
  let e = document.createElement("script"),
    t = document.head || document.getElementsByTagName("head")[0];
  (e.src =
    "https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js"),
    (e.async = !0),
    (e.onload = () => {
      window.WebChat.default(
        {
          customData: { language: "en" },
          socketUrl: "https://bf-botfront.development.agents.botfront.cloud",
          // add other props here
        },
        null
      );
    }),
    t.insertBefore(e, t.firstChild);
})();
</script>

i got the widget on the index.html page and the model which comes along the widget is not my created it the default from the git repositary and also in this script when i’am adding my socket url. then there is an error at my rasa server.and no widget is visible at that time. i’am very new to this and using it to create a bot and to test it to a webpage i’m needing to integrate the widget.

i’ve already added the spcketio code to the cridentials.yml file and i used “rasa run -m models --enable-api --cors “*” --debug” command to run my rasa model and action server in another terminal with “rasa run actions --actions actions -vv” command.

it would be great if someone can help me in this. Thanks.

make sure you are using rasa 2.3 or below. other latest versions are not yet supported with this.

  • Rasa Version : 2.1.2
  • Rasa SDK Version : 2.3.1
  • Rasa X Version : None
  • Python Version : 3.7.5 clear all the cache and other things except passwords and history from your browser.

this worked for me :relaxed: