Skip to main content

Overview

Webhooks let you receive real-time HTTP notifications when events occur in Offergrid, enabling immediate response to new orders and status changes.
Webhook functionality may be under development. Check with support for current availability and configuration options.

How Webhooks Work

  1. Configure endpoint: Tell Offergrid where to send notifications
  2. Event occurs: New order, status change, etc.
  3. Offergrid sends POST: HTTP POST to your endpoint
  4. You respond: Process the event and return 200 OK
  5. Retry on failure: Offergrid retries if your endpoint is down

Webhook Events

Provider Events

order.created
  • New order received from reseller
  • Includes order ID and item ID
  • Action: Review and accept/reject
order.cancelled
  • Reseller cancelled an order
  • Includes order ID and reason
  • Action: Stop fulfillment if in progress
offer.ordered (Future)
  • One of your offers was ordered
  • Includes offer ID and order details

Setting Up Webhooks

Configuration process may vary. Contact support for current webhook setup instructions.

Step 1: Create an Endpoint

Build an HTTPS endpoint to receive webhooks:

Step 2: Configure in Dashboard

  1. Go to SettingsWebhooks
  2. Click Add Webhook Endpoint
  3. Enter your endpoint URL
  4. Select which events to receive
  5. Save the webhook secret for signature verification

Step 3: Test the Connection

Send a test event to verify your endpoint works:
  1. Click Send Test Event in dashboard
  2. Check your endpoint received the event
  3. Verify signature validation works
  4. Confirm proper error handling

Webhook Payload Structure

Common Format

All webhooks follow this structure:

order.created Payload

order.cancelled Payload

Verifying Webhook Signatures

Always verify webhooks are from Offergrid:
Always verify signatures in production! This prevents attackers from sending fake webhooks to your endpoint.

Handling Webhooks

Respond Quickly

Return 200 OK within 5 seconds:

Handle Duplicates

You might receive the same webhook multiple times:

Implement Retry Logic

Handle temporary failures gracefully:

Testing Webhooks Locally

Use ngrok for Local Development

Send Test Events

Monitoring Webhooks

Log All Events

Track Metrics

Monitor:
  • Delivery rate: % of webhooks successfully received
  • Processing time: How long processing takes
  • Error rate: % of webhooks that fail processing
  • Retry rate: % of webhooks that need retries

Webhook Best Practices

Never process webhooks without verifying the signature. This prevents fake events.
Return 200 OK quickly. Process the event asynchronously in a background job.
Use idempotency keys to prevent processing the same event twice.
Handle temporary failures with exponential backoff. Alert on repeated failures.
Log all webhook events for debugging and auditing. Include timestamps and durations.
Track delivery rates, error rates, and processing times. Alert on anomalies.

Troubleshooting

Webhooks Not Arriving

  1. Check endpoint URL: Ensure URL is correct and publicly accessible
  2. Verify HTTPS: Endpoint must use HTTPS (not HTTP)
  3. Check firewall: Ensure your firewall allows incoming requests
  4. Review webhook settings: Confirm webhook is enabled for the event type

Signature Verification Fails

  1. Check webhook secret: Ensure using correct secret from dashboard
  2. Verify timestamp: Check x-offergrid-timestamp header exists
  3. Payload format: Ensure payload is parsed as raw JSON string

Webhooks Timing Out

  1. Respond faster: Return 200 OK before processing
  2. Use async processing: Queue events for background processing
  3. Optimize database: Ensure database queries are fast
  4. Scale horizontally: Add more webhook processing workers

Next Steps

API Integration

Learn about API integration patterns

Receiving Orders

Understanding order processing

Order Workflow

Order status lifecycle

API Reference

Complete API documentation