best-salesclerk-45195
03/20/2024, 5:20 PMjs
import React, { useEffect } from 'react'
import { useAuthContext } from '../../context/AuthContext';
export const WebchatChatbot = () => {
const { user } = useAuthContext();
useEffect(() => {
if (user?.id) {
const script = document.createElement('script')
script.src = 'https://cdn.botpress.cloud/webchat/v1/inject.js'
script.async = true
document.body.appendChild(script)
script.onload = () => {
window.botpressWebChat.init({
"composerPlaceholder": "Chat with uptibot",
"botConversationDescription": "Start a conversation with the bot designed for uptitude.",
"botId": "",
"hostUrl": "https://cdn.botpress.cloud/webchat/v1",
"messagingUrl": "https://messaging.botpress.cloud",
"clientId": "",
"webhookId": "",
"lazySocket": true,
"themeName": "prism",
"frontendVersion": "v1",
"showPoweredBy": true,
"theme": "prism",
"themeColor": "#2563eb",
"userData": {
"user_id": user?.id,
}
});
}
}
}, [user])
return <div id="webchat" />
}
When I'm trying to access this data in the botpress cloud it returns an empty JSON, I think i followed the docs correctly, but something is missing, can someone help me?able-queen-43470
03/22/2024, 3:07 PMable-queen-43470
03/22/2024, 3:07 PMable-queen-43470
03/22/2024, 3:08 PMbest-salesclerk-45195
03/22/2024, 3:10 PMable-queen-43470
03/22/2024, 3:15 PMable-queen-43470
03/22/2024, 3:17 PMbotId
, clientId
and webhookId
are empty strings. Did you remove these ID's just to share the config with us or is it also empty when you use your bot ?best-salesclerk-45195
03/22/2024, 4:36 PMable-queen-43470
03/22/2024, 5:12 PMrich-battery-69172
03/22/2024, 5:16 PMsquare-energy-41150
03/22/2024, 5:16 PMrich-battery-69172
03/22/2024, 5:20 PMrich-battery-69172
03/22/2024, 5:22 PMbest-salesclerk-45195
03/22/2024, 6:45 PMbest-salesclerk-45195
03/22/2024, 6:46 PMbest-salesclerk-45195
03/22/2024, 6:47 PMpython
"botId": "8bde2552-ddb0-4513-bdd7-8f55765530fe",
best-salesclerk-45195
03/22/2024, 6:47 PMbest-salesclerk-45195
04/02/2024, 12:51 PMrich-battery-69172
04/02/2024, 1:20 PMbest-salesclerk-45195
04/02/2024, 2:06 PM