Not sure where to post about getting full API json response into variable

I do not think this is a you guys bug, but a me bug lol. Mods feel free to move it =)

I saw in a few tutorials about storing the full response JSON in a single variable. and like those, mine was going to be used to iterate through it via the code block. all single variables seem to store fine (response.0.fieldname) but set a variable to just “response” does not seem to work. I have tested it and watched the variables, I even paused in the flow I was in to make sure it was not getting overwritten somewhere else.

The only thing I can think is because it is in a flow, it is having an issue with the scope, but I am not even leaving the flow block when testing.

It is a custom api I am calling, and the data looks good. Here is what I pull in from the api as it shows in API block on VF. I have no issue at getting at the response.0.question or any other item. But when I try just response or just response.0.answers to get the nested arry. Any help would be appreciated. I can always hit the Rest and get an answer, but I would rather pull the answers at the same time as the question.
{
“response”: {
“question”: “Question To Ask”,
“items”: “6”,
“keyWord”: “KeyWord”,
“questionType”: “TypeCode”,
“answers”: [
{
“answer”: “1”
},
{
“answer”: “2”
},
{
“answer”: “3”
}
]
}

1 Like

@Voiceflow team. Checking back on this. My account says I get some sort of “Intercom” support. I am not 100% sure how to set that up and would appreciate the help.

Thanks!

After you are logged-in, there is a blue circle with a smiley face in the lower right hand corner of your screen. That is Intercom. Use it to directly contact Voiceflow help. They are an amazing group of people.

Thank you!!! Much appreciated =)

Just FYI I could not find the blue smiley face. =) Thank you for taking the time though.

That is really strange. I’ve tried it on three different browsers and it always shows up. I suggest trying a different browser to see if it makes a difference for you. You may also need to check your settings or antivirus to see if they are somehow blocking access to it.

Hi @razervocals! You can map response to a variable and use it in a Code block.

With something like this for example:

myquestion = response.question;
or
answer1 = response.answers[0].answer;

Thanks Nicolas, I will try that.

Did you get a solution. I have the same issue.

When I assign the compete response to a variable it fails.

At least in the test request, which is done and displayed but when switching to variables an error is generated

Correction: it seems to break in the test request but work in the skill code

Hi Woody, for me it was the quality of the json. There must have been hidden char or reserved chars. Once I scrubbed the data on the API side basicly. Node has a stringify function for escaping all needed chars which I used. Sorry for the late reply, I did not notice the little 1 up above =)