Pipedrive and Twilio connect through Pipedrive's Webhook system and REST API, letting you trigger automated SMS at each deal stage, log inbound and outbound calls as Activities, and give your reps a faster path to reaching leads without leaving the pipeline view. This integration suits sales teams that live in Pipedrive for deal management and want the speed of SMS outreach combined with automatic activity logging so nothing falls through the cracks between stage transitions. The setup uses Pipedrive Webhooks to detect deal events, a middleware layer to translate and act on those events, and Twilio's Messages and Calls APIs to execute the actual communication.
What You Need Before You Start
You need a Pipedrive account at the Advanced plan or higher to access the Webhooks feature under Tools and Integrations, and a Pipedrive API token from Settings, then Personal preferences, then API. From Twilio, gather your Account SID, Auth Token, and the phone number you will use for SMS and voice, along with a Messaging Service SID if you are using number pools for higher throughput. Your middleware server needs a publicly accessible HTTPS URL with a valid SSL certificate, as both Pipedrive Webhooks and Twilio StatusCallback require HTTPS endpoints that return HTTP 200 within a timeout window. Identify the Pipedrive stage IDs you want to trigger actions on by calling GET https://api.pipedrive.com/v1/stages?api_token={token} and noting the id values for each named stage, because your webhook handler will filter on stage_id to avoid firing on every deal update.
Step-by-Step Integration Guide
Create a Pipedrive Webhook in Tools and Integrations, then Webhooks, selecting the updated.deal event type and pointing the delivery URL to your middleware endpoint such as https://yourapp.com/pipedrive/deal-updated with HTTP POST. In your middleware, parse the JSON payload from Pipedrive, check that current.stage_id matches your target stage and that previous.stage_id differs, then extract the deal person_id to look up the contact phone by calling GET https://api.pipedrive.com/v1/persons/{personId}?api_token={token} and reading data.phone[0].value from the response. Send the SMS by calling POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json with To set to the contact phone in E.164, From set to your Twilio number, Body set to your message including the deal title, and StatusCallback set to your delivery receipt endpoint. Log the sent SMS as a Pipedrive Activity by calling POST https://api.pipedrive.com/v1/activities?api_token={token} with type set to task, subject set to SMS Sent, deal_id set to the deal ID from the webhook payload, person_id set to the contact, and done set to true so it appears as a completed activity in the deal timeline.
Common Issues and How to Fix Them
Pipedrive Webhooks fire on every deal update including trivial field edits, causing your middleware to send duplicate SMS when the stage has not actually changed. Fix this by comparing current.stage_id with previous.stage_id and only proceeding when they differ, and add an idempotency check by caching processed deal-plus-stage combinations for 24 hours keyed by deal_id concatenated with the stage_id. Pipedrive returns phone numbers in whatever format the rep typed them, including local formats, strings with spaces and dashes, and international formats without the plus prefix. Build a phone normalization function using a library like libphonenumber that accepts any input format and returns a clean E.164 string before passing the number to Twilio, defaulting to a country code based on your primary market when none is detected. Webhook delivery fails if your middleware returns a non-200 status or times out, and Pipedrive does not retry failed webhooks, meaning the event is silently dropped. Always return HTTP 200 immediately from your endpoint and process the Twilio API call and Pipedrive activity logging asynchronously in a background job to prevent timeout failures from causing missed stage-change events.
How to Get More from This Integration
Build a click-to-call button by creating a Pipedrive App Extension that renders a custom UI panel on the Deal detail view, calling your middleware on click, and having the middleware initiate a Twilio call via POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls.json with the Url pointing to TwiML that bridges the rep's browser phone through the Twilio Client JavaScript SDK. Route inbound calls from known Pipedrive contacts to the deal-owning rep by looking up the calling number against Pipedrive persons via GET https://api.pipedrive.com/v1/persons/search?term={phone}&fields=phone&api_token={token} and directing the call to the owner's extension using Twilio TaskRouter. Create a custom Pipedrive deal field named Last SMS Sent and update it via PUT https://api.pipedrive.com/v1/deals/{dealId}?api_token={token} each time an SMS fires, enabling your pipeline view to be filtered to show only deals that have or have not received SMS outreach in their current stage. Set up inbound SMS routing so replies from prospects are matched to the corresponding Pipedrive deal by the sender phone number and automatically added as a note via POST https://api.pipedrive.com/v1/notes?api_token={token} with the content field containing the message body and timestamp.
Conclusion
Pipedrive with Twilio turns your pipeline into a communication hub where stage changes trigger outreach and every call or message writes itself into the deal timeline without any manual logging from your reps. Talk to our team at Telphi Consulting to have this built for your specific pipeline stages and message templates.
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.