Skip to main content

While this question has been asked a multitude of times, there is no actual answer to be found in all those threads.

 

Here’s my situation:

  1. I’m doing a “lookup spreadsheet rows” on google sheets
  2. Then passing the result json on to a webhook (using “data passthrough” on the “webhooks by zapier” custom request
  3. Now I would like to receive the raw json that is returned by the webhook.

Unfortunately, I haven’t been able to find an acceptable way to access the raw result json from the “webhooks by zapier” custom request step. Only the parsed data is available.

 

Reading through the support forum, I’m seeing two answers popping up:
 

suggested approach 1: Using another zap with a webhook trigger to send the raw data to. This hack is insane, why would I want to use another zap, another webhook dependency, to be able to access data that should be accessible by default? In a year, no one will be able to manage this weird zap construction anymore, this is just not an acceptable approach. 

https://community.zapier.com/code%2Dwebhooks%2D52/advanced%2Dapproach%2Dhow%2Dto%2Dget%2Dthe%2Draw%2Djson%2Dfrom%2Dany%2Dzap%2Dstep%2D28496

 

suggested approach 2:

use a code step and “let AI do your coding for you”

I’m not sure how this is an acceptable answer either, because the ai will suggest a different solution for everyone. please just share example code instead of suggesting someone to write their own prompt and hope that working code will result.

 

current issue:

So I’m trying to use the custom (python) code step for this, but how to access the “data passthrough” that the “webhooks by zapier” custom request step offers?
 

I asked ai, but the resulting code “data passthrough” remains empty.

This was the AI suggested code:

import requests



# Construct the full URL for the POST request

webhook_url = "MY_URL"



# Pass through data from the previous step

previous_data = input_data.get('previous_data', {})



# Execute the POST request with the previous data

response = requests.post(webhook_url, json=previous_data)



# Raise an exception if the request was not successful

response.raise_for_status()



# Extract the raw JSON body from the response

output = response.json()



While the post request is excecuted fine, the previous_data remains empty in the post request, where I would expect the data passthrough from the previous zap step.

Hi ​@hanneke 

Make sure to use this Zap trigger: Webhook - Catch RAW Hook

Otherwise, you have to use a custom API request if the app supports it or use a custom Code step to handle the API request.

I’ve asked for a RAW JSON output variable from a Zap step for years.

 


Hi ​@hanneke 

Make sure to use this Zap trigger: Webhook - Catch RAW Hook

Otherwise, you have to use a custom API request if the app supports it or use a custom Code step to handle the API request.

I’ve asked for a RAW JSON output variable from a Zap step for years.

 

Hi Troy,

Thanks for taking the time to reply to my question!

Just to be clear, when you’re suggesting “make sure to use this Zap trigger Catch Raw Hook”, are you confirming that what I’m asking isn’t possible, to get the raw json output from a Zap step (as opposed to trigger)?

Thanks again,
Hanneke


@hanneke 

It is not natively possible that I’m aware of to get the raw JSON from a previous Zap step.

It is possible using an API endpoint to ECHO back the previous Zap step as a raw JSON string.


I’m confused I had responded to this showing how to create a JSON payload from the Google Sheet data but the post has been removed. Did I do something wrong by showing how it can be done?


@hanneke 

If you use a Code step to make the API request, then you can handle the data request and response however you’d like.


​​@hanneke 

Just ensure your JSON is returned as a string from the code block or it will get formatted into line items. 


Reply