Best answer

Processing an array of contacts from a single CRM lead

  • 1 April 2020
  • 1 reply
  • 547 views

Userlevel 1

Hi.

I am building an integration workflow from a CRM (AmoCRM) into an email platform (UniSender) using Platform UI with Code Mode inserts. 

High-level issue: I am getting an array of contacts associated to the same lead. I need to process them all. My understanding is that it’s OK if I only see 1 contact in testing, in deployed Zaps each contact should generate its own task. However, my deployed Zap also only processes the first contact of the array.

How can I have every contact in the array processed? Please help.

Details. The workflow is as follows. 

  1. The lead status in CRM changes. CRM fires a webhook about this change with that lead’s id
  2. Zapier catches the webhook and asks CRM for id’s of contacts associated to the lead. There may be several, an array is returned.
  3. For each contact id Zapier gets contact data (firstname, lastname, email).
  4. This data is sent to UniSender (in theory, in practice I log the details to my Slack channel as a message for debugging).

Here’s the testing of Step 2 in Platrofm UI:

Test of the actual configuration of the Action

And here, for debugging purposes, the raw contacts list from the same lead:

Test of a temporarily modified Action, to show that an array is returned

I have a separate Search Action set up to look up contact details on Step 3, that works fine.

This is the Zap:
 

This Zap only processes one contact

When I change the status of a lead that has several contacts, I only get data about one of them:

Any help/tips will be much appreciated ))

 

icon

Best answer by vshabat 2 April 2020, 23:07

View original

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

Userlevel 1

Okay, so I found a workaround, assuming that I didn't miss anything and Zapier itself indeed only processes the first element of the array.

It's like this. For each contact in the array I fire a webhook (in the Action code) with that id in the payload. Then I make a separate Zap that catches the webhook and processes it.