adverse-sapphire•2mo ago
Set variables before a conversation
Hello, I am trying to set some variables I got from a webhook in n8n to voiceflow in order to contextualize the agent before the user sends the first message, so then the agent will use this information to follow the logical flow properly.
From the documentation (https://docs.voiceflow.com/reference/updatestatevariables-1), I managed to test it through postman with the PATCH call to https://general-runtime.voiceflow.com/state/user/{userid}/variables, which was successful, and retrieve the variables via the GET call to https://general-runtime.voiceflow.com/state/user/{userid}, which again retrieved a successful result.
However, when testing inside Voiceflow, I could not visualize these variables I set in any way, even after setting the userID to what I used, and checking the value. How am I supposed to move on with this?



1 Reply
What’s happening
The Runtime keeps a separate conversation state for every versionID of your project.
* • If you don’t include the
versionID
header in an API call the DM-API saves the state under production
by default.
* • The Test / Prototype tool inside Voiceflow always talks to the development
version.
So the variables you PATCHed from Postman were stored in production
, while the Test Tool is looking at development
– that’s why you don’t see them.
---
How to make the variables appear in the Test Tool
1. Add the header versionID: development
to every PATCH / GET / INTERACT call while you are building and testing.
2. Open the Test/Prototype tool, set the same User ID, and press Reset (clears any cached state). Your variables will now be present and can be referenced in your flow (e.g. {plan}
will resolve to gold
).
---
Production use
When you publish your assistant, switch your integration to versionID: production
(or simply omit the header) so both your backend calls and your live widget share the same state.
---
Tip: you can also seed the very first interact
call instead of doing a separate PATCH:
Either approach works – just keep the versionID consistent with the client that will run the conversation.
Docs: https://docs.voiceflow.com/reference/updatestatevariables