I can save data.vid to a variable, and data.properties.owner_zoom_meeting_id.value to a variable. However, I can't save data.canonical-vid, or data.['canonical-vid']. The value doesn't get written. Is there a way to format the data section of the Save in variables to handle the hyphenated name?
Can someone please give an example of how to do this with the result of an http request?
"If you really need to save a complex content into a variable, for example an object, you can use the JSON.stringify function to convert it into a text. And whenever you are using the variable, you can dynamically parse it back into an object using JSON.parse in an inline format:"
For example, I'm calling a GET from an API, which returns a JSON block of data. I would like to store all of it in a variable, so I can work with it - probably through a script block - and pull out the data I want. I'm not sure how to store the data in the variable correctly. When I try to save some portion of the data to a variable, and then return the variable, it comes back as undefined.
I am using a Set variable block with value: Custom. I have this javascript in it (Execute on client? = true):
function getCookie(name) { const value = ; ${document.cookie}; const parts = value.split(; ${name}=); if (parts.length === 2) return parts.pop().split(';').shift(); } const myCookieValue = getCookie("hubspotutk"); return myCookieValue
The variable gets set, I can retrieve the value and print it as a text bubble in the chat.
However, for some reason when I try to return the variable using a Zapier block, the variable isn't included in the return. The variable just isn't there.
Any variables I set through an Input Text block using "Save the answer in a variable" DO show up in Zapier. But these that I'm setting through the Set variable block with JS are not.