A reliable CRM integration saves the website enquiry first, queues the CRM update, and retries temporary failures using the same external enquiry identifier. Amazon SQS can hold pending jobs, AWS Lambda can deliver them, and DynamoDB can record the state of each sync.
Consider a demo request submitted while the CRM is rate-limiting API calls. The website can still confirm receipt after saving the enquiry. The sales team needs a separate way to see whether the CRM has received it and to recover any lead that gets stuck.
Keep a durable record before adding the queue
Save the enquiry and a pending sync job together in DynamoDB. A dispatcher sends the job ID to SQS, and a Lambda worker loads the necessary enquiry fields when it processes the message.
Put only the identifiers needed for delivery in the queue message, such as enquiryId , destinationWorkspace , and revision . Keep the enquiry body and CRM credentials in their appropriate stores. A scheduled reconciliation can find pending jobs that were saved but never queued.
Job state | What it tells the team |
|---|
PENDING | The enquiry was saved and awaits delivery |
SYNCED | The CRM confirmed the expected record or update |
NEEDS_REVIEW | The job needs a data or configuration fix before replay |
Design for the timeout after a successful CRM write
Suppose the worker sends enquiry lead-1042 , the CRM creates the record, and the connection drops before the response reaches Lambda. SQS can deliver the job again. A second create request could produce a duplicate.
If the destination supports upsert by a unique external ID, use lead-1042 for both attempts. If it supports a request idempotency key, reuse the key for that operation. Where neither capability exists, treat ambiguous outcomes as a reconciliation case. A lookup followed by a create can still race if two workers handle the same job concurrently.
Handle later changes separately. If revision 3 updates the owner while revision 2 is waiting to retry, the older job should not overwrite the latest assignment. Use destination-side version checks when available, or serialize writes for each lead and reconcile against the current assignment.
Classify failures before retrying
- Rate limit or temporary outage. Retry with bounded backoff and follow any retry timing supplied by the CRM.
- Invalid field or missing required value. Record the reason and route the job for review.
- Expired credential or missing scope. Alert the integration owner. Replaying the same request will continue to fail until access is restored.
- Timeout after submission. Reuse the original external identifier and check the existing CRM record where needed.
If Lambda processes a batch from SQS, enable partial batch responses so a failed item can be reported without retrying the successfully processed items with it. Configure a dead-letter queue for messages that exhaust their receive attempts, and document how to fix and replay them using the original identifiers.
Test the journey from enquiry to sales inbox
Submit several synthetic enquiries, force one invalid payload and one temporary failure, and verify that healthy enquiries still reach the CRM. Then simulate a timeout after a successful CRM write and check that replay preserves a single record. Finally, compare the saved website enquiries against their CRM references. The oldest pending job and the number of unresolved failures are often more informative than a count of Lambda errors alone.
Loading article