Pardot (now Marketing Cloud Account Engagement) and Twilio integrate through Pardot Completion Actions, Webhooks, and the Twilio Messages API to add SMS touchpoints to engagement programs, sending text messages alongside email nurture sequences for B2B prospects tracked in the Salesforce ecosystem. This integration is used by Salesforce-centric B2B marketing teams running Pardot who want to extend their engagement programs to SMS without adding a separate platform outside the Salesforce data model. The connection uses Pardot's webhook completion action on forms and email clicks to fire events to your middleware, which dispatches Twilio SMS and writes the interaction back to the Salesforce contact or lead record via the Salesforce API.
What You Need Before You Start
Generate Pardot API credentials by creating a Salesforce Connected App under Setup, then Apps, then App Manager, enabling OAuth 2.0 with the full scope, and using the resulting Consumer Key and Consumer Secret to obtain a Salesforce access token via POST https://login.salesforce.com/services/oauth2/token with grant_type=password, username, password, client_id, and client_secret parameters for simple server-to-server authentication. Your Pardot API base URL depends on your Pardot Business Unit ID and follows the pattern https://pi.pardot.com/api/{version}/do/ where version is 4, and all requests require an Authorization header with the Salesforce access token and a Pardot-Business-Unit-Id header with your BU ID. Configure a Pardot webhook completion action on a specific form or email by navigating to the asset in Pardot, adding a Notify via Webhook completion action, entering your middleware URL, and defining the fields to include in the POST body such as Email, First Name, and Phone. From Twilio, collect your Account SID, Auth Token, and an SMS-capable phone number, and ensure your Pardot prospects have the Phone field populated since Pardot syncs this from Salesforce Contact or Lead records.
Step-by-Step Integration Guide
In your middleware webhook handler, receive the Pardot completion action POST, extract the prospect email and phone from the form-encoded body, normalize the phone to E.164, and dispatch a Twilio SMS by calling POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json with Basic authentication and a Body relevant to the form or email that triggered the completion action. To trigger Twilio SMS from a Pardot engagement program step without a completion action, use Pardot's Custom Redirect feature by creating a Custom Redirect that points through your middleware URL before reaching the destination, so when a prospect clicks a tracked link in a Pardot email your middleware receives the click event along with the prospect email, looks up the phone from Salesforce via the SOQL query SELECT MobilePhone FROM Contact WHERE Email = '{email}' against the Salesforce REST API, and dispatches the Twilio SMS. Write the SMS event back to Salesforce by calling the Salesforce REST API at POST https://{instance}.salesforce.com/services/data/v58.0/sobjects/Task/ with a JSON body containing WhoId set to the Salesforce contact or lead ID, Subject set to Twilio SMS Sent, Description set to the SMS message body, and ActivityDate set to today's date, creating a CRM activity record visible to the sales rep. Retrieve the Salesforce contact or lead ID by querying the Salesforce REST API using SOQL SELECT Id FROM Contact WHERE Email = '{email}' via GET https://{instance}.salesforce.com/services/data/v58.0/query?q={urlEncodedSOQL} with the Salesforce access token.
Common Issues and How to Fix Them
Pardot completion action webhooks include only the fields explicitly configured in the completion action form field list, so if Phone is not added to the webhook fields list it will be absent from the POST body, requiring a secondary Salesforce API call to retrieve the phone. Always add Phone to the Pardot webhook completion action field list in the Pardot form settings, and add a Salesforce API fallback in your middleware for cases where the phone field is still empty despite being configured. Salesforce access tokens obtained via the username-password OAuth flow expire after a configurable session timeout, typically 2 hours in enterprise orgs, and failing to refresh them causes all Salesforce API calls to return 401 Unauthorized. Implement a token refresh check before every Salesforce API call using the stored token issue time and a configured maximum age threshold, refreshing via the same OAuth token endpoint before making the primary API call. Pardot prospect phone numbers stored as text include extensions, formatted characters, and occasionally country codes in inconsistent formats because Pardot does not enforce a phone format on the standard Phone field. Normalize every phone extracted from Pardot by stripping all non-digit characters, detecting whether a country code is already present based on the total digit count, and prepending the country code only when absent to avoid double-prefixing.
How to Get More from This Integration
Build a Pardot engagement program with an SMS step by using Pardot's Custom Redirect as the trigger mechanism: embed a Custom Redirect link in a Pardot email that points to your middleware, include the prospect email as a query parameter, have your middleware dispatch the Twilio SMS to the prospect's phone, increment a Pardot custom score field via the Pardot API, and then redirect the prospect browser to the intended landing page, creating a seamless SMS trigger within the email click flow. Add lead scoring for SMS interaction by updating the Pardot prospect's score via PATCH https://pi.pardot.com/api/4/do/update/email/{prospectEmail} with an increased score value when your middleware receives a Twilio SMS reply from that prospect's phone, enabling Pardot engagement program branching based on SMS engagement. Create a Salesforce Task for each inbound Twilio SMS reply by configuring your Twilio inbound webhook to your middleware, looking up the Salesforce contact by phone using SOQL, and creating a Task record with ActivityDate, Subject set to Inbound SMS Reply, and Description set to the reply text, ensuring sales reps see the conversation in Salesforce Activity History without any manual logging. Extend the integration to Pardot Forms by adding a phone number field to your Pardot landing page forms, configuring a webhook completion action on form submission to fire immediately with the submitted phone, and dispatching a Twilio SMS confirmation or download link within seconds of the form submit, dramatically improving the speed-to-lead response time.
Conclusion
Pardot and Twilio together bring SMS into your Salesforce marketing automation ecosystem, giving B2B marketing teams a text message channel with full CRM activity tracking and lead scoring integration. Get in touch with Telphi Consulting to design and implement this integration for your Pardot and Salesforce environment.
Ready to Transform Your Business Communications?
Get a free consultation with our VoIP experts and discover how we can help you save costs, improve efficiency, and scale your business.
Comments (0)
Join the discussion and share your thoughts (AI-moderated for quality)
Be the first to comment
No comments yet. Share your thoughts below.