Giter Club home page Giter Club logo

Comments (10)

jgaltio avatar jgaltio commented on May 23, 2024 1

This is how I do it:


<script src="https://cdn.botpress.cloud/webchat/v1/inject.js"></script>
<script src="https://js.zohostatic.com/creator/widgets/version/1.0/widgetsdk-min.js"></script>

<script>
    ZOHO.CREATOR.init().then(function() {
        var queryParams = ZOHO.CREATOR.UTIL.getQueryParams();

  window.botpressWebChat.init({
      "composerPlaceholder": "xxx",
      "botConversationDescription": "xxx",
      "botId": "xxx",
      "hostUrl": "https://cdn.botpress.cloud/webchat/v1",
      "messagingUrl": "https://messaging.botpress.cloud",
      "clientId": "xxx",
      "webhookId": "xxx",
      "lazySocket": true,
      "themeName": "prism",
      "botName": "xxx",
      "avatarUrl": "xxx",
      "termsConditions": "xxx",
      "privacyPolicy": "xxx",
      "emailAddress": JSON.stringify(queryParams.email),
      userData: {
        email: JSON.stringify(queryParams.email)
      },
      "website": "xxx",
      "stylesheet": "xxx",
      "frontendVersion": "v1",
      "useSessionStorage": true,
      "showBotInfoPage": true,
      "enableConversationDeletion": true,
      "theme": "prism",
      "themeColor": "#2563eb"
  });    });
</script>

from botpress.

jgaltio avatar jgaltio commented on May 23, 2024

I do the same type of thing with Zoho Creator instead of Wordpress. It works for me... where "works" is defined as "I see the custom userData values in the logs when I use console.log() on them".

You didn't mention what error you're facing or why you say it's not working.

from botpress.

pks891618 avatar pks891618 commented on May 23, 2024

Thanks for your response. Actually, for the very beginning its not passing the user name.

eg if i am customer who have already account on wordpress and if open website then botpress should need to call me hey Pankaj Welcome back

from botpress.

pks891618 avatar pks891618 commented on May 23, 2024

Is there is any thing that need to be done on the botpress end ? like any configuration that need to be done on the botpress

from botpress.

pks891618 avatar pks891618 commented on May 23, 2024

image

<script src="https://cdn.botpress.cloud/webchat/v1/inject.js"></script> <script> window.botpressWebChat.init({ "composerPlaceholder": "Chat with bot", "botConversationDescription": "This chatbot was built surprisingly fast with Botpress", "botId": "", "hostUrl": "https://cdn.botpress.cloud/webchat/v1", "messagingUrl": "https://messaging.botpress.cloud", "clientId": "", "webhookId": "", "lazySocket": true, userData: { email: JSON.stringify("[email protected]") }, "themeName": "prism", "frontendVersion": "v1", "useSessionStorage": true, "showPoweredBy": true, "theme": "prism", "themeColor": "#2563eb" }); </script>

from botpress.

jgaltio avatar jgaltio commented on May 23, 2024

That doesn't look related.

from botpress.

jgaltio avatar jgaltio commented on May 23, 2024

Is there is any thing that need to be done on the botpress end ? like any configuration that need to be done on the botpress

Just enable the webchat integration

from botpress.

pks891618 avatar pks891618 commented on May 23, 2024

Yes already done and i am passing username but chatbot not greetings with that name, when I am passing name like you mentioned above bot not doing any thing

from botpress.

franklevasseur avatar franklevasseur commented on May 23, 2024

Hey @pks891618, sorry for the late reply.

This is your code ?

<title>My Basic HTML Page</title>
<script src="https://cdn.botpress.cloud/webchat/v1/inject.js?i=213132123123"></script>
<script> function initializeChat(userName) {
    console.log("inside function:", userName)
    window.botpressWebChat.init({
      composerPlaceholder: "Chat with bot",
      botConversationDescription: "This chatbot was built surprisingly fast with Botpress",
      botId: "915398e7-3cb8-43fe-8873-8e7a30a0c16f",
      hostUrl: "https://cdn.botpress.cloud/webchat/v1",
      messagingUrl: "https://messaging.botpress.cloud",
      clientId: "",
      webhookId: "",
      lazySocket: true,
      themeName: "prism",
      frontendVersion: "v1",
      useSessionStorage: true,
      showPoweredBy: true,
      theme: "prism",
      themeColor: "#2563eb",
      userData: { name: userName, },
    });
  }

  function getUserNameAndInitializeChat() {
    let userName = localStorage.getItem('user_name');

    // Check if the username exists in localStorage
    if (!userName) {
      userName = prompt('Please enter your first name:');
      if (userName) {
        // Save the username to localStorage
        localStorage.setItem('user_name', userName);


        initializeChat(userName);
      }
    } else {

      const myTimeout = setTimeout(initializeChat(userName), 2000);

      console.log(userName);

      //initializeChat(userName);
    }
  }

  // Call the function to get the dynamic value for userName and initialize chat
  getUserNameAndInitializeChat();
</script>

If so, the userData feature was broken until Wednesday (march 20). @EFF made the fix and it should be working now.

Let us know if it works on your end.

from botpress.

franklevasseur avatar franklevasseur commented on May 23, 2024

@pks891618 I'll close this issue, feel free to reopen if needed.

from botpress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.