Connecting Twilio to PostHog
Twilio is infrastructure rather than a product, so what it can tell you depends entirely on what your own application logged alongside the message or call. PostHog can be self-hosted, which changes the calculus entirely: the data stays on infrastructure you control, and so does the responsibility for everything that goes wrong with it. The join between them succeeds or fails on one thing: whether the distinct_id reaches the Twilio message or call record before the conversion happens, because PostHog can only match a conversion it can tie back to a click it recognizes.
Free30 minutesNo obligation
Specific to this pair
Twilio to PostHog: SMS and call steps inside your product funnel
Store your user's distinct_id next to each Twilio SID when the interaction is created, then capture product events such as phone verified or reminder clicked server-side, with the SID and status as properties and a UUID derived from SID and state. Send only final states, and never phone numbers or message bodies.
PostHog is where Twilio interactions make the most sense as events rather than conversions, because your product funnel probably includes them: the verification code that gates sign-up, the reminder text that should bring someone back, the support call that precedes a cancellation. Capture each one server-side with the same distinct_id your frontend uses, which means your application must know the user when it creates the Twilio interaction and store the ID next to the SID.
Name events for what happened in your product, such as phone verified, reminder clicked or support call completed, and put the Twilio SID and status in properties rather than in the event name. Status callbacks arrive repeatedly as a message moves from queued to sent to delivered; send only the final state you care about, with the event UUID derived from the SID and state so a webhook retry does not count twice.
The insight this pair can produce that no ad platform can is whether SMS actually changes behavior. With reminders and logins on the same person, a PostHog funnel shows whether texted users return more than untexted ones, which is the question Twilio's console cannot answer. Never send message bodies or phone numbers as properties; the distinct_id is enough to join, and self-hosted or not, the data is easier to keep clean than to clean up.
Twilio → PostHog · what breaks
Why this join usually fails — Twilio → PostHog
- 01
The distinct_id never reaches Twilio
Twilio has no concept of marketing at all. Any identifier has to be attached by your own code at the point the interaction is created, and if it was not, the record cannot be recovered afterwards.
- 02
Transport confused with meaning
A delivered SMS is not a conversion. Twilio reports delivery, and reading that as a business outcome is the standard mistake when teams wire the console directly.
- 03
Self-hosting the analytics and the outage together
The advantage of owning the pipeline is that nothing blocks it. The cost is that when the ingestion instance fills its disk on a Saturday, the events are gone and nobody is paged. Hosted tools fail differently and more visibly.
- 04
Nothing reconciles afterwards
PostHog shows events in the activity view within moments. On a self-hosted instance, check the ingestion lag as well — events that are queued are not events that are lost, and the two need different responses.
Twilio → PostHog · the fix
What working looks like — Twilio → PostHog
The distinct_id on every interaction
Conversions arriving in PostHog
The event lands on the person profile and becomes available in insights, funnels and session replay.
Reconciled against the source
Twilio → PostHog · architecture
How Twilio and PostHog actually connect
- 1
Twilio holds the truth
Twilio knows a message was sent or a call connected. Whether that represented a lead, a booking or a delivery notification is something only your application knows, which makes your own logging the source of truth rather than Twilio's console.
- 2
PostHog needs a click to match
PostHog needs a distinct_id, an event name and its properties. Self-hosted instances additionally need the ingestion endpoint reachable and the project API key correct, which is a class of failure hosted tools do not have.
- 3
The identifier is the bridge
The distinct_id, captured at the visit and carried into the Twilio message or call record.
- 4
The event source decides reliability
Send from your application when the interaction represents something commercially meaningful, not from Twilio's status callbacks, which report transport rather than outcome.
- 5
Deduplication at the destination
PostHog deduplicates on the event UUID where supplied. Without one, a retried batch duplicates, and on a self-hosted instance there is no vendor support desk to notice it for you.
Twilio → PostHog · normal or broken
Working vs. broken, side by side — Twilio → PostHog
Normal, not a fault
The distinct_id present on the interaction
Sent from your application's own event, keyed to the Twilio SID
Deduplicated correctly
PostHog deduplicates on the event UUID where supplied. Without one, a retried batch duplicates, and on a self-hosted instance there is no vendor support desk to notice it for you.
Reconciles with the source
Actually broken
The distinct_id missing on most records
Twilio has no concept of marketing at all. Any identifier has to be attached by your own code at the point the interaction is created, and if it was not, the record cannot be recovered afterwards.
Sent from the browser
A delivered SMS is not a conversion. Twilio reports delivery, and reading that as a business outcome is the standard mistake when teams wire the console directly.
Counted twice, or not at all
The advantage of owning the pipeline is that nothing blocks it. The cost is that when the ingestion instance fills its disk on a Saturday, the events are gone and nobody is paged. Hosted tools fail differently and more visibly.
Nobody has reconciled it
Twilio → PostHog · diagnose
Diagnostic order — Twilio → PostHog
- 01
Count interactions carrying the distinct_id
- 02
Follow one real conversion end to end
- 03
Check whether your application logs the business meaning of each interaction
If it only stores Twilio SIDs and statuses, there is nothing to build a conversion on.
- 04
Check ingestion health and disk before debugging any missing event
On self-hosted instances the answer is infrastructure far more often than it is instrumentation.
- 05
Read the match rate, not the success message
PostHog shows events in the activity view within moments. On a self-hosted instance, check the ingestion lag as well — events that are queued are not events that are lost, and the two need different responses.
Twilio → PostHog · prove
How it gets proven — Twilio → PostHog
Source of truth
Your own application's records of Twilio interactions, since Twilio itself stores the transport and not the business meaning.
- The distinct_id confirmed present on a live interaction.
- Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
- Conversions confirmed to come from your application's business events rather than Twilio's delivery callbacks.
Twilio → PostHog · free audit
What we check in the free audit
- Count interactions carrying the distinct_id
- Follow one real conversion end to end
- Check whether your application logs the business meaning of each interaction
- Check ingestion health and disk before debugging any missing event
- Read the match rate, not the success message
Checked against
Your own application's records of Twilio interactions, since Twilio itself stores the transport and not the business meaning.
Free30 minutesNo obligation
Twilio → PostHog · when not to buy
When you don't need this — Twilio → PostHog
- Measure identifier coverage yourself first — pull your last hundred interactions and count how many carry the distinct_id.
- If Twilio is purely notification infrastructure in your stack, it is not a conversion source and should not be treated as one.
- If you have no reason to keep the data on your own infrastructure and no team to run it, the hosted product removes the only real downside of this one.
Twilio → PostHog · what we deliver
What gets built — Twilio → PostHog
Identifier capture into Twilio
Attach the click identifier in your own application's record when creating the Twilio interaction, and store it alongside the Twilio SID so the two can be joined.
Event source: your application's own event, keyed to the Twilio SID
Send from your application when the interaction represents something commercially meaningful, not from Twilio's status callbacks, which report transport rather than outcome.
Dispatch to PostHog
The PostHog capture API, posted server-side from your backend to your own instance or to PostHog Cloud.
Reversals where they exist
Nothing inherent; whatever your application defines as a reversal applies.
Written guarantee
95%+ tracking accuracy
Measured against Your own application's records of Twilio interactions, since Twilio itself stores the transport and not the business meaning.. Miss it and we keep working at no cost.
From $400 · See packages
FAQ
Twilio → PostHog questions, answered
From your backend, capture an event with the user's distinct_id when your application records a meaningful Twilio interaction, keyed to the SID. Avoid forwarding raw status callbacks, which fire several times per message.
Yes, if reminder sends and the user's later product activity share a distinct_id. Then you can compare return rates for users who received the reminder against those who did not.
Almost always because the distinct_id never reached the Twilio message or call record. Twilio has no concept of marketing at all. Any identifier has to be attached by your own code at the point the interaction is created, and if it was not, the record cannot be recovered afterwards. Measure coverage before debugging the dispatch.
PostHog identifies by distinct_id with an alias call to merge anonymous and identified users. On a self-hosted instance you also control the ingestion endpoint, which means the identifier survives ad blockers that would kill a third-party pixel — one of the few genuine technical advantages available to a first-party setup.
Your application's own event, keyed to the Twilio SID. Send from your application when the interaction represents something commercially meaningful, not from Twilio's status callbacks, which report transport rather than outcome.
PostHog shows events in the activity view within moments. On a self-hosted instance, check the ingestion lag as well — events that are queued are not events that are lost, and the two need different responses.
More on Twilio → PostHog
- Twilio → Google AdsConnecting Twilio to Google Ads
- Twilio → MetaConnecting Twilio to Meta Conversions API
- Twilio → GA4Connecting Twilio to GA4
RELATED GUIDES
Where Twilio → PostHog fits in the rest of your tracking
- CallRail → PostHogConnecting CallRail to PostHog
- Invoca → PostHogConnecting Invoca to PostHog
- CallTrackingMetrics → PostHogConnecting CallTrackingMetrics to PostHog
- Twilio → GA4Connecting Twilio to GA4
- Twilio → Adobe AnalyticsConnecting Twilio to Adobe Analytics
- HVACConversion tracking for HVAC, with service calls and installs counted separately
- WhatConverts → PostHogConnecting WhatConverts to PostHog
- Marchex → PostHogConnecting Marchex to PostHog
Free · 30 min
Get Twilio and PostHog joined properly
Free30 minutesNo obligation
