Best Practices & Troubleshooting
Best Practices
1. Always Verify Signatures
Never process a webhook event without first verifying the X-Signature header. This ensures:
- The request genuinely came from Novee.
- The payload has not been tampered with in transit.
- The request is not a replay of a previously intercepted message.
2. Respond Quickly
Return a 2xx HTTP status code as quickly as possible. Offload any heavy processing to a background queue or worker.
â
Receive â Verify â Acknowledge (200) â Process async
â Receive â Verify â Process (slow) â Acknowledge (200)If your endpoint does not return a 2xx response, the delivery is considered failed.
3. Use HTTPS
Always use an https:// URL for your webhook endpoint. The Novee API validates your URL at registration time, so only valid URLs are accepted.
4. Handle Duplicate Events
In rare cases (e.g., network issues, retries), you may receive the same event more than once. Design your webhook handler to be idempotent:
- Track processed events by their content/timestamp.
- Use a deduplication strategy that suits your use case.
5. Subscribe Only to What You Need
Only subscribe to the event types you actually need. This reduces unnecessary traffic and processing load.
6. Store Your Secret Securely
- Use environment variables or a secrets manager.
- Never log or expose your webhook secret.
- Never commit it to version control.
7. Monitor Your Endpoint
Set up monitoring and alerting for your webhook endpoint to detect:
- High error rates or non-
2xxresponses. - Increased latency in response times.
- Unexpected downtime.
Error Handling
Registration Errors
| Error | Cause | Solution |
|---|---|---|
Webhook has already been registered previously | A webhook already exists for this project. | Use PATCH /webhooks to update, or delete the existing one first. |
No project with id {id} was found | Invalid project ID. | Verify the project ID exists and you have access. |
403 Forbidden | User is not a member of the project. | Ensure your Auth0 token belongs to a user who is a project member. |
Delivery Errors
| Scenario | What Happens |
|---|---|
Your endpoint returns a non-2xx status | The delivery is considered failed. An error is logged server-side. |
| Your endpoint is unreachable | The delivery fails. An error is logged server-side. |
| No webhook registered for the project | The event is silently skipped (no error). |
| Event type not in registered types | An error is thrown: "has not registered a webhook for event: {type}". The event is not delivered. |
Update Errors
| Error | Cause | Solution |
|---|---|---|
Must register webhook before updating it | No existing registration for the project. | Register a webhook first with POST /webhooks/register. |
Troubleshooting
âIâm not receiving any webhooksâ
- Check registration:
GET /webhooks/project/:projectIdâ confirm a webhook exists. - Check event types: Ensure the events you expect are in the
typesarray. - Check your URL: Make sure your endpoint is publicly accessible and returns
2xx. - Send a test: Use
POST /webhooks/test/project/:projectIdto trigger a test event. - Check server logs: Look for incoming requests from the Novee platform.
âSignature verification is failingâ
- Use the raw body: Ensure youâre using the raw request body string, not a re-serialized or parsed version.
- Check your secret: Confirm youâre using the correct
whsec_...secret from registration. - Check timestamp: Ensure your server clock is synchronized. The timestamp tolerance is 5 minutes.
- String construction: The signing string is
{timestamp}.{raw_body}â ensure thereâs no extra whitespace.
âI get âWebhook has already been registered previouslyââ
Each project can only have one webhook. To change it:
- Update:
PATCH /webhookswith the new URL or types. - Replace:
DELETE /webhooks/project/:projectId, thenPOST /webhooks/register.
âI need to rotate my webhook secretâ
The current API does not support secret rotation. To get a new secret:
- Delete the existing webhook:
DELETE /webhooks/project/:projectId - Re-register:
POST /webhooks/register - Update your server with the new secret.
Note: There will be a brief period during re-registration where events are not delivered.
Summary of Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST | /webhooks/register | Register a new webhook for a project. |
PATCH | /webhooks | Update an existing webhookâs URL or event types. |
GET | /webhooks/project/:projectId | Get the registered webhook for a project. |
DELETE | /webhooks/project/:projectId | Delete the registered webhook for a project. |
POST | /webhooks/test/project/:projectId | Send a test event to the registered webhook. |