I'm learning to code and work with web developers that can help me write code. We need to write custom code that will be used in a workflow. The code would take the contact in the workflow's phone number and check the CRM to see if their number has been used by another contact.
Basically, we need the code to make an API call and search for the phone number. If the phone number exists on multiple contacts, it will set a boolean (numberIsDuplicate) to "true". If the number is only used by one contact set it will set the boolean to "false.
This would be used to accept a contact if their phone number is unique and reject them if the number has been used by another contact.
If you could recommend any starting code or existing tutorials that do something similar we could probably figure it out from there.
If it were me, I'd start by making a simple list to scope out the pieces you'll need.
An example list:
create your Private or Public App and give it the needed scopes
look into the endpoint or endpoints you will need to call. I'd start with the Search API for this project
if you're using JS, set up a quick Node app to test your function(s) locally
break your function into small parts – one to make the request, one to evaluate the response and set the numberIsDuplicate boolean
Another consideration, if these contacts are being created and then immediately enrolled into this workflow, you'll need to add a delay of 5–10 seconds to account for the Search API limitations. Otherwise, you may encounter a race condition and get an error.