Webhook and idempotency patterns for FotoFit API integrations
Network failures create uncertainty: a client may time out after FotoFit accepted a request. Safe integrations use one idempotency identity for the same logical operation and treat every webhook as signed, retryable input.
Create an operation identity before the request
Generate or derive an idempotency key from the business operation, store it with your internal record and reuse it when retrying that same request. Do not use a new key merely because the HTTP client timed out.
Store job references
Persist the FotoFit job identifier returned by the API. Your application can then reconcile webhook events, status reads and user-visible progress against the same operation.
Verify before processing
- Read the raw request body required by the signature contract.
- Verify the signature with the configured webhook secret.
- Reject invalid or stale deliveries.
- Deduplicate repeated events.
- Acknowledge only after durable receipt.
Do not assume event order
Retries and network delays can reorder deliveries. Apply state transitions conditionally and make event handling safe to run more than once.