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:
- I’m doing a “lookup spreadsheet rows” on google sheets
- Then passing the result json on to a webhook (using “data passthrough” on the “webhooks by zapier” custom request
- 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.
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.