Building predictive marketing campaigns with Twilio Segment


By Debbie Yeh

This post is a guest submission by one of our customers and friends at InVision. The InVision team’s clever use of Segment, combined with our partners ClearBrain and Clearbit, has led to some pretty advanced programmatic predictive models. We’re grateful they took the time to share how they did it in this writeup.



These days, it seems like every marketer on the internet is talking about using machine learning. There’s this promise that just by plugging in a few numbers, you can deliver a more personalized experience than ever before. 

It sounds hip, sophisticated, and exciting–but we’ve found there’s a lot of noise out there.

Amid the myriad tools and techniques on the market: how does one actually create personalized campaigns with machine learning?

That’s a question we found ourselves asking at InVision two months ago. 

InVision is a digital design platform with tools for ideation, design, prototyping and design management. Our platform has over 3 millions users from individuals to large enterprise companies on both free and paid plans.  

As a marketing team, our focus is specifically on acquisition and activation of users on these various plans. Last year alone, we sent over 500 email campaigns and ran 250 ads, across 6 different channels to drive growth. 

Across all of those efforts, we’ve found that creating personalized messages has by far the most outsized return. It’s led to a 7% (statistically significant) increase in user activation, which in turn has had a massive impact on our business and revenue numbers.

To reach that 7%, we combined three separate data collection tools:

  • Segment helps us collect data about our users

  • Clearbit enriches the data we’ve collected with additional ‘traits’ like company or geolocation

  • Clearbrain takes that full set of traits and applies machine learning to create ‘predicted traits’

Below we walk through the steps we took to enable such programmatic predictive modeling at InVision, and how we leveraged it to power all our marketing efforts.  

Instrumenting Your Data for Machine Learning

A predictive marketing infrastructure requires three things: data enrichment, instrumentation, and inference.


Data enrichment and instrumentation here is key. Predictive marketing at its core relies on building a statistical model of your users’ past behavior to predict their future behavior. So to identify and retarget which users were most likely to increase product utilization (e.g. create prototypes in InVision), we needed a complete picture of our users’ journey from signup to prototype-create.

By instrumenting tools such as Segment and Clearbit, we were able to automatically instrument and enrich the necessary traits for that user journey.

Segment powered the core of our instrumentation efforts. Instrumenting Segment allowed us to represent every stage of the user journey as a distinct track or identify call—from visit to signup to engagement. Additionally, Segment’s reserved traits on each identify call gave us powerful demographic inputs such as the referral source (context_page_referrer), campaign information (context_campaign_medium, context_campaign_source), and device type (context_user_agent).

To supplement our core instrumentation efforts, we used Clearbit - an API service that enriches third-party user attributes by email address. These attributes included information about our user’s employment history (traits_industry, traits_industrygroup, traits_sector), their location (traits_geo_country, traits_geo_state, traits_timezone), and their demographic details (traits_gender, traits_employment_role, traits_employment_seniority).

Combining Segment and Clearbit enabled us to instrument and enrich our user personas, providing a digital map of user behavior to power our predictive marketing campaigns.

Converting Segment Calls into Machine Readable Data


With the necessary data instrumented, our predictive marketing campaigns had sufficient inputs to infer who would perform the `prototype-create` event in the future based on the data we had tracked about them in the past.

But statistical models require data to also be in the right format. The data collected by Segment and Clearbit is stored in time-series and nested JSON objects. Machine learning models, by contrast, only understand inputs as booleans or integers.

To automate this process, we used ClearBrain (no relation to Clearbit!). ClearBrain automatically ingests Segment data to handle the data transformation and inference phases of a predictive marketing infrastructure.

Under the hood, ClearBrain converts each Segment trait and track call into the appropriate machine readable format. For instance, a Clearbit traits_industry property normally outputs as a string (e.g. software, specialty-retail, etc.). ClearBrain instead transforms the trait to a set of distinct boolean values (e.g. clearbit_industry_software = 0, or clearbit_industry_specialty-retail = 1).

ClearBrain in turn is able to transform each distinct Segment property into a consistent machine readable schema of booleans and integers:

  • Segment tracks → weekly count rollups (integer)

  • Segment traits (timestamp) → days count since date (integer)

  • Segment traits (string) → categorical pivot by value (boolean)

  • Segment traits (boolean) → true / false (boolean)

All of these transformations are performed automatically on connecting our Segment account to ClearBrain, and didn’t require any additional code or engineering.

Creating Predictive Traits in ClearBrain


With our data now instrumented and transformed, we were ready to identify which users were most likely to create a prototypes, and target them in our predictive marketing campaigns.

ClearBrain made it easy to identify which users to target. Using a point-and-click UI, we simply had to select the specific Segment track call as the goal we wanted to predict. We chose our prototype-create event, and in minutes ClearBrain analyzed every user who had performed the action in the prior week, building a statistical model for which users would perform the action in the coming week.

The benefit of using a statistical approach here is the automation. Instead of selectively guessing which combination of Clearbit and Segment attributes were most indicative of a user performing the prototype-create action, ClearBrain automatically scanned thousands of permutations in attributes, assigning weights to each by their relative importance to performing a prototype-create action.


These attribute weights in turn carry their own analytical value. Similar to the classic Facebook discovery of “7 friends in 10 days” leading to an active user, ClearBrain helped us map which of our other user actions were most indicative of creating a prototype. We found that:

  • Users who used the “hotspot” feature > 0 times in the past week had a 4% - 10% probability to create a prototype

  • Users who did the drag-and-drop action > 0 times in the past had a 4% - 7% probability to create a prototype

  • Users who completed the tutorial video > 1 times in the past week had a 4% - 7% probability to create a prototype

  • Users who used the “build-mode” view of the app > 3 times in the past week had a 4% - 5% probability to create a prototype

Combining these respective insights, ClearBrain consolidated these attribute weights automatically into a single predictive trait. A composite propensity score between 0.0 - 1.0, this predictive trait represented each user’s relative likelihood to perform the prototype-create action as a function of a users’ prior actions. The higher the score, the higher the likelihood that the user would perform the action in the current week—enabling us to know whom to target at the right time and place in our predictive marketing campaigns.

Increasing Lift Through Predictive Campaigns


The ease of using Segment + ClearBrain helped us to identify the top 25% of users most likely to engage or perform the `prototype-create` event in a given week.

Rather than inefficiently using all our marketing spend on all our users, we focused it to just those with the highest propensity (ClearBrain Score > 0.5) to create a prototype. We set up persistent omnichannel marketing campaigns to target these 25% of users in our Facebook ads and Hubspot emails.

And indeed we saw a measured lift in engagement from the targeting of these users. In just one week of running the campaign, we found that email CTR increased by 40%, and ad CTR in Facebook rose 70% relative to a control.


Downstream, these respective marketing campaigns resulted in an overall increase in the use of the prototype-create feature by 7%.  The initial results are strong and we have plans to continue to optimize our campaigns to further increase performance.

This was a paradigm shift for our team, as rather than guessing the ideal target of email subscribers to drive engagement in prototype creation, we were able to selectively target an intelligently designed group of users. Rather than segmenting users by their current stage in the user lifecycle, we segmented and retargeted users by their likelihood to perform an action and proceed to the next stage.

Building our omnichannel marketing campaigns around predictive traits instead of historical segments in turn provided a powerful tool for driving engagement and transforming our customer journey.  The end result is not only a more efficient and higher performing outreach but a more relevant and meaningful experience for our users.

The state of personalization 2023

The State of Personalization 2023

Our annual look at how attitudes, preferences, and experiences with personalization have evolved over the past year.

Recommended articles


Want to keep updated on Segment launches, events, and updates?