Webhooks and Notifications
Webhooks let RxScale notify your system in real time when something happens — such as an order status change, a prescription being signed, or a pharmacy shipping an order. This page explains how to set up and use webhooks effectively.Setting Up Webhooks
To start receiving webhook notifications:Prepare your endpoint
Create an HTTP endpoint on your server that can receive POST requests. This endpoint should be publicly accessible and able to handle incoming webhook payloads.
Register your webhook
Use the Management API to register your webhook endpoint URL. You will specify which event types you want to receive.
Verify your setup
RxScale will send a test event to your endpoint. Make sure your server responds with a 200 status code to confirm it is working.
Available Event Types
RxScale sends webhook notifications for a variety of events. Here are the most common ones:| Event Type | When It Fires |
|---|---|
| Order created | A new order has been placed. |
| Order updated | An order’s status has changed (for example, moved to “waiting for pharmacy”). |
| Prescription approved | A doctor has approved a prescription. |
| Prescription signed | A prescription has been electronically signed. |
| Prescription declined | A doctor has declined a prescription. |
| Pharmacy order updated | A pharmacy has updated an order’s status (for example, shipped). |
Monitoring Order Status Changes
Webhooks are the best way to stay informed about what is happening with your orders. Instead of polling the API repeatedly, you receive a notification the moment something changes. A typical monitoring workflow:- A patient places an order on your shop.
- You receive a webhook when the order is created.
- You receive a webhook when the doctor approves the prescription.
- You receive a webhook when the prescription is signed.
- You receive a webhook when the order is sent to a pharmacy.
- You receive a webhook when the pharmacy ships the order.
- You receive a webhook when the order is completed.
Best Practices for Webhook Handling
Respond quickly
Respond quickly
Your endpoint should respond with a 200 status code as quickly as possible. Process the webhook payload asynchronously if needed — do not block the response while performing lengthy operations.
Handle duplicates
Handle duplicates
In rare cases, you may receive the same webhook event more than once. Design your handler to be idempotent, meaning processing the same event twice should not cause issues.
Verify the payload
Verify the payload
RxScale signs webhook payloads so you can verify they are authentic. Always verify the signature before processing the payload. See Webhook Security for details.
Monitor for failures
Monitor for failures
If your endpoint is down or returning errors, webhook deliveries will be retried. Set up monitoring to detect when your endpoint is failing so you can fix issues quickly.
Log webhook events
Log webhook events
Keep a log of all received webhook events. This is invaluable for debugging and understanding the sequence of events for any given order.
Related Topics
- Webhooks Overview — Technical details about how webhooks work.
- Webhook Events — Complete list of event types and payload formats.
- Webhook Security — How to verify webhook signatures.