AWS Builder Center
How to Reconcile Website Leads with Your CRM on AWS and Find Missing Enquiries by Submission ID

How to Reconcile Website Leads with Your CRM on AWS and Find Missing Enquiries by Submission ID

Compare saved website enquiries with CRM records using Amazon S3 and Athena. Find missing leads by submission ID, distinguish sync delays from errors, and recover enquiries without duplicating records.

Series: CRM (9 articles)

  1. …
  2. 7
    How to Reconcile Website Leads with Your CRM on AWS and Find Missing Enquiries by Submission ID This article
Love to Learn Tech especially AI things.
To find missing CRM leads, compare accepted website enquiries with CRM enquiry records using the same submission ID. A left join in Amazon Athena shows which submissions have no matching CRM record. Join the result to your latest sync status, then decide whether each gap is still pending, was rejected, or needs investigation. In this worked example, 100 accepted enquiries produce 97 confirmed CRM matches and three cases that need different actions.

Why comparing totals can send you in the wrong direction

Marketing sees 100 successful form submissions. Sales sees 97 enquiries in the CRM and asks whether three leads were lost. The counts flag a gap, but they cannot tell you which leads are involved or whether the numbers refer to the same population.
A CRM view might count contacts while the website counts submissions. One contact can send two distinct project enquiries, so that comparison can produce a gap even when the integration is working. Reports can also use different time zones, export windows, or rules for test and spam records.
Start with an explicit definition: one accepted website submission should map to one CRM enquiry, deal, or other agreed destination record. The destination object depends on how your CRM is set up. Keep a stable submission reference on that object or a durable mapping back to its CRM ID.

Prepare three inputs with a common cutoff

Export the minimum fields needed to compare records. Upload the extracts to restricted Amazon S3 locations and expose them to Athena as tables. Keep each run tied to a known snapshot time so the result can be reproduced later.
Dataset
One row represents
Essential fields
 website_enquiries 
One accepted website submission
 submission_id ,  captured_at ,  form_id 
 crm_enquiries 
One CRM enquiry record from the intended workspace
 external_submission_id ,  crm_record_id 
 crm_sync_events 
One sync event
 submission_id ,  event_sequence ,  sync_status ,  failure_code 
The website extract should contain success-confirmed leads and exclude test and known spam records under the agreed policy. The CRM extract must include the correct workspace and object type. If the CRM export filters by record creation time, give it enough coverage to include leads created after the final website capture date. A lead submitted late Sunday can legitimately land in the CRM on Monday.
Use the time the destination export is complete through as the cutoff for the reconciliation run. If the website extract is newer, exclude submissions outside that shared observation period. Mark the youngest included leads as within the normal delivery window, so a routine delay does not page the integration team.

Find gaps with an Athena query

The following example assumes the three tables are already scoped to the same workspace and reconciliation run. The website table has one row per submission. CRM IDs are counted distinctly so duplicate export rows for the same record do not appear as duplicate CRM objects.  event_sequence  is an integer that increases for each submission.
WITH crm_by_submission AS (
SELECT
external_submission_id AS submission_id,
COUNT(DISTINCT crm_record_id) AS crm_matches
FROM crm_enquiries
WHERE external_submission_id IS NOT NULL
AND external_submission_id <> ''
AND crm_record_id IS NOT NULL
GROUP BY external_submission_id
),
ranked_sync AS (
SELECT
submission_id,
sync_status,
failure_code,
ROW_NUMBER() OVER (
PARTITION BY submission_id
ORDER BY event_sequence DESC
) AS row_number
FROM crm_sync_events
)
SELECT
w.submission_id,
w.captured_at,
w.form_id,
COALESCE(c.crm_matches, 0) AS crm_matches,
s.sync_status,
s.failure_code
FROM website_enquiries w
LEFT JOIN crm_by_submission c
ON w.submission_id = c.submission_id
LEFT JOIN ranked_sync s
ON w.submission_id = s.submission_id
AND s.row_number = 1
WHERE COALESCE(c.crm_matches, 0) <> 1
ORDER BY w.captured_at, w.submission_id;
The query returns exceptions: submissions with zero CRM matches and submissions with more than one distinct CRM match. Include both because duplicate destination records can mask missing leads in a total. For instance, 100 website submissions and 100 CRM records can still contain one missing submission and one duplicate.
The latest sync status helps explain an exception. Treat it as a clue and trace the saved job and destination record before changing anything.

Work through 100 actual-looking submissions

Assume the website saved 100 unique accepted enquiries through the shared cutoff. The CRM export contains 97 distinct enquiry objects with matching external IDs and no duplicate matches. The query returns three rows:
Submission ID
Latest sync state
Investigation finding
Recovery step
 sub-063 
 PENDING 
The job is two minutes old and the agreed sync target is ten minutes
Let the queue process it. Recheck if the job exceeds ten minutes
 sub-087 
 REJECTED 
A website form sent an industry value the CRM mapping does not recognize
Correct the mapping, validate the transformed record, and replay with the original ID
 sub-094 
 ACKNOWLEDGED 
The worker reports success but the CRM export has no matching external ID
Look up the saved CRM record ID in the intended workspace and verify the field before replaying
The third case deserves care. If the CRM accepted the enquiry but the external ID was omitted, replaying a create request could add a second record. If you find the correct destination record, repair its external ID or mapping. If no matching record can be confirmed, follow the integration’s recovery policy and reuse the original submission ID when the CRM supports idempotent writes.
For the rejected lead, update the mapping centrally so future submissions stop failing for the same reason. Record what changed, which job was replayed, and whether the next reconciliation found one match.

Make the reconciliation report actionable

A daily report should show enough detail that the person on call can decide what to check next.
  • Match rate — accepted enquiries with exactly one confirmed CRM record divided by total accepted enquiries. This example starts at 97%.
  • Overdue pending — enquiries past the sync deadline with no confirmed CRM record.
  • Rejected — records awaiting a mapping, validation, or configuration fix.
  • Unmatched after acknowledgement — cases where the integration and destination evidence disagree.
  • Duplicate matches — submission IDs linked to more than one distinct CRM record.
  • Snapshot freshness — the effective cutoff and the age of the destination extract.
Always check destination freshness before creating alerts. If a scheduled CRM export fails and the pipeline reads yesterday’s snapshot, many valid submissions can appear missing at once. Mark that run as incomplete or stale so it does not send the team into unnecessary replays.

Test failure cases before trusting the numbers

  1. Late sync — Save an enquiry just before the cutoff and let it arrive after the first export. Confirm it appears as pending and then matches on the next run.
  1. Timeout after a successful write — Simulate a CRM write that succeeds while the worker loses the response. Verify that the original ID lets the team confirm the existing record before replaying.
  1. Duplicate CRM records — Create two synthetic CRM records with the same external ID. Verify that the query returns one exception with two matches.
  1. Two enquiries from the same person — Give each submission a different ID. Both should match their own enquiry even if the CRM associates them with the same contact.
  1. Stale or wrong workspace export — Run the report against an intentionally incomplete snapshot. The freshness and scope checks should fail before the team acts on the gaps.

Frequently asked questions

Can I match a website enquiry to the CRM by email? Email can help a reviewer investigate, but one person may submit several enquiries and teams sometimes share inboxes. Use the submission ID for the automated match and use approved identity data only where review needs it.
Should I replay every lead with zero matches? Check the delivery deadline, last failure, CRM lookup, and snapshot freshness first. A pending job might only need time. A rejected job may need a mapping fix. An acknowledged write may already exist and need a corrected reference.
What should the report show after a recovery? Rerun the reconciliation for the same submission IDs against a fresh CRM snapshot. Each recovered enquiry should have exactly one destination record. Keep the original failure and recovery outcome available for the next time the same pattern appears.
The query is an illustrative Athena example. Adapt table definitions, workspace scope, snapshot handling, and retry rules to your integration before using the exception list for live recovery.

Series: CRM (9 articles)

  1. …
  2. 7
    How to Reconcile Website Leads with Your CRM on AWS and Find Missing Enquiries by Submission ID This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article