Skip to main content
Question

using output from Code (Python) in next step


I'm catching a raw webhook and process this input in a Python Code-step. However,  I didn't succeed in using the returned value from the Code-step in a next step.

The provided Python examples don't show screenshots of Zapier, so I still don't know what to do in order to get the data in the next step.

In the code-step I return the right json encoded value

Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Troy Tessalone
Forum|alt.badge.img+14

Hi @MarcKraak 

Good question.

Check out this related help article with Python examples: https://help.zapier.com/hc/en-us/articles/8496197130893-Python-code-examples-in-Zaps

 

Introductory Examples

Each of the four examples below expects a name in the "Input Data" field.

A easy example might be something as trivial as:

return {'id': 1234, 'hello': 'world!', 'name': input_data['name']}

You can also bind the result to output—the code above has exactly the same behavior as the code below:

output = {'id': 1234, 'hello': 'world!', 'name': input_data['name']}

An example with an early empty return might be something as trivial as:

if input_data['name'] == 'Larry':
    return [] # we don't work for Larry!

return {'id': 1234, 'hello': 'world!', 'name': input_data['name']}

 


Todd Harper
Forum|alt.badge.img+8
  • Zapier Expert
  • 197 replies
  • March 1, 2023

Hi @MarcKraak!
 

Can you post a screenshot of your Python script or copy/paste it into a code window here? That will help us diagnose what’s going on. My guess is it has to do with your return/output statement syntax.


  • Author
  • Beginner
  • 5 replies
  • March 1, 2023

Hi, my Python script contains following 

 

rawdata='<json string........>'
jsonEncodedData = json.loads(rawdata)
# some modifications are done to this json object
output = jsonEncodedData
return output