- Address the user by name
- Have immediate access to their contact information
- Streamline their experience
You will need:
- A website with an embedded bot
- Familiarity with HTML and JavaScript
Update user data
Use thewindow.botpress.updateUser method to update user data after your website has initialized Webchat:
Initialize with user data
You may want to provide some user data while initializing Webchat on your website. This allows your bot to deliver a more personalized conversation experience from the start. To provide user data as soon as Webchat is ready, listen for Webchat’s initialization event and callwindow.botpress.updateUser as soon as it fires:
Access user data
You can also retrieve the user data your bot currently has access to:In Studio
Once you’ve provided Webchat with user data, you can use the Get User Data Card to access it in the Studio:
{{ event.userId }}. You can store the user data in any variable you’d like.
On your website
Use thewindow.botpress.getUser method to access the current user data programmatically:
