Cloudflare Worker Deployment
The LinkedIn + Meta offline conversion loop — dashboard-only, zero CLI, from a fresh account.
Deployment Steps
- 1.Workers & Pages → Create → Workers → Create Worker. Name it → Deploy (deploys a placeholder — expected).
- 2.Edit code → delete placeholder content → paste the complete Worker file → Save and deploy.
- 3.Create the KV namespace: Storage & Databases → KV → Create namespace → name it (e.g., conversion-sync-state) → Add. Leave it empty — the Worker populates it itself.
- 4.Back on the Worker → Settings → Bindings → Add binding → KV Namespace. Variable name must exactly match what the code expects (RATE_LIMIT_KV) → select the namespace just created → Deploy.
- 5.Settings → Variables and Secrets → Add, once for each required credential — verify the type dropdown shows "Secret," not "Text"/plain Variable, before saving each one (a real mistake made once in this build — an unencrypted token was visible in the dashboard listing). Required: GOOGLE_SERVICE_ACCOUNT_EMAIL, GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY, SHEET_ID, LINKEDIN_ACCESS_TOKEN, META_CAPI_TOKEN, BREVO_API_KEY (reuses the same key already used for transactional lead-verification email — not a new Brevo account), MANUAL_TRIGGER_KEY (a random string made up fresh, purely a shared secret for the manual test URL, not tied to any external service).
- 6.Triggers → Cron Triggers → Add Cron Trigger → pick a schedule (every 30-60 minutes is reasonable) → Save.
- 7.Test immediately, without waiting for the schedule: visit https://<worker-name>.<subdomain>.workers.dev/run?key=<your MANUAL_TRIGGER_KEY> in a browser — returns a JSON run summary directly on the page.
- 8.Check the Sheet for updated push-flags, and check the Worker’s Observability → Logs tab for FAILED, VERSION WARNING, or Failed to send ... alert email lines.
Brevo Alert Design Details
- 1.The rate-limit marker is written only after a successful send (not after every attempt) — if Brevo itself is temporarily down, the next scheduled run tries again rather than going silent for the rest of the day.
- 2.The system fails open on KV errors — proceeds as if today’s alert hasn’t been sent yet, rather than silently suppressing a real alert.
- 3.The sender address is a placeholder (updates@digitalasur.com) — confirm this matches your actual verified Brevo sending address before relying on it, since Brevo rejects sends from unverified addresses.
- 4.This alert is the actual, primary defense against API version drift — not manual periodic checking. It scans every LinkedIn/Meta API response for deprecation signals and emails a real alert the moment one appears, rate-limited to once per warning type per day.