https://discord.gg/botpress logo
**🆘 HELP: Website → Botpress Communication Not Wo...
# 🤝help
s
Problem: My website can't send user data to my Botpress chatbot iframe. The website is sending postMessage data, but Botpress never receives it. Setup: - Botpress Cloud (shareable iframe) - Website with Clerk authentication - Need to pass:
clerkUserId
,
email
,
userPlan
from website to Botpress What I've Tried:
Copy code
javascript
// Website sends (confirmed in console):
iframe.contentWindow.postMessage({
  type: "webchat:user-data",
  payload: { clerkUserId: "user_123", email: "user@example.com", userPlan: "pro" }
}, "*");

// Also tried: "user-data", "config", "webchat:set-user-tags", "event"
Botpress Flow: - Set_User_Data_from_Website node tries to extract from
event.payload
,
event.data
,
event.tags
- Always empty:
user.email = ''
,
user.clerkUserId = ''
Questions: 1. What's the correct postMessage format for Botpress Cloud shareable iframe? 2. How should I extract the data in my Botpress flow? Which event properties? 3. Is there a better way to pass authenticated user data from website to Botpress? 4. Any working examples of website → Botpress data transfer? Goal: Pass user authentication data from my website to Botpress so the bot knows the user's subscription plan. Any help appreciated! Been stuck on this for days.
w
i think you then need to send these data (that you received in your iframe) to the actual webchat using sendEvent
s
OOH! I'll check this out and see if I can get it working. I really appreciate you following up with me and I'll let you know if it works after this step. THANK YOU!
b
We you able to solve this? I am stuck at the same step. Not able to pass logged in user data into botpress.
s
Not as yet. I'm wondering if I need to open a new fresh Bot and test JUST this step because maybe there is some other function getting in the way of Botpress receiving user data. The part that really sucks is that this is the last capability I need to get working in order to launch.
b
I was able to figure out my bot. The thing I was missing is that we need to define the variable in the bottom left window in Botpress. Once I defined these variable, Botpress was able to read them properly in the execute code window. then pass it through rest of the flow.
s
Awesome! Glad you got it working. Are you pushing data from your website backend to your bot?
b
Not from backend, just from browser window. My frontend (softr.io) exposes logged in customer details in every session. So i am just using send event functionality. I am not a coder, but GPT helped me figure this out.
s
Ok wow! So there's something I am completely missing then. I'm hopping on this office hours call today hoping I leave with the insight I need. But I'd love to follow up with you about this because all I need is the same exact thing - the browser console has the correct customer details I just need botpress to see it and update. I used the docs we were sent on this thread but then botpress ins't seeing any events. Weird!
b
You are probably missing —- setting variavle in the bottom left block in botpress. That’s what i was missing for 4 days. Its so stupid. The docs dont cover this. Look at bottom left block called variables. You need to define them.
s
That's probably it! And the type of varables. Maybe what's missing from Botpress are more error messages that tell you the variable is missing? Either way I'm gong to start hacking away at this again. So are you also working on a paid tier system? I'm using Clerk and Stripe but I'm noticing in the office hours just now that she collected emails inside the bot while I do emails outside the bot using Clerk for oAuth. Maybe that's another reason I'm running into an issue.
i have already asked them to improve the docs. The 2 docs everyone shares don't even mention this....i actually reached out an ambassodor and he helped me. after a good 30 mins we found this out that a stuid step is missing somewhere....
I am building a simple AI assistant for career and education guidance. So I just need to pass the email and username for personalization and then mostly using autonomous bot or my own OPEN AI API.
the call was such a waste fo 30 mins. could easily have been a youtube video...that would be much better.
s
Yes you're right - small but crucial gaps would be great as a video. Thanks for sharing. Yeah I think my use case has a complicated step but probably easily solvable. Maybe I need to sign up different tier plan to get some direct help on this.
b
You need teams plan at $499 to get direct help. I tried looking i to it. Even on a paid plan like teams…there is no ticketing or emailing help
s
Yeah - I've been nervous about signing up and taking the risk and holding out just in case there was a way to fix this but maybe not.
3 Views