Skip to main content
Question

Python For Loop

  • May 28, 2022
  • 1 reply
  • 222 views

Hi,

 

I have a Zap that does the following:

 

  1. Trigger callback with data (email addresses) sent as an array
  2. Custom code (Python) to loop through the email addresses
  3. LinkedIn Matched Audiences (Action) to send each email address in the list to LinkedIn.

 

When I run the Zap it looks like only 1 email address is being sent from the loop to LinkedIn.

 

Here is my Python code:

 

data = input_data['data']
data_list = data.split (",")
for a in data_list:
return {'email':a}
return {'email':'test@test.com'}

 

Where am I going wrong?

 

Thanks

 

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • May 28, 2022

Hi @nick_edwards 

Good question.

If you already have an array of email addresses, then you don’t need a Code step.

Try using the Looping app: https://zapier.com/apps/looping/integrations#triggers-and-actions