Reliable Business Integrations: Handling Failures and Duplicates
Build reliable CRM, accounting and stock integrations with clear data ownership, duplicate protection, retries, monitoring and recovery.
The first successful sync is a demonstration. A reliable integration also handles the second delivery of the same event, an unavailable provider and a record that someone changed in both systems.
When connecting your CRM, accounting platform, store or internal software, agree how failures will be detected and recovered before launch. These behaviours often matter more to daily operations than the connector's feature list.
Decide which system owns each field
Avoid the vague requirement that two systems should stay in sync. Write down the direction of each important data flow and the system allowed to change it.
For example, the CRM might own a customer's contact name while the accounting system owns invoice status. A warehouse might own available stock while the store owns product descriptions. Define what happens when an update conflicts with a manual correction.
Use stable record identifiers to match records. Names and email addresses can change, and different customers can share similar details. Keep the mapping between systems explicit so a rename does not accidentally create a new customer.
Make repeated delivery safe
Webhook and queue systems can deliver an event more than once. Twilio, for example, documents retries and duplicate delivery in its event delivery guidance. Design for the guarantees of each actual provider.
An operation is idempotent when repeating it has the same intended effect as doing it once. For a business workflow, that means a repeated order notification should not produce another dispatch or invoice.
Store a durable event identifier and processing state. Enforce uniqueness at the data layer where possible, so two workers cannot both decide an event is new. Do not mark the task complete before the business operation has actually succeeded.
Retry the right failures
A temporary connection problem may deserve another attempt. Invalid credentials, missing required fields or an unsupported operation usually need a correction first.
Use bounded retries with increasing delays, respect the provider's rate-limit rules and send persistent failures to a visible review queue. Repeating the same bad request indefinitely makes diagnosis harder and may consume usage allowances.
Also consider ordering. If an older stock update arrives after a newer one, blindly applying both can undo the correct value. Compare versions or retrieve the current authoritative record when the provider's event model requires it.
Monitor business outcomes
A green server status does not confirm that all invoices arrived. Track outcomes meaningful to the team using the integration:
- The age of the oldest unprocessed event.
- Failed records awaiting a decision.
- The last successful sync for each connection.
- Differences between expected and completed record counts.
- Repeated failures involving the same record or field.
Give each alert an owner and a next action. Keep sensitive payloads out of general-purpose logs and restrict access to the information needed for investigation.
Provide a safe recovery path
A person handling an exception should be able to see what happened, correct the cause and retry the specific operation. Replaying everything from the start can create additional problems if some steps already succeeded.
For a multi-step workflow, record completed steps and define compensating actions where appropriate. If the invoice exists but the CRM update failed, the recovery should update the CRM without issuing another invoice.
Run reconciliation separately from event delivery. A periodic comparison can identify missed events, drift or manual changes that the normal event stream did not resolve.
Test the awkward cases before handover
Ask the delivery team to demonstrate a duplicate event, a provider outage, expired credentials and a malformed record. Include two updates to the same record arriving close together. Confirm that the operating guide explains both recovery and escalation.
Our introductory API and integration guide covers when to connect systems. Our system integration services address the design, implementation and operational detail. Describe the handoff causing problems, including what staff do when it fails today.