Your CRM request timed out. Should your workflow retry?
lead submits a form. Your workflow sends the contact to the CRM. The request times out.
Did the CRM reject it? Did it save the contact before the connection dropped? Did your workflow lose the response?
From the workflow’s perspective, those situations can look identical. Retrying immediately might fix the problem. It might also create a duplicate record and send the sales team another notification.
This is where a simple automation starts needing an explicit recovery policy.
Separate the event from the contact
Suppose a form submission looks like this:
{
"event_id": "form-demo-0042",
"email": "alex@example.com",
"territory": "APAC"
}
The email helps identify the contact. The event ID identifies this particular submission.
Those serve different purposes. Someone can legitimately submit two different requests using the same email. Deduplicating everything by email could discard the second request. Treating every webhook delivery as new could process the first request repeatedly.
Use a stable event ID supplied by the source, or generate one at ingestion and preserve it through retries.
Give “unknown” its own state
A useful event record might contain:
{
"event_id": "form-demo-0042",
"crm_state": "confirmed",
"crm_record_id": "example-contact-123",
"notification_state": "unknown"
}
Here, the contact write succeeded. The notification outcome is uncertain.
Restarting the entire workflow would repeat work that already succeeded. The next step should investigate the notification, not touch the contact again.
A small decision function makes that distinction explicit:
def next_action(crm_state, notification_state):
if crm_state == "unknown":
return "reconcile_crm"
if crm_state != "confirmed": return "hold" if notification_state == "confirmed": return "done" if notification_state == "unknown": return "reconcile_notification" if notification_state == "not_started": return "notify" return "hold" This deliberately does not execute a retry. It decides which recovery path is appropriate.
“Reconcile” means checking the available evidence: the saved destination record ID, the event ledger, or a destination-supported operation lookup. If you still cannot determine the outcome, hold the event for review.
An arbitrary Idempotency-Key header is not enough. The destination must actually support and enforce it.
Test the awkward cases first
The happy path is easy to demonstrate. These cases tell you more about the recovery design:
assert next_action("unknown", "not_started") == "reconcile_crm"
assert next_action("confirmed", "unknown") == "reconcile_notification"
assert next_action("confirmed", "not_started") == "notify"
assert next_action("confirmed", "confirmed") == "done"
assert next_action("pending", "not_started") == "hold"
These tests check the decision function only. They do not prove that a real CRM or notification integration behaves correctly.
For integration testing, use synthetic records and simulate a timeout after the destination accepts a write. Also submit the same event concurrently. Two workers can both pass a “have I seen this before?” check unless claiming the event is atomic.
The database matters too
In a real implementation, store the event ledger durably. Give the event ID a uniqueness constraint and make claiming work atomic, so two workers cannot both claim the same event.
That still does not make a database update and an external API call one transaction. A worker can crash after the external write succeeds but before it records success locally. You still need the reconciliation path.
For internal alerts, record notification delivery separately. Keep logs useful without copying full lead payloads into every error message.
Applying this to n8n
The same design works as explicit branches in an n8n workflow: validate the submission, claim the event, resolve the contact, perform the approved write, record its outcome, and handle notifications separately.
The visual workflow should make uncertain outcomes visible rather than silently feeding them back into the create-contact step.
For the surrounding setup and mapping checklist, see our n8n and HubSpot lead-routing guide. It’s an implementation blueprint, not a production-tested downloadable workflow.
Before enabling retries, answer one question: what evidence will tell us whether the previous attempt already worked?
原文:https://www.a8q9.cn/en/article/your-crm-request-timed-out-should-your-workflow-retry-a31160.html