rival-black
rival-black2mo ago

Set variables before a conversation - follow up

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/%7Buserid%7D/variables, which was successful, and retrieve the variables via the GET call to https://general-runtime.voiceflow.com/state/user/%7Buserid%7D, 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? It is important to mention that I did the same as suggested before, I used the versionID header for the development version in the API calls, but I still cannot access the variables inside voiceflow. I annexed more images for further information
No description
No description
9 Replies
Steve B. | IntelleSync.ai
Can you share a screenshot of your GET call?
rival-black
rival-blackOP2mo ago
No description
Steve B. | IntelleSync.ai
OK, apologies if this sounds silly but I gather you making the n8n calls at the beginning of your workflow before your agent welcomes the user?
rival-black
rival-blackOP2mo ago
Yes, exactly, the idea is for the agent have the infos prior to welcoming the user
Steve B. | IntelleSync.ai
Does the user_id your using in your set step exist already?
rival-black
rival-blackOP2mo ago
Hmm no, as there's been no conversation
Steve B. | IntelleSync.ai
OK, I'm just thinking in terms of a more efficient way for you to do this.
First set the user_id to an existing one then make the PATCH call, you'll then get the response for the patch call which you can then assign to variables from there without having to update variable states.
rival-black
rival-blackOP2mo ago
Wait, but the user_id doesn't exist yet, right? In my understanding as there's been no conversation, there is no user_id
Steve B. | IntelleSync.ai
Sorry meant for testing purposes testing purposes, because in production you can pass the user_id easily by just using the variable.

Did you find this page helpful?