0

One of my multi-steps Zaps has a Zapier.Webhook-GET as a step 2. Step 3 is Zapier.RunScript-Javascript.

I can“t figure out a way to set up that intire JSON object resulted from step 2 as the input variable required for step 3. The list of options shows only children and nested fields, but I need to take the object from the root.

Humphreys
  • 1
  • 2

1 Answers1

0

I don't believe Zapier will allow that, specifically.

Here's an alternative that may work perfectly: Put the GET in the step 3 script and use fetch!

Here's an example:

//Put in your url with querystring 
var url = "https://somewhere.com/rest?para1=value1";

//Add the method and headers here
fetch(url, {method: "GET", headers: {"Content-Type":  "application/json"}})
.then(function (response) {
  console.log(response);
  return response.json();
}).then(function (data) {
  //This is the entire JSON. Put your code here
  // Remember to do a callback! Do not set to "output"
  console.log(data);

  //This will return data as output
  callback(null, data);
});

//Code here will execute BEFORE code within the then functions because it's asynchronus

See this link for more on fetch: https://github.com/bitinn/node-fetch/tree/32b60634434a63865ea3f79edb33d17e40876c9f#usage

Hope this helps!

Casey Benko
  • 2,252
  • 1
  • 9
  • 3