rival-black
rival-black2y ago

how do i send Custom Variables

So in the Voiceflow document, it says that is possible to send custom variables through the embed, if i understood it correctly. here is the link: https://developer.voiceflow.com/docs/customization-configuration#customization--configuration But I'm not sure how I would create the build in Voiceflow. I know that I have to use javascript function. But I'm unsure how it's possible for it to read it. can someone provide me with a example or something like that with the javascript. It return empty, in the first image. in the second image is how i have create the javascript...
No description
No description
2 Replies
Tico | Voiceflow Assistant
To send custom variables through the embed in Voiceflow, you can utilize the chat.load() function within your JavaScript code. This function allows you to load a Voiceflow agent by setting the project ID, runtime URL, and version ID. Additionally, you can customize the Web Chat experience for your users by adding settings such as a userID which will be set as the built-in {userid} variable in your Voiceflow agent. This is useful for tracking users and persisting or continuing sessions. Here's a basic example of how to implement this:
window.voiceflow.chat.load({
verify: {
projectID: "<Your_Project_ID>",
},
url: "https://general-runtime.voiceflow.com",
versionID: "production",
userID: "Your_User_ID_String" // Optional for tracking users
});
window.voiceflow.chat.load({
verify: {
projectID: "<Your_Project_ID>",
},
url: "https://general-runtime.voiceflow.com",
versionID: "production",
userID: "Your_User_ID_String" // Optional for tracking users
});
To pass values to the lastevent system variable upon load, you can use the JavaScript Code step in Voiceflow to validate the payload values and set existing variables with default values at the start of each new conversation. Remember, the userID is optional and can be used to track users across sessions. This customization allows for a more personalized interaction with your Voiceflow agent. For more detailed information and examples, you can refer to the following resources: - Customization & Configuration - Using the Function Step
rival-black
rival-blackOP2y ago
is it possible to send a variable from voiceflow to where i'm hosting my website, so it can trigger an event on my website?

Did you find this page helpful?