Webhooks
Learn how to configure webhooks to receive real-time notifications when events occur in your Optare organization.
What are Webhooks?
Webhooks allow your application to receive HTTP callbacks when specific events happen, such as:
- New member joins organization
- Subscription changes
- OAuth client created
- Product access granted
- User profile updated
Instead of polling for changes, events are pushed to your server instantly.
Viewing Webhooks
- Go to Settings → Webhooks
- See all configured webhooks:
- Endpoint URL
- Events subscribed to
- Status (Active/Inactive)
- Last delivery timestamp
Creating a Webhook
Step 1: Create Endpoint
- Go to Settings → Webhooks
- Click "Create Webhook" or "New Webhook"
Step 2: Configure
- Webhook URL: Your server endpoint (must be HTTPS)
- Example:
https://api.yourapp.com/webhooks/optare
- Example:
- Description: Optional note about this webhook
- Secret: Auto-generated for signature verification
Step 3: Select Events
Choose which events to receive:
Organization Events
organization.updated- Org details changedorganization.member.added- New member joinedorganization.member.removed- Member leftorganization.member.role_changed- Role updated
Subscription Events
subscription.created- New subscriptionsubscription.updated- Changes to subscriptionsubscription.cancelled- Subscription cancelledsubscription.renewed- Auto-renewal processed
OAuth Events
oauth_client.created- New OAuth clientoauth_client.deleted- Client removedoauth_client.token_revoked- Access revoked
User Events
user.created- New user signed upuser.updated- Profile changeduser.deleted- User deleted account
Step 4: Save
- Click "Create Webhook"
- Copy the webhook secret
- Store secret securely in your application
Webhook Payload
When an event occurs, Optare sends a POST request to your endpoint:
Headers
POST /webhooks/optare HTTP/1.1
Host: api.yourapp.com
Content-Type: application/json
X-Optare-Signature: sha256=<signature>
X-Optare-Event: organization.member.added
X-Optare-Delivery: uuid-of-deliveryPayload Example
{
"event": "organization.member.added",
"timestamp": "2025-11-30T12:00:00Z",
"data": {
"organization_id": "org_123",
"member_id": "mem_456",
"user": {
"id": "user_789",
"email": "john@example.com",
"name": "John Doe"
},
"role": "member"
}
}Verifying Signatures
Always verify webhook signatures to ensure requests are from Optare.
Verification Process
import crypto from 'crypto';
function verifyWebhookSignature(
payload: string,
signature: string,
secret: string
): boolean {
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return `sha256=${expectedSignature}` === signature;
}
// In your webhook handler
app.post('/webhooks/optare', (req, res) => {
const signature = req.headers['x-optare-signature'];
const payload = JSON.stringify(req.body);
if (!verifyWebhookSignature(payload, signature, WEBHOOK_SECRET)) {
return res.status(401).send('Invalid signature');
}
// Process the webhook
res.status(200).send('OK');
});Responding to Webhooks
Success Response
Your endpoint should:
- Respond within 10 seconds
- Return HTTP 200-299 status code
- Optionally return response body (not used)
// Good response
res.status(200).send('Webhook received');Failure Handling
If your endpoint:
- Times out (>10s)
- Returns 4xx/5xx status
- Connection fails
Optare will retry with exponential backoff:
- Attempt 1: Immediate
- Attempt 2: After 1 minute
- Attempt 3: After 5 minutes
- Attempt 4: After 15 minutes
- Attempt 5: After 1 hour
- After 5 failed attempts, webhook is marked as failing
Managing Webhooks
Viewing Deliveries
- Go to Settings → **Webhooks
** 2. Click on a webhook 3. View "Delivery History"
For each delivery, see:
- Timestamp
- Event type
- HTTP status code
- Response time
- Request/response payloads
Retry Failed Delivery
- Find the failed delivery
- Click "Retry"
- Optare resends the event
Edit Webhook
- Click "Edit" on webhook
- Update:
- Endpoint URL
- Event subscriptions
- Description
- Save changes
Note: Cannot edit the secret. Regenerate instead.
Regenerate Secret
If secret is compromised:
- Click "Regenerate Secret"
- Copy new secret
- Update your application BEFORE:
- Confirm regeneration
- Old secret becomes invalid
Disable Webhook
Temporarily stop deliveries:
- Toggle webhook status to "Inactive"
- No events will be sent
- Re-enable anytime
Delete Webhook
Permanently remove:
- Click "Delete"
- Confirm deletion
- Cannot be recovered
Testing Webhooks
Test Delivery
- Go to webhook details
- Click "Send Test Event"
- Choose event type
- Click "Send"
- Check your endpoint receives it
Using Webhook Testing Tools
During development, use tools like:
- ngrok - Expose localhost
- webhook.site - Inspect payloads
- requestbin - Debug webhooks
Example with ngrok:
ngrok http 3000
# Use the HTTPS URL in Optare webhook configBest Practices
For Reliability
- Return 200 quickly - Process async to avoid timeouts
- Verify signatures - Always validate requests
- Idempotency - Handle duplicate deliveries gracefully
- Logging - Keep delivery logs for debugging
Example: Async Processing
app.post('/webhooks/optare', async (req, res) => {
// Verify signature
if (!verifySignature(req)) {
return res.status(401).send('Invalid');
}
// Respond immediately
res.status(200).send('Acknowledged');
// Process asynchronously
processWebhookAsync(req.body).catch(err => {
console.error('Webhook processing failed:', err);
});
});Security
- Use HTTPS only - Protects data in transit
- Verify all requests - Check signatures
- Whitelist IP ranges - If possible
- Rate limiting - Protect your endpoint
- Secret rotation - Periodically regenerate
Troubleshooting
Webhook not receiving events?
- Verify webhook is "Active"
- Check event subscriptions include the event
- Ensure URL is correct and accessible
- Check firewall isn't blocking Optare
Deliveries failing?
- Check endpoint returns 200 within 10s
- Verify HTTPS certificate is valid
- Review server logs for errors
- Test with "Send Test Event"
Signature verification failing?
- Ensure using correct secret
- Verify payload isn't modified
- Check you're hashing the raw body
- Regenerate secret if compromised
Duplicate events?
- Deliveries may retry on network issues
- Use idempotency keys or deduplication
- Check
X-Optare-Deliveryheader (unique per delivery)
Event Reference
See the full list of events and their payloads:
Next Steps
- API Keys - Alternative integration method
- Connected Apps - OAuth integration
- Audit Logs - View all events