Why Signed Documents Still Appear Pending in Your CRM
A customer finishes signing an agreement on their phone, but your database or CRM continues to display the envelope as pending signature. In other scenarios, an identical webhook notification triggers twice, generating duplicate customer welcome emails or charging an invoice twice. These common integration bugs happen when webhooks are treated as simple synchronous triggers rather than distributed, asynchronous event streams.
Building reliable e-signature webhook infrastructure requires handling retries, transient network timeouts, out-of-order event delivery, and downstream processing failures. It also requires automated background reconciliation to detect and heal state discrepancies between your application and the signing platform.
Core Reasons E-Signature Webhooks Fail
- Synchronous bottleneck: Endpoints attempt heavy PDF generation or third-party CRM updates before responding, exceeding the provider's 5-second timeout window.
- Lack of idempotency: Duplicate webhook deliveries trigger multiple side effects because the handler lacks unique event tracking.
- Out-of-order delivery: A
signature_request.sentevent arrives after asignature_request.completedevent, erroneously resetting a finalized contract to pending. - Premature HTTP 200 acknowledgment: Server returns HTTP 200 before persisting the event payload to durable storage, losing the update during a container crash.
- Missing fallback polling: No background reconciliation runs to catch webhooks blocked by corporate firewalls or DNS resolution failures.
A Robust 6-Stage Webhook Ingestion Pipeline
1. Verify Request Authenticity
Validate incoming requests using the provider's documented verification method. Verify cryptographic hash signatures or bearer secrets against raw request bodies before inspecting payload parameters. Reject unverified requests with HTTP 401 Unauthorized.
2. Persist Before Acknowledging
Write the raw webhook payload immediately into a durable message queue (such as Redis Streams, RabbitMQ, SQS, or a transactional database table). Do not trigger CRM updates, email notifications, or PDF downloads during the initial HTTP request cycle.
3. Return Fast HTTP 200 OK Responses
Once the event is safely committed to durable storage, immediately respond with HTTP 200 OK. Keeping ingestion response times below 200 milliseconds prevents upstream timeout retries and protects server concurrency.
4. Implement Idempotent Event Handlers & Database Schemas
Use a database uniqueness constraint on the provider's event ID so duplicate retries exit cleanly without repeating downstream actions. Store the provider's request identifier against your internal business record (`provider_request_id` mapped to `business_record_id`, `status`, `completed_at`, and `last_event_at`), alongside a dedicated webhook ledger table:
| Ledger Column | Purpose in Idempotent Processing |
|---|---|
provider_event_id |
Unique constraint preventing duplicate processing of retried deliveries |
provider_request_id |
Correlates incoming webhook events to the stored signature request |
event_type |
Event label (for example sent, signed, completed, declined) |
received_at / processed_at |
Ingestion and worker completion timestamps for latency and retry auditing |
processing_status |
Queue state (pending, processed, or failed) |
5. Guard Against Out-of-Order State Regressions
Enforce strict monotonic state transitions. For example, once an envelope status transitions to completed or declined, older incoming events (such as viewed or reminded) must never downgrade the status back to an earlier lifecycle stage.
6. Run Scheduled Reconciliation Jobs
Webhooks are best-effort delivery mechanisms. Run a cron job every few hours to query the signing API for envelopes that have remained in a pending state beyond their normal turnaround time, repairing any dropped events automatically.
Webhook Response and Error Handling Standards
| HTTP Status Code | System Condition | Provider Retry Behavior |
|---|---|---|
200 OK |
Payload validated and safely committed to queue | Delivery recorded as successful; no further retries |
401 Unauthorized |
Signature verification failed or secret mismatch | Permanent failure; delivery aborted |
422 Unprocessable |
Malformed JSON or unsupported event structure | Logged as payload error; routed to dead-letter queue |
500 / 503 Server Error |
Database or message broker temporarily unreachable | Exponential backoff retry (e.g., 5m, 15m, 1h, 6h, 24h) |
How UnderSign Supports Webhook Automation
UnderSign provides clean REST APIs and event-driven webhooks for signature workflows. Developers can listen for envelope lifecycle updates, download finalized PDF packages with cryptographic audit trails, and synchronize contract statuses with internal databases reliably.
Developer Implementation Checklist
- Is payload signature verification performed on raw, unparsed request bodies?
- Does the endpoint respond with HTTP 200 in under 200 milliseconds?
- Are event IDs stored in a unique index to enforce idempotency?
- Does a state machine prevent out-of-order event regressions?
- Is a periodic reconciliation worker configured to poll active signing requests?
Frequently Asked Questions
Should a webhook endpoint process business logic before returning HTTP 200?
No. Webhook endpoints should validate and durably queue the event payload, then immediately return HTTP 200 OK. Business actions such as CRM sync, document indexing, and notifications should execute asynchronously in a background worker.
How do you prevent duplicate webhook processing during network retries?
Store each event ID in a persistent database table with a unique index. Before executing side effects, check whether the event ID has already been marked as processed. If it has, exit immediately with a success acknowledgment.
Are webhooks alone sufficient to guarantee data synchronization?
No. While webhooks provide real-time updates, networks can drop packets and endpoints can experience downtime. A reliable architecture pairs webhooks with a scheduled reconciliation worker that queries the signing API for status updates.