At a glance
- Challenge: customer information is spread across CRM platforms, websites, mobile apps, sales systems and support tools, so no team sees the whole customer.
- Solution: one DataFloem pipeline reads every source, matches the same person across systems, builds one profile per customer, assigns a behavioural segment and writes campaign audiences to Apache Iceberg tables.
- Value: a single customer view, segments that follow real behaviour, and campaign lists that respect consent, refreshed on every run.
The scenario
An illustrative scenario with synthetic data. It does not describe a specific customer.
An online fashion retailer has about five thousand active customers. Its marketing team wants to send the right message to the right person: early access for its best customers, a win-back offer for those who stopped buying, a reminder for abandoned carts, a welcome series for new buyers, and no promotion at all for customers who are waiting on a support ticket.
The data to make those decisions exists, but in six places:
-
Salesforce knows the sales contact, as
Contact 0038d00001KxwithE.Walker@Example.com. -
HubSpot knows the marketing contact, as
vid 51207withemma.walker@example.com. - The website knows a visitor and twelve page views.
-
The mobile app knows
customerId 10001and a product added to the cart. - The e-commerce platform knows fourteen orders worth $2,340.
-
The help desk knows ticket
#8812, solved, with a satisfaction score of five.
They are all Emma Walker. No system knows that.
Why scattered customer data weakens every campaign
When customer data is fragmented, three things go wrong:
- No shared identity. Each system has its own ID, and even the e-mail address is written differently from one tool to the next. The same person appears as two or three customers, and nobody can say how many customers there really are.
- No shared picture of behaviour. Orders, browsing, app activity and support history live in separate tools. A customer who spends a lot but has an open complaint looks like a VIP to one team and a problem to another.
- Segments built by hand. Lists are exported, merged in spreadsheets and uploaded to campaign tools. They are out of date the day after, and opt-outs are easy to miss.
The result is weaker segmentation, generic campaigns and retention analysis that comes too late.
The data sources
| Source | Where it lives | What it contributes |
|---|---|---|
| Salesforce | Daily CSV export in object storage | Sales contacts, country, lead source, e-mail opt-out |
| HubSpot | Daily JSON export in object storage | Marketing contacts, lifecycle stage, e-mail opt-out |
| E-commerce platform |
PostgreSQL (shop.customers,
shop.orders)
|
Customer accounts, every order and its amount |
| Website analytics | JSON event files in object storage | Page views, add-to-cart, checkout |
| Mobile application | JSON event files in object storage | Product views, cart adds, purchases |
| Customer support system | Elasticsearch index | Tickets, status, topic, satisfaction score |
The CRM platforms reach DataFloem as their regular exports, the most common pattern in practice. The same pipeline works the same way when those exports land in another bucket, folder or database.
Building the pipeline in DataFloem
The company uses DataFloem, a self-hosted data platform on Apache Spark and Kubernetes, as the one place where customer data is joined, cleaned and turned into audiences.
- Connect the sources. The object storage bucket with the CRM exports and the event files, the PostgreSQL shop database and the Elasticsearch support index are registered once as DataFloem sources and assigned to a Customer 360 project.
- Lay out the whole pipeline. In a single visual job, every source and every step is placed on the canvas first, so the team sees the full data flow before configuring a single node.
- Match the same person across CRMs. A SQL node maps each CRM export to one shared schema: e-mail addresses in lower case, first and last name joined into a full name, the opt-out flag as a number, and the source system on every row. A Union node puts Salesforce and HubSpot contacts into one list, and an Aggregation node groups it by e-mail address. The same person in both CRMs becomes one record, which keeps the most restrictive consent and counts how many CRM records were found.
- Turn activity into metrics. For orders, an Aggregation node counts orders per customer, adds up total spend and keeps the first and last order dates. For web and app, two SQL nodes bring browsing and app events into one event schema, a Union node merges them, and a SQL node counts events in the last thirty days, cart adds in the last seven days and the time of the latest cart add. For support, a SQL node counts open tickets and the average satisfaction score per customer.
-
Build one profile per customer. A
Join node matches shop accounts to the merged CRM
records by e-mail. A SQL node then joins orders, engagement and
support history with
LEFT JOINs, so customers without orders or tickets are kept too. The result is one row per customer. - Segment by behaviour. A SQL node applies a few readable rules, in order (see the table below). A second SQL node turns segments into audiences with campaign, offer and channel, and leaves out every customer who opted out of e-mail in either CRM.
- Check before running. A Partial Run executes every step on the cluster, and Data Preview shows the result of the segment step. Emma Walker appears once: two CRM records, fourteen orders, $2,340, a VIP.
-
Write to the lakehouse and run. Two catalog target
nodes write
customer_360andcampaign_audiencesas Apache Iceberg tables in the DataFloem catalog. The store strategy is Overwrite, so every run leaves exactly one current picture. The full job runs on a Spark cluster on the company's own Kubernetes, and its log is kept in DataFloem. - Use the result. In DataFloem SQL Queries the marketing analyst counts customers and average spend per segment, then lists the at-risk customers with their win-back offer, ready to hand to the campaign tool.
Six segments, six messages
The rules are checked in this order, so a customer with an open ticket is never offered a sale, however much they spend.
| Segment | Rule | Campaign | Channel |
|---|---|---|---|
| Needs care | An open ticket, or an average satisfaction of 2 or lower | Service follow-up, no promotion | Support |
| VIP | Spend of $1,500 or more and an order in the last 25 days | Early access to the new collection | |
| At risk | Three or more orders, none in the last 90 days | Win-back, 15% off | |
| Cart abandoner | A cart add in the last 7 days with no purchase after it | Free shipping reminder | App push |
| New customer | First order in the last 30 days | Welcome series, 10% off the second order | |
| Regular | Everyone else | No campaign | None |
Architecture
What it means for the business
| Before | With DataFloem |
|---|---|
| The same customer counted two or three times | One record per customer, matched by e-mail across CRMs |
| Behaviour split across sales, web, app and support tools | One profile with orders, engagement and support history |
| Segments rebuilt by hand in spreadsheets | Readable rules, applied to every customer on every run |
| Opt-outs missed between tools | Consent from both CRMs applied before any list is produced |
| Unhappy customers receive promotions | Customers with open issues go to support, not to a sale |
| Campaign lists out of date the next day | Audiences refreshed in the lakehouse with each run |
The DataFloem capabilities it uses
| Capability | Role in this use case |
|---|---|
| Data integration | Object storage (CSV and JSON), PostgreSQL and Elasticsearch sources |
| Data processing | A visual job with SQL, Union, Aggregation and Join nodes |
| Workflow orchestration | Partial runs with data preview, full runs on a managed Spark cluster, run logs |
| Lakehouse storage | Apache Iceberg tables in the DataFloem catalog, overwritten on every run |
| SQL analytics | Querying segments and campaign audiences in SQL Queries |
See it in action
The video below shows the same use case in DataFloem, from one customer scattered across six systems to segment sizes and a win-back campaign list in SQL.
| Time | What you see |
|---|---|
| One customer, six systems | |
| Create the pipeline job | |
| Read the Salesforce export | |
| Merge Salesforce and HubSpot | |
| Orders into customer metrics | |
| Support tickets from Elasticsearch | |
| One profile per customer | |
| Segment by behaviour | |
| Write to the lakehouse (Apache Iceberg) | |
| Partial run and data preview | |
| Run the pipeline | |
| Segment sizes and a win-back campaign list |