Webhooks
Integrate Kuviq with external systems using webhooks.
Overview
Webhooks allow Kuviq to:
- Send data to external systems
- Trigger external workflows
- Integrate with other tools
- Enable custom automation
How Webhooks Work
The Process
- Event occurs in Kuviq
- Webhook triggered
- Data sent to your URL
- External system processes
- Response received
Webhook Payload
Data sent as JSON:
{
"event": "inspection.completed",
"timestamp": "2024-01-15T10:30:00Z",
"data": {
"inspectionId": "abc123",
"itemId": "item456",
"result": "passed",
"inspector": {
"id": "user789",
"name": "John Smith"
}
}
}
Creating Webhooks
Setup Steps
- Go to Admin > Integrations
- Click Webhooks or Add Webhook
- Configure settings
- Save and activate
Configuration Options
| Setting | Description |
|---|---|
| Name | Descriptive name |
| URL | Endpoint to receive data |
| Events | Which events trigger |
| Secret | For signature verification |
| Active | Enable/disable |
Webhook Events
Inspection Events
| Event | Description |
|---|---|
inspection.created | New inspection started |
inspection.completed | Inspection finished |
inspection.failed | Inspection result is fail |
inspection.passed | Inspection result is pass |
Item Events
| Event | Description |
|---|---|
item.created | New item added |
item.updated | Item modified |
item.deleted | Item removed |
item.status_changed | Status changed |
Corrective Action Events
| Event | Description |
|---|---|
action.created | New action created |
action.updated | Action modified |
action.completed | Action completed |
action.overdue | Action past due |
User Events
| Event | Description |
|---|---|
user.created | New user added |
user.updated | User modified |
user.deactivated | User deactivated |
Payload Formats
Inspection Completed
{
"event": "inspection.completed",
"timestamp": "2024-01-15T10:30:00Z",
"data": {
"id": "insp_123",
"item": {
"id": "item_456",
"name": "Fire Extinguisher A1",
"type": "Fire Extinguisher"
},
"template": {
"id": "tmpl_789",
"name": "Monthly Fire Safety"
},
"result": "passed",
"inspector": {
"id": "user_012",
"name": "Jane Doe",
"email": "jane@example.com"
},
"location": {
"id": "loc_345",
"name": "Building A"
},
"completedAt": "2024-01-15T10:30:00Z",
"elements": [
{
"name": "Pressure Check",
"result": "pass",
"value": "OK"
}
]
}
}
Item Status Changed
{
"event": "item.status_changed",
"timestamp": "2024-01-15T11:00:00Z",
"data": {
"id": "item_456",
"name": "Fire Extinguisher A1",
"previousStatus": "available",
"newStatus": "needs_attention",
"reason": "Failed inspection",
"changedBy": {
"id": "user_012",
"name": "Jane Doe"
}
}
}
Corrective Action Created
{
"event": "action.created",
"timestamp": "2024-01-15T11:05:00Z",
"data": {
"id": "action_678",
"title": "Recharge fire extinguisher",
"priority": "high",
"item": {
"id": "item_456",
"name": "Fire Extinguisher A1"
},
"assignee": {
"id": "user_901",
"name": "Bob Wilson"
},
"dueDate": "2024-01-18",
"inspection": {
"id": "insp_123"
}
}
}
Security
Signature Verification
Verify webhooks are from Kuviq:
- Set a secret when creating webhook
- Kuviq signs each request
- Verify signature on receipt
Signature Headers
Each webhook request includes security headers:
X-Webhook-Signature: sha256=<HMAC-SHA256 hash>
X-Webhook-Timestamp: <ISO 8601 timestamp>
Content-Type: application/json
Verification Code Example
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}
HTTPS Required
- All webhook URLs must use HTTPS
- HTTP URLs rejected
- Self-signed certificates not supported
Managing Webhooks
Viewing Webhooks
- Go to Admin > Integrations
- View webhook list
- See status and activity
Webhook Details
| Field | Description |
|---|---|
| Name | Webhook identifier |
| URL | Target endpoint |
| Events | Subscribed events |
| Status | Active/Inactive |
| Last triggered | Recent activity |
| Success rate | Delivery success |
Editing Webhooks
- Click on webhook
- Click Edit
- Modify settings
- Save
Deactivating
- Find webhook
- Toggle Active off
- Or click Deactivate
Deleting
- Find webhook
- Click Delete
- Confirm
Testing Webhooks
Send Test Webhook
Test your endpoint configuration:
- Go to Admin > Integrations > Webhooks
- Find your webhook endpoint
- Click the Test button
- View the test result
Test Result
The test shows:
| Result | Meaning |
|---|---|
| ✅ Success | Endpoint responded with 2xx status |
| ❌ Failed | Endpoint returned error or timed out |
| Response code | HTTP status code returned |
| Response time | How long the request took |
Test Payload
Test webhooks send a sample payload:
{
"event": "test.webhook",
"timestamp": "2024-01-15T10:30:00Z",
"isTest": true,
"data": {
"message": "This is a test webhook from Kuviq",
"endpointId": "endpoint_123",
"organizationId": "org_456"
}
}
Test Endpoints for Development
Use these services during development:
- webhook.site - Free webhook testing
- requestbin.com - Inspect webhook payloads
- ngrok - Expose local endpoints for testing
Delivery & Retries
Delivery Expectations
- Timeout: 30 seconds
- Expected response: 2xx status
- Retry on failure
Retry Policy
Failed webhooks use exponential backoff:
| Attempt | Delay |
|---|---|
| 1st retry | 1 minute |
| 2nd retry | 5 minutes |
| 3rd retry | 15 minutes |
| 4th retry | 1 hour |
| 5th retry | 4 hours |
After 5 failures:
- Webhook event marked as failed
- Available for manual retry
- Admin can view failure details in event log
Response Handling
| Response | Action |
|---|---|
| 2xx | Success, no retry |
| 4xx | Failure, no retry (client error) |
| 5xx | Retry (server error) |
| Timeout | Retry |
Webhook Event Log
Accessing the Event Log
- Go to Admin > Integrations > Webhooks
- Click Event Log tab
- View all webhook delivery history
Event Log Dashboard
The event log shows:
| Metric | Description |
|---|---|
| Pending | Events waiting to be delivered |
| Completed | Successfully delivered events |
| Failed | Events that failed after all retries |
| In Progress | Events currently being processed or retrying |
Event Details
Each entry shows:
- Event type: The webhook event that triggered
- Status: pending, processing, completed, failed, retrying
- Attempts: Number of delivery attempts
- Created: When the event was created
- Processed: When delivery completed (or last attempt)
- Error message: Details if delivery failed
Filtering Events
Filter the event log by:
- Status: All, Pending, Processing, Completed, Failed, Retrying
- Auto-refreshes every 30 seconds
Manual Retry
For failed events:
- Find the failed event in the log
- Click the Retry button
- Event is requeued for immediate delivery
- Monitor the status update
Common Integrations
Slack Notifications
Send to Slack channel:
- Create Slack incoming webhook
- Add webhook URL to Kuviq
- Format payload for Slack
Microsoft Teams
Send to Teams channel:
- Create Teams incoming connector
- Add connector URL
- Configure payload format
Custom Applications
Receive in your app:
- Create endpoint in your app
- Add URL to Kuviq
- Process incoming data
Zapier Integration
Connect via Zapier:
- Use Zapier's webhook trigger
- Create Zap workflow
- Connect to other apps
Best Practices
Endpoint Design
- Respond quickly - Process async if needed
- Return 2xx - Even if processing later
- Handle duplicates - Same event may retry
- Validate signature - Verify authenticity
- Log requests - For debugging
Error Handling
- Return appropriate status codes
- Don't expose internal errors
- Implement retry logic (for your calls)
- Monitor for failures
Performance
- Keep processing fast
- Queue heavy processing
- Don't block on external calls
- Handle bursts gracefully
Troubleshooting
Not Receiving Webhooks
Check:
- Webhook is active
- Events are configured
- URL is correct
- Endpoint is accessible
- Firewall allows traffic
Invalid Signature
Check:
- Secret matches exactly
- Payload not modified
- Correct hashing algorithm
- Encoding is correct
Frequent Failures
Check:
- Endpoint availability
- Response time (under 30s)
- Response status codes
- Server capacity
Debugging Tips
- Use webhook logging
- Test with simple endpoints
- Check server logs
- Verify payload format
Rate Limits
Limits
| Limit | Value |
|---|---|
| Webhooks per org | 25 |
| Events per webhook | Unlimited |
| Requests per minute | 1000 |
Handling Limits
If hitting limits:
- Consolidate webhooks
- Filter events more specifically
- Contact support for increases
Next Steps
- Automation Rules - Event-based automation
- Email Notifications - Built-in notifications
- API Documentation - Full API reference