Ad leads into the database and to the right country team
Every ad-form lead captured in real time, enriched with campaign data, checked for repeats and sent to the right country team.
The problem
Leads from Facebook and Instagram ad forms had to be downloaded and copied into the database by hand, with delays and duplicates. Each country team needs to see its own leads quickly, while interest is still high, and leads from a form nobody had linked to a campaign were at risk of being lost.
How it works
- Receive the event. Meta calls the workflow whenever someone submits a lead form. The same endpoint also answers Meta’s subscription handshake.
- Enrich it. Each lead event is extracted and the full answers and ad details are fetched from Meta. The workflow looks up which internal campaign the form belongs to.
- Record it once. The database is checked for the same phone number on the same form, and repeats are skipped. New leads are mapped onto the database fields through a single configuration block, with any unexpected questions kept in a notes field rather than lost.
- Tell the right people. The lead is created and a summary goes to the country team’s Telegram channel and a general channel. A failure at the fetch, lookup or create stage goes to a separate technical channel instead.
The engineering that matters
All table and field references live in one configuration node, keyed by field ID rather than column name. Switching between a test and a live table is a one-line change, and renaming a column does not break the mapping.
Nothing is silently dropped: unmapped questions are preserved in notes, and leads from forms not yet linked to a campaign are flagged for someone to link rather than discarded.
Have a process like this?
Tell us what it looks like today. We will say whether this approach would work for you.