Zoho CRM and Twilio Integration: Automated SMS Campaigns and Call Logging

Aaxonix Team Aaxonix Team · May 1, 2026 · 15 min read #Call Logging #CRM Integration #Deluge
Zoho CRM and Twilio Integration: Automated SMS Campaigns and Call Logging

Sales teams lose deals when follow-ups are slow. A lead fills out a form, and hours pass before anyone reaches out. By connecting Zoho CRM and Twilio, you can trigger an SMS within seconds of a lead status change, log every inbound and outbound call directly to the contact timeline, and run multi-step SMS drip sequences without leaving your CRM. This guide walks through the complete Zoho CRM Twilio integration using Deluge custom functions and Twilio’s REST API, covering triggered SMS campaigns, call logging, drip sequences, opt-out compliance, and error handling for production use.

Close-up of person texting on a smartphone. Outdoor setting with wireless connectivity.

Why Connect Zoho CRM with Twilio for SMS and Calls

Zoho CRM handles contact management, deal tracking, and workflow automation. Twilio provides programmable SMS, voice, and WhatsApp APIs used by over 300,000 businesses. Connecting the two gives your sales team three capabilities that native Zoho telephony providers do not offer out of the box.

First, event-triggered SMS. When a lead moves to “Contacted” or a deal reaches “Negotiation,” a Deluge custom function fires and sends a personalised SMS through Twilio within seconds. No manual intervention, no third-party automation tool.

Second, bi-directional call logging. Every outbound call made through Twilio and every inbound call received gets logged as a note or activity on the matching CRM contact record. Your team sees the full communication history in one place.

Third, SMS drip sequences. You can schedule a series of messages, for example a welcome SMS on day 0, a product overview on day 2, and a meeting request on day 5, all triggered from a single workflow rule with scheduled custom functions.

The result is faster response times, complete audit trails, and higher conversion rates. Research consistently shows that SMS open rates exceed 90%, and responding to a lead within five minutes increases qualification odds by a factor of eight.

Prerequisites: Twilio Account and Zoho CRM Setup

Before writing any code, you need a working Twilio account and the correct Zoho CRM edition.

Twilio Account Configuration

  1. Create a Twilio account at twilio.com. A free trial gives you $15 in credits and a trial phone number.
  2. Purchase a Twilio phone number with SMS and Voice capability. Numbers cost $1.15/month for US local numbers. International pricing varies by country.
  3. Note your Account SID and Auth Token from the Twilio Messaging API console. You will need both for API authentication.
  4. If sending SMS to unverified numbers (production use), upgrade from trial to a paid account. Trial accounts can only send to verified numbers.
  5. Register your use case with Twilio’s A2P 10DLC programme if sending to US numbers. This is mandatory since 2023 and affects deliverability.

Zoho CRM Requirements

Sending Triggered SMS on Lead Status Change

The core of the Zoho CRM Twilio integration is a Deluge custom function that fires when a workflow rule detects a field update. Here is the step-by-step implementation.

Step 1: Create the Deluge Custom Function

Go to Setup > Automation > Actions > Custom Functions. Click “Configure Custom Function” and select the Leads module. Refer to the Zoho Deluge Twilio documentation for syntax details. Name the function sendTwilioSMS and map the argument leadId as a string.

// sendTwilioSMS - triggers on lead status change
leadDetails = zoho.crm.getRecordById("Leads", leadId.toLong());
phone = leadDetails.get("Mobile");
firstName = leadDetails.get("First_Name");
optOut = leadDetails.get("SMS_Opt_Out");

// Respect opt-out
if(optOut == true)
{
    info "SMS blocked - lead opted out: " + leadId;
    return;
}

if(phone == null || phone == "")
{
    info "No mobile number for lead: " + leadId;
    return;
}

// Twilio credentials
accountSid = "YOUR_ACCOUNT_SID";
authToken = "YOUR_AUTH_TOKEN";
fromNumber = "+1XXXXXXXXXX";

// Compose message
message = "Hi " + firstName + ", thanks for your interest. Reply STOP to opt out.";

// Build Twilio API request
twilioUrl = "https://api.twilio.com/2010-04-01/Accounts/" + accountSid + "/Messages.json";
params = Map();
params.put("To", phone);
params.put("From", fromNumber);
params.put("Body", message);

// Send via invokeurl
response = invokeurl
[
    url: twilioUrl
    type: POST
    parameters: params
    connection: "twilio_connection"
];

// Log the Message SID back to the lead record
if(response.containKey("sid"))
{
    msgSid = response.get("sid");
    updateMap = Map();
    updateMap.put("Twilio_Message_SID", msgSid);
    zoho.crm.updateRecord("Leads", leadId.toLong(), updateMap);
    info "SMS sent - SID: " + msgSid;
}
else
{
    info "Twilio error: " + response.toString();
}

Step 2: Create the Workflow Rule

Navigate to Setup > Automation > Workflow Rules. Create a new rule for the Leads module with these settings:

You can duplicate this rule for other status transitions. Our Zoho CRM automation guide covers workflow rules and blueprint configuration in detail. For example, trigger a different message when Lead Status changes to “Qualified” or when a Deal Stage moves to “Proposal Sent.”

Step 3: Set Up the Zoho CRM Connection

In Zoho CRM, go to Setup > Developer Space > Connections. Create a new connection with these parameters:

Call center team collaborating with headsets, providing efficient customer support.

Logging Inbound and Outbound Calls to the Contact Timeline

SMS is only half the picture. If your team makes calls through Twilio, those interactions should appear on the Zoho CRM contact record alongside emails, meetings, and notes.

Outbound Call Logging

When an agent initiates a call through Twilio (using a Twilio-powered softphone or click-to-call widget), Twilio generates call events with metadata including duration, status, and recording URL. You can capture this data using a Twilio StatusCallback webhook that posts to a Zoho CRM custom function exposed via an API endpoint. If you are new to webhooks in Zoho, our CRM API and webhooks guide covers the setup process.

Create a standalone Deluge function exposed as a REST API:

// logTwilioCall - webhook endpoint for Twilio call events
callSid = input.get("CallSid");
callerNumber = input.get("From");
dialedNumber = input.get("To");
callStatus = input.get("CallStatus");
duration = input.get("CallDuration");
recordingUrl = input.get("RecordingUrl");

// Find the contact by phone number
searchResult = zoho.crm.searchRecords("Contacts", "(Mobile:equals:" + dialedNumber + ")");

if(searchResult.size() > 0)
{
    contactId = searchResult.get(0).get("id");

    // Create a note on the contact
    noteData = Map();
    noteData.put("Note_Title", "Twilio Call - " + callStatus);
    noteData.put("Note_Content", "Duration: " + duration + "s | SID: " + callSid);
    noteData.put("Parent_Id", contactId);
    noteData.put("se_module", "Contacts");

    zoho.crm.createRecord("Notes", noteData);
    info "Call logged for contact: " + contactId;
}
else
{
    info "No matching contact for number: " + dialedNumber;
}

Inbound Call Logging

For inbound calls, configure your Twilio phone number’s webhook to point to the same Zoho function endpoint. Twilio sends the caller’s number in the From parameter, which you use to search Contacts and Leads. If a match is found, log the call. If no match exists, create a new Lead record automatically with the phone number, ensuring no inbound call goes untracked.

Building SMS Drip Sequences with Scheduled Functions

A single welcome SMS is useful, but a timed sequence of messages converts better. Zoho CRM’s scheduled custom functions let you build drip campaigns without external tools.

Drip Sequence Architecture

The approach uses a custom module called “SMS_Sequences” with these fields:

FieldTypePurpose
Sequence_NameSingle LineCampaign identifier (e.g., “New Lead Welcome”)
Lead_IDLookup (Leads)Linked lead record
Step_NumberNumberCurrent step (1, 2, 3…)
Next_Send_DateDate/TimeWhen to send the next message
StatusPicklistActive, Completed, Cancelled

Scheduled Function for Drip Execution

Create a scheduled function that runs every hour. It queries all SMS_Sequences records where Next_Send_Date is in the past and Status is “Active,” then sends the appropriate message for the current Step_Number.

// scheduledDripSender - runs hourly via scheduled function
now = zoho.currenttime;
pendingSequences = zoho.crm.searchRecords("SMS_Sequences",
    "(Status:equals:Active) and (Next_Send_Date:before:" + now + ")");

for each seq in pendingSequences
{
    leadId = seq.get("Lead_ID").get("id");
    step = seq.get("Step_Number").toNumber();

    // Define messages per step
    messages = List();
    messages.add("Hi {{First_Name}}, welcome aboard. We help teams close deals faster with Zoho CRM.");
    messages.add("Quick question, {{First_Name}}: what is your biggest sales tracking challenge right now?");
    messages.add("{{First_Name}}, would a 15-minute call this week help? Book here: {{meeting_link}}");

    if(step <= messages.size())
    {
        // Fetch lead details for personalization
        lead = zoho.crm.getRecordById("Leads", leadId.toLong());
        msg = messages.get(step - 1);
        msg = msg.replaceAll("{{First_Name}}", lead.get("First_Name"), true);
        msg = msg + " Reply STOP to opt out.";

        // Send via Twilio (reuse sendTwilioSMS logic)
        sendSMSviaTwilio(lead.get("Mobile"), msg);

        // Advance the sequence
        nextStep = step + 1;
        updateMap = Map();
        if(nextStep > messages.size())
        {
            updateMap.put("Status", "Completed");
        }
        else
        {
            updateMap.put("Step_Number", nextStep);
            updateMap.put("Next_Send_Date", now.addDay(2));
        }
        zoho.crm.updateRecord("SMS_Sequences", seq.get("id").toLong(), updateMap);
    }
}

This pattern scales to any number of sequences. For a related use case, see how Zoho Creator handles Twilio appointment reminders using a similar scheduled approach. You define the message content per step, control timing through the Next_Send_Date field, and the scheduled function handles execution automatically.

Error Handling and Delivery Tracking

Production SMS integrations fail silently if you do not build in error handling. Twilio returns specific error codes that your Deluge functions should catch and act on.

Common Twilio Error Codes

Error CodeMeaningAction
21211Invalid phone numberFlag the lead record, skip future sends
21614Number not SMS-capableRemove from SMS sequences
21610Recipient opted out via STOPSet SMS_Opt_Out = true on the CRM record
30003Unreachable destinationRetry once after 1 hour, then flag
30007Message filtered (carrier block)Check A2P registration status

Error Handling in Deluge

Wrap every Twilio API call in a try-catch block and log failures to a custom “SMS_Errors” module for visibility:

try
{
    response = invokeurl
    [
        url: twilioUrl
        type: POST
        parameters: params
        connection: "twilio_connection"
    ];

    if(response.containKey("error_code") && response.get("error_code") != null)
    {
        errorCode = response.get("error_code");
        errorMsg = response.get("error_message");

        // Log to SMS_Errors module
        errorRecord = Map();
        errorRecord.put("Error_Code", errorCode.toString());
        errorRecord.put("Error_Message", errorMsg);
        errorRecord.put("Lead_ID", leadId);
        errorRecord.put("Phone_Number", phone);
        zoho.crm.createRecord("SMS_Errors", errorRecord);

        // Handle opt-out automatically
        if(errorCode == 21610)
        {
            optOutMap = Map();
            optOutMap.put("SMS_Opt_Out", true);
            zoho.crm.updateRecord("Leads", leadId.toLong(), optOutMap);
        }
    }
}
catch(e)
{
    info "Exception sending SMS: " + e.toString();
}

Delivery Status Webhooks

When sending an SMS, include a StatusCallback parameter in your Twilio API request. Twilio will POST delivery updates (queued, sent, delivered, failed, undelivered) to your callback URL. Use these updates to populate a “Delivery_Status” field on your SMS log records, giving your team real-time visibility into message outcomes.

Sleek laptop showcasing data analytics and graphs on the screen in a bright room.

Opt-Out Compliance and Best Practices

SMS compliance is not optional. Violations of TCPA (US), GDPR (EU), or TRAI DND (India) regulations carry significant fines. Build compliance into the integration from day one.

Mandatory Compliance Steps

Rate Limiting

Twilio enforces sending limits based on your number type. A standard US local number supports 1 SMS per second. Toll-free numbers support 3 per second. Short codes support 100 per second. If your drip sequences process hundreds of leads hourly, add a wait(1000) call between sends in your Deluge loop, or use a Twilio Messaging Service with number pooling for higher throughput.

Testing Your Zoho CRM Twilio Integration

Before going live, validate every component of the integration in a controlled environment.

Testing Checklist

  1. Use Twilio’s test credentials (Test Account SID and Test Auth Token) to simulate sends without charges. Test numbers like +15005550006 return specific error codes for testing error handling.
  2. Create a test lead in Zoho CRM with your personal mobile number. Trigger the workflow by changing the lead status and confirm the SMS arrives.
  3. Verify the Twilio Message SID is written back to the lead record’s custom field.
  4. Test the opt-out flow: reply STOP from the test number, then trigger another send. Confirm the function catches error 21610 and sets SMS_Opt_Out to true.
  5. Simulate a call event by sending a test POST to your call logging webhook endpoint. Check that the note appears on the correct contact record.
  6. Run the drip sequence scheduler manually using “Execute Now” in Setup > Automation > Schedules. Verify each step sends the correct message with the correct delay.
  7. Check the SMS_Errors module for any logged failures after all tests.

Monitoring in Production

Set up a Zoho CRM analytics dashboard that tracks SMS sent per day, delivery rates, opt-out rates, and error counts. Create a workflow alert that notifies the admin when the SMS_Errors module receives more than five records in a 24-hour period. This early warning system catches API credential expiry, number deactivation, or carrier filtering issues before they affect your campaigns.

For a full overview of all available options, explore our complete guide to Zoho integrations.

Frequently Asked Questions

What Zoho CRM edition do I need for Twilio integration?

You need Zoho CRM Professional edition or higher. Custom functions, which are required to call the Twilio API via Deluge scripts, are not available on the Free or Standard plans. The Professional plan starts at $23 per user per month (billed annually). If you only need basic SMS without custom logic, the Twilio Marketplace extension works on Enterprise edition and above.

How much does Twilio SMS cost per message?

Twilio charges $0.0079 per outbound SMS segment in the US and $0.0079 per inbound SMS. International rates vary, for example India is approximately $0.04 per outbound SMS. Each SMS segment supports 160 characters (GSM encoding) or 70 characters (Unicode). Messages exceeding these limits are split into multiple segments and billed accordingly. Phone number rental adds $1.15 per month for a US local number.

Can I send bulk SMS from Zoho CRM through Twilio?

Yes, but with rate limits. A standard Twilio local number supports 1 SMS per second. For bulk sends exceeding 100 messages, use a Twilio Messaging Service with a number pool or a short code. In Zoho CRM, trigger bulk sends through a scheduled function that processes a batch of records with a delay between each send to stay within Twilio’s throughput limits. Always check the SMS_Opt_Out field before sending.

How do I handle SMS opt-outs automatically in Zoho CRM?

Twilio’s Advanced Opt-Out feature processes STOP replies automatically and returns error code 21610 when you attempt to message an opted-out number. In your Deluge custom function, catch this error code and set the SMS_Opt_Out checkbox to true on the Lead or Contact record. Add a condition at the start of every SMS function that checks this field and exits immediately if the lead has opted out.

What is the difference between using Zoho Flow and custom functions for Twilio?

Zoho Flow is a no-code automation tool that connects Zoho apps with third-party services including Twilio. It works well for simple triggers like sending a single SMS when a new lead is created. Custom Deluge functions offer full control over message content, error handling, delivery tracking, retry logic, and multi-step drip sequences. For production SMS campaigns with compliance requirements, custom functions are the recommended approach because they support conditional logic and CRM record updates within the same execution.

Aaxonix builds custom Zoho CRM integrations with Twilio, including triggered SMS workflows, call logging, drip sequences, and compliance automation. Book a free consultation to get a no-obligation review of your current CRM communication setup and a scoped implementation plan.

Book a free consultation

Connecting Zoho CRM with Twilio gives your sales team instant SMS reach and complete call visibility, all driven by Deluge custom functions and Twilio’s REST API. Start with a single triggered SMS on lead status change, validate the end-to-end flow, then expand to drip sequences and call logging. The technical foundation covered here scales from a five-person sales team to an enterprise operation with thousands of daily interactions.

Share this article LinkedIn Twitter / X
# Call Logging # CRM Integration # Deluge # SMS Automation # Twilio # Zoho CRM

Thinking about Zoho or NetSuite?

Our team builds systems that actually work. No fluff, just honest architecture and clean implementation.