AI Help
How do I avoid processing the same AI completion webhook twice?
Verify the webhook, atomically claim its event ID and persist processing state so repeated deliveries do not repeat the business action.
Steps to follow
- Validate the signature using the provider's documented method before trusting event fields.
- Store a unique event ID with processing status in durable storage. An atomic insert or equivalent claim prevents concurrent duplicate handling.
- Make downstream operations idempotent and reconcile interrupted processing before retrying. Return the provider's expected acknowledgment promptly.
Example in practice
Illustrative example. Two deliveries of one completion event create one report-delivery job and one tracked completion outcome.
Related AI help
- How do I retry only failed requests from an AI Batch API job?
- How do I verify that an AI webhook event came from my provider?