You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is the simple HTML code where user enter their name first time and after that i want that botpress can use that.But its not working ?
<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({
userData: {
name: userName,
},
"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": "<add your own id>",
"webhookId": "<add your own webhook ID>",
"lazySocket": true,
"themeName": "prism",
"frontendVersion": "v1",
"useSessionStorage": true,
"showPoweredBy": true,
"theme": "prism",
"themeColor": "#2563eb"
});
}
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>
The text was updated successfully, but these errors were encountered:
Below is the simple HTML code where user enter their name first time and after that i want that botpress can use that.But its not working ?
<title>My Basic HTML Page</title>The text was updated successfully, but these errors were encountered: