Callback Configuration
Configure webhooks for real-time event notifications and system integration
Callback Configuration API
The Callbacks API manages webhook subscriptions for real-time event notifications from MasonHub. Register callback URLs to receive immediate notifications when events occur in the system, enabling responsive integrations and real-time data synchronization.
All callback URLs must use HTTPS for security. Configure verification tokens for enhanced authentication.
Core Operations
Get Callback URLs
Retrieve configured webhook subscriptions and their status information.
Filter by message type or “all” for all types
Query Parameters
Parameter | Type | Description | Default |
---|---|---|---|
message_type | string | Filter by message type or “all" | "all” |
Create Callback URLs
Register webhook endpoints for real-time event notifications.
HTTPS webhook endpoint URL
Event type to subscribe to (e.g., “skuInventoryChange”, “orderEvent”)
API version for callbacks (currently “1.0”)
Optional verification token for enhanced security
“message_type”: “orderEvent”, “status”: “active” } ] }
Available Event Types
Inventory Events
skuInventoryChange: Real-time inventory level updates
snapshotReady: Bulk inventory snapshot completion
Order Events
orderEvent: Order status changes and fulfillment
orderUpdateResolution: Update request results
orderCancelResolution: Cancel request results
Fulfillment Events
inboundShipmentEvent: Receiving status updates
shipmentEvent: Outbound shipping notifications
Returns & Quality
rmaEvent: Return merchandise authorization updates
qualityEvent: Quality control status changes
Security & Authentication
HTTPS Requirement
All callback URLs must use HTTPS. HTTP URLs will be rejected for security reasons.
Verification Tokens
Enhance security with verification tokens:
Tokens are included in callback payloads for verification.
Request Headers
MasonHub callback requests include identifying headers:
Callback Payload Format
All callbacks use a consistent structure:
Delivery Guarantees
Reliability Features
At-least-once Delivery
Events may be delivered multiple times - design idempotent handlers
Retry Logic
Failed deliveries are retried with exponential backoff
Timeout Handling
Requests timeout after 30 seconds
Error Logging
Delivery failures are logged for troubleshooting
Response Requirements
Your webhook endpoints must:
HTTP 200 Response
Return HTTP 200 status for successful processing
Quick Response
Respond within 30 seconds to avoid timeouts
Idempotent Processing
Handle duplicate events gracefully using message_id
Error Handling
Return appropriate HTTP status codes for different scenarios
Callback Management
Callback Holds
Temporarily suspend callback delivery when needed:
List current callback holds by message type.
Use Cases for Holds
Implementation Examples
Python Flask Webhook
Node.js Express Webhook
Testing & Development
Sandbox Environment
Test callbacks in the sandbox environment:
Sandbox Base URL
https://sandbox.masonhub.co/{account}/api/v1/callbacks
All callback types available for testing
Test Event Generation
Use DataFactory to trigger test events and validate your webhook handlers
Development Tools
Monitoring & Troubleshooting
Common Issues
Monitoring Best Practices
Response Time Monitoring
Track webhook response times to ensure sub-30-second processing
Error Rate Tracking
Monitor HTTP error rates and implement alerting for failures
Queue Depth Monitoring
Track async processing queue depth if using background processing
Duplicate Detection
Monitor duplicate message rates to optimize idempotency handling
Best Practices
Security
- Use HTTPS Only: Never accept HTTP callback URLs
- Verify Tokens: Implement token verification for all callbacks
- Rate Limiting: Implement rate limiting on webhook endpoints
- Input Validation: Validate all incoming webhook data
Performance
- Quick Response: Return HTTP 200 within 30 seconds
- Async Processing: Queue heavy processing for background workers
- Idempotency: Handle duplicate events using message_id
- Error Handling: Return appropriate HTTP status codes
Reliability
- Monitoring: Implement comprehensive webhook monitoring
- Alerting: Set up alerts for webhook failures
- Logging: Log all webhook events for troubleshooting
- Testing: Regularly test webhook endpoints
Next Steps
After implementing callback configuration, explore:
- Order Management for order event handling
- Inventory Management for inventory change events
- Authentication for secure API access