feat(ads): add click-to-whatsapp ads conversion tracking and analytics - #943
Merged
Conversation
viethung0o0
force-pushed
the
feat/ctwa
branch
2 times, most recently
from
August 13, 2026 04:30
875e194 to
90d1a79
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds end-to-end Click-to-WhatsApp Ads (CTWA) conversion tracking:
hasCapiScope,datasetIdcached on the integration).referral.ctwaClidon ContactInbox) are forwarded to Meta via the Conversions API with dedup and per-status tracking (pending/sent/failed/skipped).ads-conversionqueue and worker handling trigger evaluation, CAPI dispatch, and audience sync, guarded bywithBlockedOwnerGuard.AdsConversionRule/AdsConversionEventtables shipped as a single squashed, idempotent migration (guarded withIF NOT EXISTS, so environments that already ran the pre-squash migrations re-apply it as a no-op).Test plan
pnpm lintpassescheck-typespasses forbuilder,worker,@chatbotx.io/database,@chatbotx.io/businessUpdate — contact-filter segments & analytics locale fix
Update — WhatsApp broadcast retarget (exact segment)
The per-ad "Retarget → Send WhatsApp broadcast" menu now deep-links into the broadcast create page with the WhatsApp channel + integration preselected and the audience prefilled to exactly that ad's segment (conversations / qualified leads / purchases) over the selected date range — the same recipient set as the Facebook custom-audience path. The user only picks a template.
ctwaRetargetcontact-filter condition resolves the segment as a single correlatedEXISTS, reusing the Facebook export's segment predicates (one source of truth) and scoped by ad, date range, WhatsApp integration, and workspace.