Skip to main content
Webhooks allow your application to receive real-time notifications when events occur in StateSet, eliminating the need for polling.

Overview

StateSet webhooks provide real-time event notifications delivered via HTTPS POST requests to your configured endpoints. Each webhook payload includes comprehensive event data and is secured with HMAC signatures.

Key Features

  • 🔄 Automatic retries with exponential backoff
  • 🔐 Secure signatures using HMAC-SHA256
  • 📊 Event versioning for backward compatibility
  • 🎯 Granular event selection - subscribe only to events you need
  • 📝 Detailed payloads with full resource data
  • 🔍 Event replay for missed or failed deliveries

Setting Up Webhooks

1

Create Webhook Endpoint

Navigate to Dashboard → Settings → Webhooks and click Add Endpoint
2

Configure Endpoint

  • Enter your HTTPS endpoint URL
  • Select events to subscribe to
  • Copy the signing secret for verification
3

Implement Handler

Create an endpoint that:
  • Accepts POST requests
  • Verifies signatures
  • Processes events asynchronously
  • Returns 2xx status quickly
4

Test Integration

Use the webhook simulator to send test events and verify your implementation

Webhook Security

Signature Verification

All webhooks include a Stateset-Signature header for verification:

Security Best Practices

Critical Security Requirements:
  • Always verify webhook signatures
  • Use HTTPS endpoints only
  • Store signing secrets securely
  • Implement idempotency to handle duplicate events
  • Process events asynchronously to avoid timeouts

Webhook Payload Structure

All webhook events follow a consistent structure:

Payload Fields

Event Types

Order Events

Triggered when: A new order is created
Triggered when: Order details are modified
Triggered when: Order is cancelled
Triggered when: Order fulfillment is complete

Return Events

Triggered when: Return is initiated
Triggered when: Return is approved
Triggered when: Returned items are received

Customer Events

Triggered when: New customer registers
Triggered when: Customer profile is updated

Inventory Events

Triggered when: Stock falls below threshold
Triggered when: Item goes out of stock

Handling Webhooks

Best Practices Implementation

Idempotency

Ensure your webhook handler is idempotent to safely handle duplicate deliveries:

Retry Logic

StateSet automatically retries failed webhook deliveries with exponential backoff:

Retry Schedule

After 8 failed attempts, the webhook is marked as failed and won’t be retried automatically.

Handling Failures

Your endpoint should:
  • Return 2xx status for successful processing
  • Return 4xx for permanent failures (won’t retry)
  • Return 5xx for temporary failures (will retry)

Testing Webhooks

Webhook Simulator

Test your webhook endpoint using our simulator:

Local Development

Use ngrok or similar tools to test webhooks locally:

Test Event Payloads

Webhook Management API

Programmatically manage webhooks:

Monitoring and Debugging

Webhook Logs

View webhook delivery attempts in the dashboard:

Metrics and Alerts

Monitor webhook health:

FAQ

Events may arrive out of order. Use the created timestamp and resource state to handle this:
StateSet will retry failed deliveries for up to 3 days with exponential backoff. You can also:
  • Manually retry failed events from the dashboard
  • Use the Event API to fetch missed events
  • Implement webhook replay for recovery
Yes, you can configure webhook endpoints to filter events based on metadata:
Use our test signature generator:

Need help? Contact api-support@stateset.com or visit our Discord community.