# Unveiling the process: The creation of our powerful campaign builder

[Grab](https://yomu.fyi/company/grab) · Jie Zhang · Sep 10, 2024

**Type:** Explainer

## Summary

Grab details the event processing architecture behind Trident, its internal marketing campaign platform that evaluates If This, Then That (IFTTT) logic over Kafka streams. The core processing unit is a treatment consisting of an event, optional conditions, and actions. Complex campaign capabilities—such as counters, limits, and delays across multiple hours via recursive SQS message scheduling—are assembled from multiple coordinated treatments. To simplify campaign creation, Grab introduced a flowchart-like visual builder represented as a JSON node tree that compiles recursively into treatments while persisting node-to-treatment mappings to reconcile edits over time.

## Context

As marketing campaigns grew more complex, configuring logic flows directly through individual treatments became cumbersome and error-prone for campaign creators.

## Approach / What changed

Grab created a flowchart-style campaign builder UI represented as a JSON node tree, accompanied by a recursive compiler that translates the tree into executable treatments and a diffing algorithm that reconciles campaign updates.

## Takeaways

- To overcome the 15-minute delay limit in Amazon SQS, Trident republishes delayed events in 15-minute increments until reaching delays up to multiple hours.
- Stateful capabilities like event counters and multi-hour delays are implemented by chaining multiple treatments across Kafka streams using intermediate events such as onProfileUpdate and onDelayedEvent.
- Because different node tree structures can compile into identical sets of treatments, Trident stores both the node tree JSON and compiled treatments alongside their node ID mappings.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [AWS](https://yomu.fyi/topic/aws), [Data Pipelines](https://yomu.fyi/topic/data-pipelines), [Kafka](https://yomu.fyi/topic/kafka), [Streaming](https://yomu.fyi/topic/streaming)

[Read original post](https://engineering.grab.com/the-creation-of-our-powerful-campaign-builder)
