Skip to main content

Integration

Twilio and Salesforce Integration

Custom API integration connecting Twilio SMS and voice to Salesforce activity records. Automated messaging from Salesforce workflows with full conversation logging.

Twilio
Salesforce

Integration

What This Integration Does

This integration connects Twilio’s messaging and voice infrastructure to Salesforce. Your team can send SMS messages from within Salesforce, trigger automated texts based on Salesforce workflow rules, and log every communication (sent, received, and missed) as a Salesforce activity record tied to the correct contact, lead, or opportunity.

Salesforce becomes the control centre for SMS communication. A sales rep can send a text directly from a contact record. An automated process builder flow can send an appointment reminder when an opportunity reaches a certain stage. A service agent can respond to an inbound text without leaving the Salesforce console. Every interaction is recorded as a Task or custom activity, complete with message content, timestamp, delivery status, and a link to the full conversation thread.

Twilio handles the telecommunications layer: carrier routing, number provisioning, delivery receipts, and regulatory compliance. Salesforce handles the business logic: who gets messaged, when, and why. The integration keeps both systems in sync, with conversation history accessible to anyone who has access to the contact record. It sits within our wider communication and CRM integrations work.

This is not Salesforce’s native Digital Engagement add-on, which requires Service Cloud licensing and has rigid configuration options. This is a custom integration that works with any Salesforce edition and gives you full control over message routing, template management, and automation triggers.

The Workflow

Outbound messages are initiated in two ways. Manual sends happen through a custom Lightning component embedded in the contact or lead record page. The rep types a message or selects a template, and the component sends a request to the integration endpoint, which forwards the message through Twilio’s API. Automated sends are triggered by Salesforce Process Builder, Flow, or Apex triggers. When a record meets the defined criteria, such as a lead status change, an opportunity stage advance, or a case status update, the automation calls the integration endpoint with the recipient details and message template.

The integration resolves merge fields from the Salesforce record and composes the final message. Twilio sends the message and returns delivery status updates via webhook, each written back to the Salesforce activity record.

Inbound messages arrive through Twilio webhooks. The integration matches the sender’s number against Salesforce contacts and leads, logging against the matching record if found, or creating a new lead if not. Inbound messages can also trigger automation. A reply to a payment reminder can update the opportunity, and a new text from an unknown number can create a task for the sales team. The Salesforce side of this work draws on the same Salesforce API integration expertise we bring to every Salesforce build.

Before and After

Before: Sales reps send texts from personal phones. The conversation is invisible to Salesforce and to everyone else on the team. When a rep leaves or a colleague takes over an account, the text message history goes with the phone, not the CRM. Automated reminders require a standalone SMS platform with its own contact list that drifts out of sync with Salesforce. Compliance teams cannot audit text communications because they are not captured anywhere centrally.

After: Every text message lives inside Salesforce. Reps send and receive SMS without leaving the platform. Automated messages fire based on the same workflow rules that govern email and task creation. The complete communication history across email, phone, and text is visible on the contact record. Compliance and audit requirements are met because all messaging is logged and searchable.

Who Needs This

This integration suits organisations running Salesforce as their primary CRM where text messaging is a meaningful part of the customer relationship. Common scenarios include:

  • Field service businesses that need to send appointment confirmations, technician ETA updates, and completion notifications from Salesforce
  • Financial services teams where timely text follow-ups on applications or document requests improve conversion rates
  • Recruitment agencies that use SMS for candidate communication and need every interaction logged against the candidate record
  • Any Salesforce-centric team that currently uses personal phones or a separate SMS tool and needs those conversations inside the CRM

If your compliance requirements mandate that all customer communications are centrally logged and auditable, this integration is particularly relevant.

How We Build This

We start by mapping your SMS use cases to Salesforce objects and automation. Which record types trigger messages? What templates do you need? Should inbound messages create leads, update cases, or trigger tasks? This scoping determines the data flows and the Salesforce customisation required.

The integration is built as a middleware service that connects Salesforce and Twilio via their respective APIs, following the same approach we use across our API integrations service. On the Salesforce side, we create custom objects for conversation tracking, custom Lightning components for the send interface, and the necessary Process Builder flows or Apex triggers for automation. On the Twilio side, we configure a Messaging Service with appropriate sender numbers, opt-out handling, and carrier compliance settings.

Authentication uses Salesforce Connected App credentials and Twilio API keys with automatic token rotation. The middleware processes messages through a queue to handle volume spikes.

Testing covers manual sends, automated triggers, inbound routing, delivery failures, and opt-out compliance. We test in a Salesforce sandbox with Twilio test credentials before connecting production.

Bring SMS Into Your Salesforce Workflow

If text messages are part of how your team communicates with customers but those conversations are invisible to Salesforce, this integration closes the gap. The same pairing works on HubSpot if that is your CRM, covered in our Twilio and HubSpot integration guide. Get in touch to discuss your Twilio and Salesforce integration.

Written by

Alex

CEO

I’m a software developer and CEO of Digital Royalty, helping growing teams scale their SaaS platforms without losing quality, visibility, or control. I focus on building structured, maintainable systems with clear processes, reporting, and accountability. With over a decade of experience across agency and in-house roles, I specialise in delivering long-term, scalable solutions that support complex, evolving products.

Portrait of Alexander De Sousa, founder of Digital Royalty
Founder-led
“I’ve put everything I know into how this company works — the standards, the method, the care on every project. It runs through the whole team, and I hold us all to it.”

Alexander De Sousa · Founder LinkedIn

Featured on BBC Radio Solent

Get started

Tell us what you need

A few quick questions, then a straight answer from a real person — usually within a few hours.

Tell us what you're working on

Whether it's a new site, a platform, or a process that shouldn't be manual any more — we'll tell you honestly if we can help.