How to Automate Mobile Number Validation in Zoho CRM: A Step-by-Step Guide

SMS marketing, when executed with precision, can significantly elevate a business’s engagement with its customers. A key element in this precision is the verification of phone numbers. In Zoho CRM, it’s essential to differentiate between mobile and landline numbers to ensure the effectiveness of your SMS campaigns. This guide introduces a specialized script designed to automate this process using Twilio’s Lookup API.

The Risks Of Sending SMS To Landlines

The risk of sending SMS messages to landline numbers is twofold. 

  1. Firstly, it leads to wasted resources, both in terms of time and cost. Each SMS sent to a non-mobile number is a missed opportunity and an unnecessary expenditure, as typical charges apply regardless of the message’s success. At the current rate charged by Twilio, which is $0.05 per API call, it’s crucial to manage expenses wisely.
  2. More critically, sending a high volume of messages to landline numbers can damage your phone number’s reputation. Mobile carriers are vigilant against what they perceive as spammy behavior. Excessive messages sent to landlines can trigger carrier filters, potentially leading to your number being blocked or restricted. This would severely impact your ability to conduct SMS marketing campaigns at all.

The script functions by taking a phone number from a record in Zoho CRM and checking its status through Twilio’s API. If the number is identified as a mobile number, the script sets a custom field called “Mobile Verified” to true. Additionally, if the “Mobile” field in the record is empty, it populates it with the verified number. Conversely, if the number is not a mobile number, the script activates a different set of actions. It sets a custom field named “Non Mobile” to true, “Mobile Verified” to false, moves the number to the “Home Phone” field, and removes it from the “Mobile” field. This process ensures that the designated mobile field in your CRM always contains a valid mobile number, which is crucial for marketing automation tools like Zoho Campaigns or Zoho Marketing Automation that require sending SMS to designated mobile numbers.


When the script contacts Twilio’s Lookup API, the response for a number verification query looks like this:

  "caller_name": null,
  "carrier": null,
  "add_ons": null,
  "country_code": "US",
  "national_format": "(555) 555-5555",
  "phone_number": "+15555555555",
  "url": ""


This response provides critical details, such as the country code and the phone number in both national and international formats, which are instrumental for your targeted SMS campaigns. By automating this process, your marketing team can focus more on crafting impactful messages, knowing that the numbers being targeted are accurate and appropriate for mobile messaging.


Twilio Account & API 

An important step in implementing this script is obtaining your Twilio API key. If you don’t already have a Twilio account, you’ll need to create one and fund it. We recommend adding $5 to $10 to your account, which should cover more than 100 lookups, given Twilio’s current rate of $0.05 per API call. This small investment can significantly enhance the efficiency of your SMS marketing campaigns by ensuring you’re only contacting valid mobile numbers.


Zoho Fields For Mobile Number Validation 


In the following sections, we will explore the implementation of this script in Zoho CRM and how it can be a game-changer for your SMS marketing strategy.

Before we begin implementing the script you should create some fields in zoho crm to store the results of the verification call. In this script the fields we have 

  • Non Mobile (Check Box) 
  • Mobile Verified (Check Box) 
  • Home Phone (Check Box) 

In various marketing campaigns we run we use “Mobile Verified = true” as a condition for several segments in Zoho Campaigns, Zoho Marketing Automation, as well as the transactional messages we send via CRM. 

*If you choose to call these fields something different you will need to make sure you update you replace these fields in the script

Setting Up The Custom Deluge Function 


After the fields are created in Zoho CRM you can navigate to settings>>Actions>>Functions and click the blue button under the graph “Configure Function”, in the popup select the options “Write Your Own” 

zoho deluge write your own function

Then you will need to name your script, and choose the corresponding module for this script to work with. In this guide we are working on Leads. If you would like to do this for multiple modules you will need to repeat this process for each module and change the records (make sure to add the custom fields to those also)

Now paste the following script in the editor:
					lead = zoho.crm.getRecordById("Leads",lid);
phone = lead.get("Phone");
//format number for api
phonemap = phone.remove("(").remove(")").remove("-").remove(" ").remove(".");
phonemaps = phonemap.toString() + "?Type=carrier";
authToken = "YOUR AUTH TOKEN";
// Create the headers and generate the basic authentication header
baseEncodedAuth = zoho.encryption.base64Encode(accountSID + ":" + authToken);
header = {"Authorization":"Basic " + baseEncodedAuth};
// Build the URL
baseURL = "";
pn = "+1" + phonemaps;
reqURL = baseURL + pn;
// Form the request
response = invokeurl
	url :reqURL
	type :GET

//maps lead validation to record
leadmap = Map();
pstatus = response.getJSON("responseText").getJSON("carrier").getJSON("type").toString();
if(pstatus == "mobile")
//updates the record with your validation results
updatelead = zoho.crm.updateRecord("Leads",lid,leadmap);


Next step is to map the attribute for lid to pull dynamically from the record the function is processing. To do this click the blue “Edit Arguments” link at the top of the screen and fill out the fields like this:

zoho deluge function editing arguments

**“lid” is used in line first and last line of the script above so if you changed to something else make sure you update it in this argument as well.


To test this function find a record in the corresponding module that has a phone number you would like to validate and on the record page copy the record id from the end of the url: 

Now check the record to see that the fields are updated as needed.
If the record isnt updating as it should please check out our article on troubleshooting custom functions in Zoho CRM  

Configuring The Workflow To Trigger The Function

In order for this script to run automatically you will need to set up a Workflow rule that will execute this function on the leads you need to verify. To do this navigate to Settings>>Workflow Rules and click the blue button “Create Rule” choose the module for the records you are wanting to validate and give it a name that you will recognize  

zoho workflow rule for custom deluge function

In our workflow we process leads that have been created and our conditions are set to only process Leads with the “Lead Status” of “New Lead” (which is our default for all new leads that our spam filters have approved) 

zoho workflow validate mobile numbers

When you are satisfied with your conditions you can click “Next” and select “Instant Actions”>> Functions

From the popup you will choose “Functions”

And choose the function we added in the previous steps from the list: 

zoho workflow rule existing functions

We hope this guide has provided you with valuable insights on automating mobile number validation in Zoho CRM using Twilio. Implementing this script will not only refine your SMS marketing efforts but also ensure efficient resource utilization.


If you have any questions or need further assistance, feel free to contact us at Rhino Group Consulting. Our team is dedicated to helping you leverage the full potential of your CRM and marketing tools.


Stay updated with the latest trends, news, and custom solutions by subscribing to the Rhino Group Consulting newsletter. Join our community to continue enhancing your marketing strategies and driving business success.


Thank you for choosing our guide, and we wish you the best in your SMS marketing endeavors!

How to Automate Mobile Number Validation in Zoho CRM: A Step-by-Step Guide