Define what an incoming event must prove before an AI workflow reads it. Use a provider-specific admission record and negative tests to keep authentication, retries and business approval separate.
A document-review event arrives with an account ID, a file reference and a note asking for urgent approval. The JSON looks plausible. That does not establish who sent it, whether its bytes changed, or whether the account belongs to the workflow receiving it.
AI webhook verification belongs before the model call. An integration receiver should authenticate the request using the source provider’s documented protocol. Deterministic checks then decide whether the verified event may enter a particular business workflow. AI can interpret permitted content afterward; it should not decide whether a signature is valid.
The design below is a recommended acceptance contract for automation owners and integration engineers. It is not a universal verifier implementation. Use the provider’s maintained verification library where available and test the actual receiver, proxy, storage and worker together.
Separate four questions that look like one trust check
- Authentication and integrity: Does the request pass the expected provider signing protocol for this endpoint?
- Admission: Is this account, environment, event type and record within the configured workflow scope?
- Duplicate handling: Has this admitted event already started work, and what durable outcome exists?
- Action authorization: May the proposed business change happen now, with this evidence and approval?
A signature does not answer all four. An authentic event can be a retry, refer to an unexpected account, contain hostile user-written text, or describe an outdated business state. Do not promote its free-text instructions into system policy.
The broader AI webhook automation guide explains the event-to-workflow architecture. This article specifies the narrower receiver boundary: the evidence required before that architecture starts interpreting content.
Write one verification contract for each provider route
Record the endpoint, provider, environment, expected account mapping, signing protocol, verifier version and approved key-reference source. The route configuration—not a payload field requesting a different verifier—should determine which protocol runs.
Preserve what was actually signed
Stripe’s verification troubleshooting guidance requires the raw request body, signature header and endpoint secret. Parsing and reserializing a JSON object can change the bytes. Verify the provider-defined representation before transforming it into your internal event format.
Put size and resource limits at ingress. Ensure the real proxy and framework preserve the signed inputs. Do not let a parser, character conversion or middleware silently become part of an undocumented verification recipe.
Do not transplant another provider’s freshness rule
Slack’s request-verification guide includes a timestamp in the signed input and demonstrates a five-minute clock-difference check. GitHub’s validation guide instead documents its HMAC-SHA256 payload check through X-Hub-Signature-256 and secure comparison.
Implement the actual protocol, including supported versions, encoding and comparison behavior. Do not invent a timestamp check for a scheme that does not authenticate one. When freshness is not established by the provider’s signature protocol, document the residual replay risk and the additional controls your implementation requires.
For timestamped schemes, test stale and future-dated requests as the provider specifies. Clock health is an operational dependency, not a reason to turn verification off during an incident.
Keep admission evidence outside the model’s control
Use a system-owned evidence envelope linked to the admitted event. The following fields are a proposed design, not a standard imposed by every provider.
| Record | What to retain | What it must not imply |
|---|---|---|
| Receiver identity | Endpoint, provider, environment and internal receive time | A payload cannot choose its own trusted route |
| Verification finding | Pass/fail/unavailable, verifier version, key reference and reason code | Never store the signing secret in the event or AI prompt |
| Input binding | Digest of verified bytes and access-controlled evidence reference when retained | A digest alone is not sender authentication |
| Admission scope | Verified account mapping, tenant, permitted type and schema result | Authentication is not permission to access any tenant |
| Event identity | Provider event identifier, its provenance and durable inbox reference | A claimed delivery ID is not an independent signature |
| Disposition | Rejected, admitted, duplicate, held or completed; owner and linked outcome | Receipt is not successful business execution |
Keep retained raw content access-controlled and subject to an explicit retention policy. Routine logs need reason codes and references, not secrets or unrestricted copies of confidential documents. Give the AI only the minimum permitted business fields and a read-only reference to the system finding; it cannot rewrite that finding.
Make the receiver’s state transitions explicit
- Received → rejected or verification unavailable. Missing, malformed or invalid authentication stops admission. A key service or verifier outage also blocks admission, but needs a different operational reason from an invalid signature. Do not send either case to AI to decide whether it looks legitimate.
- Verified → scope checked. Validate the event schema and allowed type. Bind the account and business record to configured tenant ownership. Unknown mappings go to the integration owner without exposing another tenant’s context.
- Scope checked → durably admitted or duplicate. Claim the provider-scoped event identity in shared durable storage. Concurrent deliveries must not both create work. A prior failed worker is recoverable existing work, not a fresh event.
- Admitted → interpreted. A worker retrieves only authorized context. AI may summarize the document-review request and propose a category. Rules validate its structured output; missing context, invalid output or unresolved ambiguity leads to a named review queue.
- Interpreted → reviewed → executed or rejected. A human decides consequential approvals. The executor checks current record state and authority, preserves the operation identity and records the downstream outcome.
Design acknowledgment around the provider’s documented response contract. In this proposed asynchronous design, acknowledge accepted work only after its durable admission record exists; do not wait for an LLM. If storage is unavailable, do not claim successful admission. Specify a provider-supported retry or source-reconciliation path rather than assuming every sender retries automatically.
Use a transaction or equivalent reliable handoff between the inbox and worker queue so a crash cannot leave an accepted event permanently unprocessed. For downstream writes, apply the separate AI workflow idempotency model; suppressing an incoming duplicate does not prove that a later business effect happened only once.
Walk a document-review event through failure and recovery
Illustrative example: an external document service sends a completion event for a review packet. The receiver verifies the request, confirms the service account maps to the expected tenant, checks the allowed event type and records the event in its durable inbox.
The worker reads the permitted packet and asks AI for a summary and missing-information list. It does not accept “approve immediately” inside the packet as authority. A reviewer sees the original evidence, model proposal and unresolved requirements before deciding whether the business request advances.
A second delivery returns the existing admission disposition. If the first worker failed before interpretation, recovery resumes that same record. If an external action timed out after dispatch, the executor reconciles its original operation before retrying. If the reviewer rejects the request, closure records that rejection—not a successful approval.
Stripe’s webhook documentation illustrates why attempts and events differ: retries receive a new timestamp and signature, and event IDs help detect duplicate receipts. The signature value is therefore not a stable business-work key.
GitHub’s webhook best practices note that a requested redelivery retains the original delivery ID. Verify each delivery, then apply the documented event identity and your durable processing state. Do not confuse “seen” with “completed.”
Use negative tests as the release evidence
Run these tests against a controlled nonproduction receiver with synthetic content and provider-supported fixtures. This is a recommended acceptance matrix, not a claim that any implementation has passed it.
| Fixture | Required observed outcome | Accountable owner |
|---|---|---|
| Valid baseline and wrong endpoint key | Baseline admitted; wrong-key request never reaches AI | Integration engineer |
| One changed body byte or transformed JSON | Signature check fails; no model or business action | Receiver owner |
| Stale/future signed timestamp, where applicable | Documented freshness policy enforced; clock failure distinguishable | Platform owner |
| Valid signature, unknown tenant or disallowed type | No unrelated context retrieved; explicit scope disposition | Workflow owner |
| Concurrent duplicate and retry after worker failure | One durable event; existing work resumes without a second effect | Queue/execution owner |
| Inbox unavailable or crash during queue handoff | No false admission success; documented recovery finds the work | Platform owner |
| Valid event with hostile document instructions | Content cannot alter trust, tenant binding or action permissions | AI/security owner |
| Key rotation and historical internal replay | Only policy-allowed keys accepted; internal replay remains traceable and authorized | Security/integration owner |
Internal replay should use the original admission evidence and an authorized replay record, not impersonate a newly received external request. Do not disable signature or freshness checks on the public endpoint to make old stored requests pass. Key rotation, verifier upgrades and middleware changes should trigger the relevant regression fixtures.
Track authentication failures by reason over received attempts, verification-unavailable cases over attempts, duplicate admissions over verified events, and admitted records without a terminal disposition over admitted records. Separately measure unauthorized model calls and duplicate business effects in the test suite. Define retention windows and denominators; a low rejection rate alone does not show that verification works.
Where Workhint fits
Workhint’s Workflow Engine describes configurable approval routing and required information before work advances. That is relevant to specifying the owner and evidence needed for an operational review after your receiver has established event trust.
The Workflow Automation Software solution describes structured intake, conditional routing, stages and assigned reviewers. These pages support a discussion about the human and workflow handoff. They do not establish native webhook-signature verification, a specific provider connector, signing-key custody or the durable-inbox guarantees proposed here; validate those implementation requirements separately.
Frequently asked questions
Can AI decide whether a webhook is authentic?
Not as the authentication gate. Use deterministic verification of the provider-defined signed inputs. A model can summarize admitted business content; plausibility is not cryptographic evidence.
Does a valid signature make the payload safe to follow?
No. It does not grant business authority to embedded instructions. Tenant checks, permitted context, output validation and action approval remain separate controls.
Should a duplicate event always be discarded?
It should not start independent work. Return or resume the existing durable processing state as your contract permits. A previously admitted but unfinished event still needs recovery and an accountable outcome.
What should block release?
Block release when invalid requests can reach AI, tenant binding is ambiguous, accepted events can disappear, duplicate delivery can create a second effect, or verifier outages silently bypass authentication. Preserve the failing evidence and assign the correction before enabling that route.

Leave a Reply