Use Cases
Common use cases for webhooks include:- Data Synchronization: Maintain a local copy of Rye’s product data for search and display.
- Customer Notifications: Send order updates to customers via email or SMS.
- Internal Alerts: Trigger alerts when orders fail to process.
Getting Started with Webhooks
To receive webhooks from Rye, follow these steps:1
Navigate to Account Settings
Go to the Rye Console.
2
Set Up an Endpoint
Enter your publicly accessible endpoint URL (must be accessible over the internet and capable of handling HTTP POST requests).

3
URL Verification Handshake
After saving your endpoint, Rye will send a verification request containing a Verification Response Example:
challenge
parameter. Your endpoint must respond with the exact challenge
value to confirm it can receive webhooks. Rye will only save the URL if the challenge is successfully verified.Verification Request Example:4
Verify Functionality
Follow our webhook testing guide to ensure your endpoint correctly receives and processes webhooks.
5
Implement Signature Verification
Each webhook includes a cryptographic signature to verify its authenticity. Verifying this signature is essential for security.
Webhook Payload
Rye webhooks follow a consistent structure:Webhook Verification
Security Measures
- Signature Validation: Each webhook includes a
Rye-Hmac-Signature-V1
header to verify authenticity. - Challenge Response: Your endpoint must respond to the initial
challenge
during setup.
Headers Overview
Header | Description |
---|---|
Rye-Hmac-Signature-V1 | Cryptographic signature to verify the webhook’s authenticity. Refer to the verification section for details. |
Rye-Verification | Your developer account ID, useful for endpoints handling multiple Rye accounts. |
CORS Configuration: Ensure your backend allows Rye’s headers by updating your CORS policy accordingly.
Verifying the Signature and Handling Challenges
-
Compute HMAC:
- Use SHA-256 with your HMAC secret key to hash the request body.
- Base64-encode the resulting digest.
-
Compare Signatures:
- Match the computed signature with the
Rye-Hmac-Signature-V1
header. - Reject the request if they do not match.
- Match the computed signature with the
-
Handle Challenge:
- If the payload includes a
challenge
, respond with its value to complete verification.
- If the payload includes a
Testing Webhooks Locally
To test webhooks locally, you can use ngrok to expose your local server to the internet. For example, run the following command to create a public URL that forwards to your local webhook endpoint:RYE_HMAC_SECRET_KEY
environment variable is set in your application.
Caveats
- Reliable Delivery: Rye will attempt to deliver each webhook twice. Ensure your endpoint reliably handles requests without errors.
- Timeouts: Webhook requests must respond within 10 seconds. Longer processing may result in missed events.
- Event Ordering: Webhooks may arrive out of order. Use the
createdAt
timestamp to sequence events appropriately in your system.