Webhooks
Webhooks allow operators to receive real-time notifications whenever certain events occur within the Riyadh Parking system. Instead of constantly polling the API for updates, webhooks provide an efficient way to stay informed about critical changes.Webhooks enable event-driven automation, allowing your system to respond instantly to parking-related updates.
How Webhooks Work
- Subscribe to Webhooks: Once onboarded, operators can access the Operator Portal to configure webhook subscriptions.
- Receive Event Notifications: When an event occurs (e.g., a new violation, ticket validation, or site capacity update), a
POSTrequest is sent to your webhook endpoint. - Process the Webhook Data: Your system should verify and process the incoming event payload to trigger appropriate actions.
Expected Webhook Behavior
- Delivery Format: Webhooks are sent as
POSTrequests with JSON payloads. - Security: Webhook payloads are signed to ensure authenticity.
- Retries: If a webhook delivery fails, the system will retry multiple times before marking it as failed.
- Event Types: Available webhook events can be explored via the Operator Portal after service activation.
Handling Webhooks
To process incoming webhooks:- Expose an HTTPS endpoint that can accept
POSTrequests. - Verify the webhook signature to ensure authenticity.
- Acknowledge the request with a
200 OKresponse to prevent unnecessary retries.
Example Webhook Payload
Best Practices
- Verify webhook signatures before processing events to prevent unauthorized requests.
- Use idempotency when handling webhooks to avoid duplicate processing.
- Log webhook events for debugging and monitoring purposes.
- Ensure high availability of your webhook endpoint to receive updates reliably.
Next Steps
- Set up webhook subscriptions in the Operator Portal.
- Implement webhook handling logic in your backend.
- Review Security Best Practices to secure your integration.
Next: Explore Webhook Event Types in the Operator Portal.