quickest-silver
quickest-silver2y ago

Pass data from web page to voiceflow assistant custom variables

Is there a way to pass data from proactive messages (or just from website javascript) to voiceflow custom variables? Use-case: I have dynamic proactie messages that I fetch from API, and I need this messages to store somewhere and once a user opens a chat I want to use this variables as a context and also to use this for analytics to see what messages lead to best results
1 Reply
Tico | Voiceflow Assistant
Yes, you can pass data from your webpage or proactive messages to Voiceflow custom variables. This can be achieved by utilizing the window.voiceflow.chat.load() function in your Web Chat agent's integration code. Here's how you can do it: - Use the userID parameter to track users and continue sessions. This sets the userID as the built-in {userid} variable in your Voiceflow agent. - Pass values to the lastevent system variable upon load. You can use the JavaScript Code step to validate these values and set existing variables with default values at the start of each new conversation. - Remember, Code Steps cannot be used to create new variables. Variables you wish to use after the Code Step must already exist in your agent. - You can also pass user metadata for transcripts, such as a user's name and image, though this will not populate any variables or entities in your agent. For analytics and tracking which messages lead to the best results, you can review saved transcripts in the Transcripts tab of the assistant-level canvas. This allows you to iterate on your conversational logic and understand user interactions better. For more detailed guidance, you can visit the customization and configuration documentation here.

Did you find this page helpful?