Best answer

Help with API calls in JavaScript Action

  • 30 August 2021
  • 3 replies

Userlevel 2

The Problem:

After making a phone call with a VOIP Phone (RingCentral), I like to find the record with that specific phone number in my ATS (Zoho Recruit) or CRM (HubSpot), and add that record (First Name, Last Name, Phone Number(s), Email Address(es)) into a Contact directory in MS Exchange, so it is available for emails and incoming phone calls and will identify the caller when they call back.


The difficulty I have to solve is such:


The phone number returned from VOIP has this format “+1xxxyyyzzzz” for US numbers, all in one string of numbers, with no spaces or separators. Returned by a Zapier trigger from RingCentral.

The phone numbers in the ATS and CRM are human entered and may have formats like “xxx-yyy-zzzz” or “(xxx) yyy-zzzz” or xxxyyyzzzz or any other possible form.

The search function offered in the Zapier connectors from ATS and CRM seems to execute a simple string match search. So unless the phone number is stored exactly as the search string, it won't find the right record. Those functions also don’t return partial matches.

The search functions in the APIs of ATS and CRM may allow for partial matches, but they also return multiple records that match a partial match.

So with and API call I could search for all the records with phone-number containing “zzzz” and then within the list of returned records (which should only be a few), normalize the returned phone numbers, and compare it with the entire search string. That would allow eliminating all the records that are not a match. Also, I will have to look in all the phone number fields, for mobile, business, and home fields. We can stop with the search when we have a first match where we can find the desired parameter values, i.e. First Name, Last Name, and at least one email address.

So the algorithm for this is quite elaborate, requires multiple API calls with returns of data sets of records, and additional work on each record return returned.


I think I could code that in JavaScript or Python, but not by configuration with existing Zapier functions.

  1. If anyone has done something like this that would be great to see.
  1. This procedure above requires coding in a Zapier JavaScript Action block, with multiple complex if/then and comparisons, and multiple API calls (HTTP requests) to multiple systems, that may return sets of records that need to further be processed. We should not want to store the credentials (API codes and secrets) for these calls in the code itself. Connections to the ATS and the CRM are already known to Zapier, for I have configured multiple Zaps using those. How can one retrieve the credentials from connections that are already configured and available within the Zapier account and use them for requests to the API of the ATS and CRM within the Java Action?

Preferably using JavaScript or Python for this solution.





Best answer by Troy Tessalone 30 August 2021, 23:59

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.

3 replies

Userlevel 7
Badge +14

Hi @thm22 

You may want to consider hiring a Zapier Expert to help with your project’s logic once defined:

Userlevel 7
Badge +14


You can add credentials to Storage and use that app in Zap steps:

NOTE: You are unable to get the credentials for authenticated apps in a Zapier account.

Userlevel 2

Thank you Troy, I think that helps. Too bad that we can’t get the API keys from authenticated connections.

I will try storing the API keys in Storage in another Zap. I don’t think its the safest way to do this, but at least it will take the API keys out of the code.