Stay updated with webhook events
Webhooks allow your application to receive real-time notifications when specific events occur in OnlyOneAPI.
// 1. Configure webhook endpoint in your app
app.post('/webhooks/onlyoneapi', (req, res) => {
const signature = req.headers['x-onlyoneapi-signature'];
const event = req.body;
// Verify webhook signature
if (!verifyWebhookSignature(signature, req.body)) {
return res.status(401).send('Invalid signature');
}
// Handle different event types
switch(event.type) {
case 'invoice.paid':
handleInvoicePaid(event.data);
break;
case 'api.limit.reached':
handleApiLimitReached(event.data);
break;
// ... handle other events
}
res.status(200).send('OK');
});
invoice.created
- New invoice generatedinvoice.paid
- Invoice payment receivedapi.limit.reached
- API rate limit reachedtask.completed
- Async task finishedbatch.processed
- Batch job completedAll webhooks are signed with HMAC-SHA256. Always verify the signature to ensure the webhook is from OnlyOneAPI.