https://discord.gg/botpress logo
How to pass Firebase UID from Flutter WebView to B...
# 🤝help
l
Hi Botpress team, I'm integrating Botpress Standalone webchat into a Flutter mobile app and need to pass the user's Firebase UID to identify them in my bot workflow. My Setup: Flutter app with Firebase Auth (users sign in with Google) Botpress Standalone webchat loaded in a WebView I'm passing the Firebase UID via URL parameter: &userId=ABC123XYZ456DEF789 Full URL example: https://cdn.botpress.cloud/webchat/v3.5/shareable.html?configUrl=https://files.bpcontent.cloud/.../config.json&userId=ABC123XYZ456DEF789 What I Need: I need to access this Firebase UID in my bot workflow so I can: Send it to Make.com via the "Send Data" card in my JSON payload as "UserUid": "{{some_variable}}" Use it to filter Airtable records by UID (instead of email) What I've Tried: {{user.id}} - returns undefined or masked (**) {{event.userId}} - returns undefined {{user.tags.userId}} - returns undefined {{user.firebaseUid}} - returns undefined Added "Get User Data" card at the start of my Autonomous Node workflow Passed &user={"firebaseUid":"ABC123XYZ456DEF789"} in URL - didn't work The Question: What is the correct way to pass a custom identifier (Firebase UID) from the URL to Botpress Standalone webchat and access it as a variable in my bot workflow (specifically in the "Send Data" card)? Is there a specific syntax or workflow card setup I'm missing? Thank you!
w
event.payload.userId maybe
you have to check your events in your dashboard to see if the event payload receives the userId from the url parameter
alternatively you can start the conversation using custom user data
Copy code
javascript
window.botpress.on('webchat:initialized', () => {
  window.botpress.updateUser({
    data: {
      fbUserId: id_goes_here,
    },
  })
});
l
didnt work
w
.
l
is there any help here other than a bot??
w
i'm not a bot bro lol
i just told you what to do
you need to inspect your event payload so you know if the url parameter is there or not
you can't magically divine it from an iframe in a website
either that or just start the chat with your id inside it
l
???
l
oh sorry haha the bot icon beside ur name, my bad! Ok ya the url parameter wasnt in the events. How would i start the chat with my id inside it?
l
hello
Maybe i'll have that emoji changed haha!
w
when the conversation is started through the webchat, window.botpress.on runs
after the botpress is initialized, you can call window.botpress.updateUser to pass whatever variables you want, which in your case is the firebase userId
Copy code
javascript
window.botpress.on('webchat:initialized', () => {
  window.botpress.updateUser({
    data: {
      fbUserId: id_goes_here,
    },
  })
});
this snippet does both things
then you can retrieve the "fbUserId" with a "Get User Data" block i think
l
w
i believe it'll work normally
8 Views