Home Blog

Composing a Customer Data Platform (CDP) with Lassoo and Castled

Composing a CDP doesn't have to be overly complicated. See how I quickly build out a very capable CDP with Lassoo Headless Analytics and Castled's marketing orchestration capabilities.

Composing a Customer Data Platform (CDP) with Lassoo and Castled

At Lassoo, we work with companies of various sizes, helping them leverage behavioral data for Customer 360, Attribution, Machine-Learning Modelling, and other key use cases. Often we’re pulled into discussions with clients about their overall custom data platform (CDP) strategy. One of the recent topics in these discussions has been packaged versus composable options.

Several new players have emerged as the composable custom data platform movement has taken shape. One such offering is Castled.io, a marketing orchestration platform that runs directly off your cloud data warehouse.

In my approach to digging into Castled, I thought about some companies we work with. Specifically, growth brands that use Lassoo to collect their first part data and are contemplating CDP investments (usually packaged) to facilitate actioning.

Lassoo Headless Analytics does much of the CDPs foundational work - collecting, organizing, enriching, and reconciling first-party customer data. With Castled’s ability to connect to Postgres - Lassoo’s data-store - we have the components of a very capable CDP. In other words, with the behavioral data collection capabilities of Lassoo, and Castled’s orchestration functionality, we could compose a CDP that would support use cases that companies are “actually” able to execute.

Getting Started

Once I created my Castled account, I went to the Warehouse screen and connected to my Lassoo Postgres DB. This is done by copying over the credentials from the Lassoo Database Access screen.


With Castled successfully connected to Lassoo, setting up our Contact and Event schemas was the next step. From the Schema tab I clicked the Add Contact button, which gave me a query window. I pulled all the people collected in my Lassoo test account, with a simple query on the person table.


I then mapped the Lassoo fields to those in Castled. You could also create schemas for specific events, or custom objects. These would be behavioral activities that could be used to trigger workflows.


A Minor Hiccup: Resolved By the Time the Post was Complete

If you look at the Mandatory fields in the previous image, you’ll see that the Primary Key ID dropdown mapping is empty after saving. With the super responsive help of Castled co-founder Arun, we realized that the Postgres UUID field type wasn’t supported in Castled. It now is. Not to worry, A simple cast of UUID to text and I continued on my merry way with everything working as expected.

So the query went from

select * from person_95c74ce5_0c8e_422f_aad4_2ca0414c3477


select cast(person_id as VARCHAR) AS contact_id, * 
    from person_95c74ce5_0c8e_422f_aad4_2ca0414c3477

Defining our Exercise

Before moving on it’s worth defining the parameters for this exercise. My goal is to show how we can quickly compose a CDP with these two tools: Lassoo and Casted. Doing so doesn’t need overly complicated orchestration examples. So I’ll create a couple of segments - one for a static campaign, one for a campaign that uses a behavioral trigger. To make things spicy, I’ll send an SMS message to the recipients rather than an email.

As I outline the steps I take in this example I find myself thinking about so many other things I’d love to illustrate; pushing conversion data to ad platforms, or updating an internal CRM record. Alas, we all have other things to do today, so we’ll leave other use-case examples for a follow-up post.

Creating Segments to Action Against

Using just a few of the rolled-up properties on the Lassoo person table, including first_seen, last_seen, orders_total, last_order_total, last_order_time, and total_avg, we can already create some very useful segments against which to action. That said, I only have a couple of people in my example data set so we’ll keep it simple.

To reiterate, with Lassoo’s auto-capture capabilities that track every on-site action performed without any additional instrumentation, we have the behavioral data to make these segments much more sophisticated. We’d follow the same process to create schemas for Lassoo’s event tables (sessions, pages, inputs, clicks, views, track, e-commerce and so on) as we did for the person table.

Behaviors could include the images the person clicked on, specific categories or products they viewed, the marketing channels they have interacted with, field level inputs, their selection(s) in a faceted search (brand, color, sizes), and so on. These specific behavioral details are the driving data points behind delivering messaging and experiences that resonate. Yes, I chose not to say personalized.

Running a Static SMS Campaign

Setting up the Segment

I’m going to start with a simple segment that includes anyone who has ever purchased. I clicked Create Segment from the Segments screen and used the Lassoo_Person object Castled schema. I added a property-based rule on orders_total greater than 0. Since our campaign will be SMS-based, I’ll also include a rule that the person has a phone number on file.


Now to put this segment into use. This is pretty straightforward for an SMS campaign as I don’t need to set up any email boilerplate or content. I did have to set up an SMS provider, so I created a Twilio account and added the details under the Channel Settings in Castled. Side note, finally getting Twilio to accept my password took longer than all the steps to get to this point.

Running the Test

Now to send a text. I clicked Create Campaign from the Campaigns screen, then selected SMS and One-Time. We’re going to send a personalized text to all our purchasers.


I’m going to use the existing segment that I created. I’m not going to set up any a/b testing or conversion goals.


Then I created my message. Hitting the @ sign gave me all the merge variables to inject into my message.


On the Next screen, I picked Send Now and hit Publish. Then for the moment of truth.

As you can see in the below screenshot on my phone’s lock screen, the message came through with all the details merged into my text message. These are properties on the Person table in Lassoo, no joining to any event data was required.


Running a Triggered SMS Campaign

Setting up the Event Schema

To run campaigns that are triggered by user behaviors, like making a purchase or abandoning a checkout flow, we must also add Event schemas in Castled. This is done in the same way as setting up the Contact Schema. The additional step is to create a relationship between the event and contact schemas.

To create the event schema I went back to the Events screen under Schemas. I clicked Add Event, selected the Lassoo warehouse, and pasted in my query.

select CAST(person_id AS VARCHAR) as contact, * 
    from event_ecommerce_95c74ce5_0c8e_422f_aad4_2ca0414c3477
    WHERE event_name = 'Completed Order'

In Lassoo, all ecommerce events are grouped in a single table, with event_name indicating the canonical event type. The WHERE clause here creates a Castled event for only Completed Order.


As part of setting up the event schema, I had to create a relationship to my Contact schema. My mapping key was person_id.

Setting Up the Segment

I created a new Segment based on the Lassoo Orders event I set up under Schemas. Here I chose the Performed an Event as my filtering criteria, rather than a Property like I did for the segment based solely on the Lassoo Person table.


Through the query builder in Castled, the criteria I set up was that the segment should contain anyone who made a purchase in the last two hours. You could do quite a bit with a post-purchase text message. Simple thank yous, loyalty program invites, or coupons for subsequent purchases.


Running the Campaign

Now that we have the Schema and Segment setup, it’s time to put it in play. I did this by setting up a Workflow. Castled Workflows give you many options to build out pretty complex Orchestrations. For this test, I’ll just fire a text message once someone enters the Segment (purchased within the last two hours).

I begin by creating a new Regular Workflow. We will trigger the workflow by someone entering the Segment.


On the next two screens, I chose to use my existing Segment and skipped setting up any goals or exit criteria. Then, I was presented with the workflow visualizer, where I could add steps. The steps can include branching logic and other messaging types.


I clicked the plus icon to add my step: sending an SMS message to the recipient. I set up the message to be delivered and hit Publish.


Running the Test

With my Schema, Segment, and Workflow setup, the next step was testing this. To do so, I opened an incognito browser - to ensure that it was a new person generated in Lassoo - and fired two calls in my browser console while on my demo website.

A dummy identify call

Lassoo.identify(‘demouser@outlook.com’, {
 firstName: 'Dee',
  lastName: 'Mouser',
  email: 'demouser@outlook.com',
  phone: '+14168171095',
  company: 'Lassoo',
  title: 'Founder',
  address: '140 Great Gulf Ave',
  region: 'Concord',
  city: 'Toronto',
  postal: 'A1A1A1',
  country: 'CA'

A dummy Completed Order call

Trialfire.track('Completed Order', {
    products: [{
      id: 19,
      name: 'Caribeener',
      sku: 'ABCD-010-J',
      price: 19.95,
      quantity: 10
    orderId: '123010023',
    subtotal: 252.45,
    shipping: 15.00,
    shippingMethod: 'International Ground',
    tax: 33,
    discount: 10,
    coupon: 'EXAMPLE2016',
    total: 270,
    revenue: 252.45,
    currency: 'CAD'

Shortly thereafter, I got an alert on my phone. It was my personalized welcome SMS, including my 40% off coupon for my next order.



Composing a CDP with Lassoo and Castled was pretty quick and straightforward. Lassoo made it easy for me to focus on the activation parts in Casled, because the data was already well organized and prepared. I think this is key for any type of data-driven work. We want most of our time spent doing the stuff that moves the needle, like activation, testing, iterating, and growing, not maintaining and managing pipelines.

Stay in the loop.

Get the latest Lassoo news directly in your email box.

Nice. You're now registered for the Lassoo Newsletter.

Michael Lieberman
Michael Lieberman  Co-founder @ Lassoo. Startup guy with multiple exits with a love for product and marketing.