Daily Salesforce lead hygiene with RocketReach enrichment

By General Input

Every morning at 5am, find Salesforce leads missing email, phone, or title, fill in the gaps from RocketReach, and mark each row enriched so it never gets touched twice.

Integrations

  • Salesforce
  • RocketReach

Type

Deterministic Code

Categories

  • Sales
  • Operations

Build me a deterministic daily lead-hygiene workflow that fills in missing contact data on Salesforce leads using RocketReach. This should be a code workflow (discrete nodes, no agent reasoning) because the inputs and outputs are fully known.

Trigger: cron, every day at 5:00am in my org's timezone.

Step 1. Call Salesforce Get Many Leads with a SOQL filter that returns leads created or modified in the last 24 hours where Email IS NULL OR Phone IS NULL OR Title IS NULL, and where the custom field enrichment_status is NULL (so we never re-process rows we already touched). Select at minimum Id, FirstName, LastName, Email, Phone, Title, Company, LinkedIn URL (or whatever custom LinkedIn field exists on the Lead object), and enrichment_status. Cap the result set at 200 leads per execution to stay inside RocketReach's 5 requests-per-second soft limit.

Step 2. For each returned lead, call RocketReach Person Lookup with whatever identifier is available, in this priority order: (a) LinkedIn URL if present, (b) full name plus Company, (c) the partial email. Use lookup_type=enrich first to try cached data without consuming a fresh credit; if that returns no result, fall back to lookup_type=standard. Honor the rate limit by spacing requests (5 per second max) and respect the Retry-After header on any 429 response.

Step 3. For each lead where RocketReach returns a match, call Salesforce Update Lead and write back: email (only if the Salesforce Email field is currently blank), mobile_phone into Phone (only if blank), current_title into Title (only if blank), linkedin_url into the LinkedIn custom field (only if blank), and current_employer into a notes or custom field. Also set enrichment_status to "enriched" and stamp a timestamp field (enrichment_completed_at) with the current time.

Step 4. For each lead where RocketReach returns no match, call Salesforce Update Lead and set enrichment_status to "not_found" with the same timestamp. This guard prevents the workflow from re-attempting the same dead-end lookup tomorrow.

Step 5. Exit cleanly with a single log line summarizing the run: how many leads were scanned, how many were enriched, how many had no match, and how many RocketReach lookup credits were consumed.

Important constraints: never overwrite a non-empty field on the Salesforce lead. Never call RocketReach for a lead that already has a non-null enrichment_status. If RocketReach returns a 401 or 403, fail fast and surface the error. If Salesforce returns REQUEST_LIMIT_EXCEEDED on the update step, stop processing the remaining batch and log how far we got.

Related prompts

Explore more prompts
A website visitor queue that remembers what you hidePipeline review board for deals where the buyer went quietGive every rep a Clay prospecting desk without a Clay seatOne review board for every household in your book of businessMonthly Salesforce contact refresh on open pipeline with ClayPush Databricks churn risk scores into Salesforce every morningDaily Salesloft meeting prep briefs in your inbox at 7amSync new Chargebee subscriptions into Salesforce CRMLog Aircall tags to Salesforce and draft the follow-up email in GmailStand up Addepar households from every closed-won Salesforce deal