Back to Blog
Integration Guides

How to Integrate Twilio with Klaviyo: Step-by-Step Guide

Add Twilio SMS flows to your Klaviyo email sequences to build true omnichannel campaigns for ecommerce with full event tracking.

DA
Danial A
Senior Twilio Consultant, Telphi Consulting
June 22, 2026
7 min read
Twilio
Integration
Marketing
How to Integrate Twilio with Klaviyo: Step-by-Step Guide

Klaviyo and Twilio integrate through Klaviyo Webhooks, the Klaviyo Profiles API, and the Twilio Messages API to add SMS touchpoints to Klaviyo flows triggered by ecommerce events such as abandoned carts, post-purchase, and win-back campaigns, creating true omnichannel sequences that coordinate email and SMS timing. This integration is used by ecommerce brands running Klaviyo for email automation who want to add SMS without switching to Klaviyo SMS, either because they are not in a Klaviyo SMS-supported country or because they want to use Twilio's carrier network and pricing for their volume. The connection uses Klaviyo's flow webhook action or API webhooks to fire events at specific flow steps, which your middleware receives and converts into Twilio SMS dispatches.

What You Need Before You Start

Generate a Klaviyo private API key from your Klaviyo account under Account, then Settings, then API Keys, clicking Create Private API Key with Full Access or at minimum List and Segment Read, Profiles Full Access, and Events Full Access scopes, as you will need to read profile phone numbers and write custom metric events back to Klaviyo. Your Klaviyo API v2 base URL is https://a.klaviyo.com/api/ and all requests require the Authorization header set to Klaviyo-API-Key {privateApiKey} and the revision header set to 2024-05-15 for the current stable API version. From Twilio, collect your Account SID, Auth Token, and an SMS-capable phone number registered under an A2P 10DLC campaign for US ecommerce SMS. Confirm that your Klaviyo profiles have the phone_number property populated for the subscribers you intend to reach by SMS, as Klaviyo profiles created from email-only subscription forms will not have a phone and will need enrichment through a separate phone collection flow or checkout integration.

Step-by-Step Integration Guide

In a Klaviyo flow where you want to add an SMS step, add a Webhook action from the flow builder, set the URL to your middleware endpoint, the method to POST, and the body to a JSON template including {{ person.email }}, {{ person.PhoneNumber }}, {{ person.FirstName }}, and any event-specific properties such as {{ event.item_count }} or {{ event.value }} that you want to include in the SMS message. In your middleware, receive the Klaviyo webhook POST, extract the profile phone from the PhoneNumber field, normalize it to E.164, and dispatch the Twilio SMS by calling POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json with Basic auth and a Body composed from the profile fields passed in the webhook payload. After dispatching the Twilio SMS, write a custom event back to Klaviyo by calling POST https://a.klaviyo.com/api/events/ with the Authorization header set to Klaviyo-API-Key {privateApiKey}, the revision header, and a body containing data.type set to event, data.attributes.metric.name set to SMS Sent, and data.attributes.profile.phone_number set to the E.164 phone, creating a Klaviyo metric that tracks SMS sends for flow analytics and segmentation. Add a Klaviyo flow delay after the webhook action and before the next email step so that if the customer converts after receiving the SMS, a suppression filter in the next flow step can skip the follow-up email using the SMS Sent metric as a condition.

Common Issues and How to Fix Them

Klaviyo flow webhook actions do not retry on failure, meaning if your middleware returns a non-2xx response the SMS is simply not sent and Klaviyo records a failed webhook delivery in the flow logs without alerting you. Monitor your Klaviyo flow webhook delivery log under the flow analytics view and set up a Klaviyo notification for webhook failures, and ensure your middleware returns 200 quickly by dispatching the Twilio SMS asynchronously in a background worker. Klaviyo profile phone numbers are stored in the PhoneNumber property without guaranteed E.164 formatting, as customers enter them in various formats during checkout or opt-in, and passing a non-E.164 number to Twilio results in a 21211 error. Strip all non-digit characters from the PhoneNumber value in your middleware and prepend the country code based on the profile's country property or a default country setting before calling the Twilio API. Klaviyo webhooks from flows send the body as JSON with Liquid template values resolved at dispatch time, but if a Liquid variable references a property that is null on the profile, Klaviyo renders the variable as an empty string rather than an error. Guard against empty phone fields in your middleware by checking whether the PhoneNumber value is a non-empty string of at least 7 digits before attempting E.164 normalization and Twilio dispatch.

How to Get More from This Integration

Track Twilio SMS click-throughs within Klaviyo by embedding a short URL in the SMS message body that includes the Klaviyo profile ID as a query parameter, routing through a redirect server that logs the click and writes a Klaviyo SMS Clicked metric via the Events API before forwarding to the destination URL, enabling click rate measurement on SMS campaigns inside Klaviyo analytics. Build a Klaviyo suppression list for SMS opt-outs by configuring your Twilio inbound number's webhook to detect the keyword STOP, updating the Klaviyo profile's PhoneNumber property to null using PATCH https://a.klaviyo.com/api/profiles/{profileId}/ and adding the profile to a Klaviyo suppression list via the Suppressions API to prevent future SMS sends from Klaviyo flows. Create a SMS revenue attribution metric in Klaviyo by adding the Placed Order Klaviyo metric as a trigger for a separate attribution flow that checks whether an SMS Sent metric exists on the profile within the last 24 hours, and if so fires a Klaviyo custom event called SMS Attributed Revenue with the order value for reporting. Extend the integration to Klaviyo catalog-triggered SMS by subscribing to the Klaviyo Back In Stock event webhook, extracting the product name and variant from the event payload, and sending a Twilio SMS to the profile that signed up for the back in stock alert, creating a real-time inventory notification system.

Conclusion

Klaviyo and Twilio together enable ecommerce brands to run coordinated omnichannel flows where email and SMS are timed and targeted from the same behavioral event data. Talk to our team at Telphi Consulting to design and implement Klaviyo flow steps powered by Twilio SMS for your store.

Share this article:
0 views

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)

Protected by AI moderation

Be the first to comment

No comments yet. Share your thoughts below.