Webhooks
Set up webhooks to receive real-time notifications when events occur in your URI Social account.
Available Events
api_key.createdTriggered when a new API key is created
api_key.rotatedTriggered when an API key is rotated
api_key.revokedTriggered when an API key is revoked
api_key.expiredTriggered when an API key expires
api_key.expiring_soonTriggered 7 days before an API key expires
rate_limit.exceededTriggered when your hourly/daily request rate limit is exceeded
quota.warningTriggered at 80% of your monthly credit quota
quota.exceededTriggered when your monthly credit quota is exceeded
payment.succeededTriggered when a subscription payment completes successfully
payment.failedTriggered when a subscription payment fails
subscription.updatedTriggered when your subscription plan changes
subscription.cancelledTriggered when your subscription is cancelled
security.suspicious_activityTriggered when suspicious account activity is detected
security.ip_blockedTriggered when a request from a non-whitelisted IP is blocked
Creating a Webhook
// Webhooks are managed via the Gateway API directly (not through
// the content-generation SDK client) — or from your dashboard at
// /dashboard/webhooks.
const response = await fetch('https://sdk-gateway.urisocial.com/api/v1/webhooks', {
method: 'POST',
headers: {
'Authorization': `Bearer ${YOUR_SESSION_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://your-app.com/webhooks/urisocial',
description: 'Production webhook',
events: ['payment.succeeded', 'quota.warning', 'api_key.revoked']
})
});
const webhook = await response.json();
console.log('Webhook created:', webhook.id);Webhook Payload
{
"id": "665f1a2b3c4d5e6f7a8b9c0d",
"event": "payment.succeeded",
"created_at": "2026-05-22T10:30:00Z",
"data": {
"transaction_ref": "SDKGTW_abc12345_STARTER_MONTHLY_NGN_1747900200",
"plan_tier": "starter",
"billing_interval": "monthly",
"amount": 75000,
"currency": "NGN"
}
}Verifying Webhooks
import crypto from 'crypto';
function verifyWebhookSignature(payload, signature, secret) {
const hmac = crypto.createHmac('sha256', secret);
const digest = hmac.update(payload).digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(digest)
);
}
// In your webhook endpoint
app.post('/webhooks/urisocial', (req, res) => {
const signature = req.headers['x-webhook-signature'];
const payload = JSON.stringify(req.body);
if (!verifyWebhookSignature(payload, signature, WEBHOOK_SECRET)) {
return res.status(401).send('Invalid signature');
}
// Process webhook
console.log('Valid webhook:', req.body);
res.status(200).send('OK');
});Security Best Practices
- • Always verify webhook signatures
- • Use HTTPS for webhook URLs
- • Store webhook secrets securely
- • Implement replay attack prevention
- • Return 200 status quickly to avoid retries
Retry Logic
If your endpoint fails to respond with a 2xx status code, URI Social will retry with exponential backoff:
- 1Retry after 5 minutes
- 2Retry after 30 minutes
- 3Final retry after 2 hours
Testing Webhooks
curl -X POST https://sdk-gateway.urisocial.com/api/v1/webhooks/{webhook_id}/test \
-H "Authorization: Bearer YOUR_SESSION_TOKEN"
// Sends a test api_key.created event to verify your endpointReady to Set Up Webhooks?
Start receiving real-time notifications for your social media activities.
Configure Webhooks