Junior Carlos
← All projects
CRM and dataIn use

A fuel station network CRM: who comes back, who fades and who abuses

By Junior Carlos de MattosUpdated 23/11/20262 min read

The network sold every day, but nobody could see the customer who stopped coming back or the misuse of points and discounts.

Diagram: the sales and loyalty system feeds a single base; rules and models run on it; results arrive as Telegram alerts and lists.
Figure: the sales and loyalty system feeds a single base; rules and models run on it; results arrive as Telegram alerts and lists.

The problem

A network of 12 gas stations sells all day long, but its data was scattered: sales in one system, loyalty points in another, with no single view of the customer.

As a result, a customer who stopped filling up went unnoticed, oil-change returns depended on memory, and misuse of points, discounts and cashback showed up late, if at all.

The solution

I merged the data into a single base, loaded automatically every morning. On top of it, the system delivers:

  • daily Telegram alerts about out-of-pattern behavior, with buttons to mark it normal or suspicious;
  • customer segmentation by buying rhythm, so the right campaign reaches the right audience;
  • a model that estimates each customer's chance of coming back in the next 30 days;
  • daily lists of customers at risk of churning and of oil-change returns.

How it works

  1. Every morning an automatic load brings sales, points and customers into the single base.
  2. Rules and models analyze each customer's buying rhythm and compare it with their own history.
  3. Anything out of pattern becomes a Telegram alert, with buttons for the team to mark it normal or suspicious.
  4. In parallel, daily lists point out who is at risk of leaving and who should be back for an oil change.

Where it stands

In production and evolving. Next step is building and sending campaigns by audience directly in the system, with send limits and reports.

Stack: Python, BigQuery, PostgreSQL, Telegram.

What I learned

  • A data load that fails silently is worse than one that warns you. Mine stayed down for four days because billing on the cloud service was disabled, and I only noticed from the late alerts.
  • Running the load by hand in the middle of a recovery duplicated sales. There is now a guard against duplicate runs, and a manual load can only be triggered through the service itself.
  • An alert with no action becomes noise. That's why each alert already carries the buttons for the team to answer on the spot.

Frequently asked questions

How does the system decide who is at risk of leaving?

It compares each customer's current buying rhythm with their own history and uses a model that estimates the chance of the customer coming back in the next 30 days. Low-chance customers go on that day's list.

Why merge everything into a single base?

Because sales, points and sign-ups lived in different places. Without one view of the customer, no rule or model can see the pattern.

Junior Carlos de Mattos

By Junior Carlos de Mattos
I work in marketing and build systems and AI automations. This post describes one of my own projects, in progress. About the author

Want something like this for your business?

Tell me what you need and I'll reply on WhatsApp.

Get in touch