← projects

[Postback]

Serverless Order & Campaign ETL

A Lambda pipeline from a checkout platform and an ad tracker into Postgres — idempotent, timezone-aware and recoverable.

● ShippedData EngineeringClient workPythonAWS LambdaPostgres
01 /context

An e-commerce client needed orders and campaign performance in one database to compute ROI per campaign and to send conversion postbacks to the ad tracker.

02 /my role

Solo: Lambda functions, schema, business rules and the recovery path.

03 /problem

Orders change status after they're created, arrive in a different timezone from the business day, and postbacks must never fire twice.

04 /how it works
  1. 01 · Three modes, one function

    A scheduled daily ETL, near-real-time order processing and a “recycle failed” mode that retries what didn't go through.

  2. 02 · Idempotent keys

    (order, status) for orders and (campaign, landing, pre-landing, date) for campaigns, so reruns upsert instead of duplicating.

  3. 03 · Pull by update time

    Orders are fetched by last update, not creation, so late refunds and status changes are captured.

  4. 04 · Two clocks

    Business logic in São Paulo time; API calls in the timezone each API expects.

  5. 05 · Postback dedupe and retries

    Click ids already sent are kept for two weeks; every external call retries with exponential backoff (1, 2, 4, 8 s).

05 /architecture
01
Checkout API
02
Ad tracker API
03
Lambda (daily · real-time · recycle)
04
Business rules
05
Postgres
06
Postback
06 /results
Delivered with documentation of the schema, the modes and the failure handling.
07 /related