itchy-amethyst•16mo ago
using variables in react chat
how to use variables like name, email in react chat
1 Reply
To use variables like name and email in a React chat with Voiceflow, follow these steps:
1. Create Variables in Voiceflow:
- Navigate to the Variables sidebar in Voiceflow.
- Create variables for
username
and useremail
.
2. Set Variables in Voiceflow:
- Use the Set Step to assign values to these variables. For example, you can set username
to "Mary" and useremail
to "email@example.com".
3. Pass Variables to React Chat:
- When initializing the React chat, pass the variables as part of the payload. This can be done during the launch event.
Here is an example of how you might configure this in your React chat setup:
This setup ensures that the username
and useremail
variables are available and can be used within your Voiceflow assistant.
For more detailed information, you can refer to the Voiceflow Prototyping and Test Tool Documentation.