Getting started
Prerequisites
- An active SCALAR integrator account
- A secure HTTPS webhook endpoint that can receive POST requests
- Ability to process JSON request bodies
- Webhook endpoint should respond within 3-5 seconds
- Backend service to handle asynchronous event processing
Step-by-Step Setup
Step 1: Prepare Your Webhook Endpoint
Your webhook endpoint must:
- Accept HTTP POST requests with Content-Type: application/json
- Validate HMAC signatures to verify requests from SCALAR
- Return appropriate HTTP status codes (200 for success, 5xx for server errors)
- Support asynchronous processing to respond quickly
- Whitelist SCALAR IP addresses (see section on IP Whitelisting)
Example endpoint implementation concepts:
- Implement a POST handler at your specified URL
- Validate the HMAC signature from the X-SCALAR-SIGNATURE header
- Immediately return 200 OK to acknowledge receipt
- Process events asynchronously in the background
- Implement idempotent processing to handle retries
Step 2: Create a Webhook Subscription
- Log into SCALAR Web portal
- Navigate to Datahub Subscriptions
- Click Create Subscription
- Fill in subscription details:
- Subscription Name: Descriptive name for your subscription
- Subscription Method: Select "Webhook"
- Webhook URL: Your HTTPS endpoint URL (must be publicly accessible)
- Webhook Secret: Generate a secure secret for HMAC validation
- Select Event Types:
- Choose event groups (e.g., sensors, track & trace, asset)
- Select specific events within those groups
- Configure event versions if needed
- Configure Delivery Settings:
- Batch Size: Number of events per batch (max 500)
- Maxmum Waiting Time: Maximum wait time before sending batch (milliseconds)
- Overflow Protection: Enable to buffer data during high-volume periods
- Add Custom Headers (Optional):
- Add up to 5 custom headers required by your system
- Useful for authorization tokens, correlation IDs, or system identifiers
Step 3: Test Your Webhook
- In the subscription details, click Test Connection
- SCALAR sends a test payload to your webhook endpoint
- Verify your endpoint receives and processes the test data
- Check that you receive a successful response notification
- Click Save to create the subscription
Step 4: Activate and Monitor
- Once testing is successful, save the subscription
- SCALAR begins sending live event data to your endpoint
- Monitor the Webhook Developer Metrics for delivery status and metrics
- Review notifications for any configuration issues
Updated about 2 hours ago