DocuSign Connect Real-Time Sync
Using a DocuSign Connect webhook to an HTTP-triggered flow, the flow processes every envelope event in real time - sent, delivered, signed, completed, declined, voided - updates the linked record status, and routes the right follow-up per event. Gives low-latency, event-driven DocuSign integration.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow gives low-latency, event-driven DocuSign integration. A DocuSign Connect webhook POSTs every envelope lifecycle event (sent, delivered, completed, declined, voided) to an HTTP-triggered cloud flow. The flow authenticates the call, enriches it with the authoritative recipient state from DocuSign, routes the event through a Switch, and upserts a linked agreement record in Dataverse - keeping a system-of-record in real-time sync with DocuSign.
Why it matters: polling lags and misses transient states. A Connect webhook delivers each event immediately, so the linked record always reflects the current envelope status.
Ships Off (Stopped). Requires a DocuSign Connect subscription pointed at the flow URL.
Use Case
A team needs immediate reaction to every DocuSign envelope state change - updating the linked agreement record and routing the right follow-up per event - instead of polling DocuSign on a timer.
Flow Architecture
When a Connect Event Is Received
HTTP - When a HTTP request is receivedReceives the DocuSign Connect webhook POST; coalesces flat and nested data.envelopeSummary payload shapes.
Initialize Trace & Config
Initialize variableMints a guid() correlation id and binds the account, folder, HMAC key, event-action map, envelope id (idempotency key), and lowercased event status.
Verify Connect Signature
ConditionCaptures the X-DocuSign-Signature-1 header and gates processing; false branch responds 401.
Respond 202 Accepted
ResponseAcknowledges immediately so Connect does not time out, then processes asynchronously.
Enrich from DocuSign
DocuSign - GetRecipientStatusPulls the authoritative recipient list/status and extracts the primary signer.
Route by Event
SwitchRoutes sent/delivered/completed/declined/voided (plus default) to a follow-up label written to the record.
Upsert Agreement
Dataverse - ListRecords + Create/UpdateIdempotency lookup by envelope id, then updates the existing agreement row or creates a new one.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_ConnectHmacKey | String | REPLACE_WITH_KEYVAULT_HMAC_KEY | HMAC secret used to validate the DocuSign Connect signature. Source from Azure Key Vault in production. |
| flowlibs_AgreementTable | String | flowlibs_agreements | Entity set name of the linked agreement table (documentation). |
| flowlibs_EventActionMap | String | {"sent":"awaiting-recipient","delivered":"opened","completed":"fulfill-and-archive","declined":"escalate","voided":"close-record"} | JSON map of envelope event to follow-up action label. |
| flowlibs_DocuSignAccountId | String | 00000000-0000-0000-0000-000000000000 | DocuSign API account GUID for the enrichment call. |
| flowlibs_DocuSignFolderId | String | sentitems | DocuSign folder filter required by GetRecipientStatus. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| DocuSign | shared_docusign | GetRecipientStatus |
| HTTP | shared_http | When a HTTP request is received Response |
| Microsoft Dataverse | shared_commondataserviceforapps | ListRecords CreateRecord UpdateRecord |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Full HMAC validation
- Add an Azure Function that computes base64(HMAC-SHA256(rawBody, key)) and compare it to X-DocuSign-Signature-1 in the verify condition; source the key from Key Vault.
- Idempotency
- Already idempotent on envelope id (List then Update-or-Create). Add a guard on last-event-on to ignore out-of-order events.
- Dead-letter
- Route the Switch default case to a dead-letter table or a Teams alert instead of just labeling.
- Fan-out
- Replace per-event labels with child-flow calls (one per status) and propagate the correlation id for end-to-end tracing.
- Document archival
- On completed, call DocuSign GetDocuments to pull the signed PDF and store it in SharePoint/Dataverse.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Envelope id (robust)
Reads the envelope id across flat and nested payload shapes.
EXPR.02Event status (robust)
Normalizes the event status for the Switch.
EXPR.03Idempotency filter
Finds an existing agreement row for this envelope.
EXPR.04Existing-row gate
Update vs create decision.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.