Webhooks
The webhooks engine is responsible for executing requests for collection triggers and cron jobs.
- A webhook can send Bearer with JWT payload signed by a VSKI instance.
- Currently webhooks do not support sending files.
- Workflows use a separate inbound endpoint to receive events and are not to be confused with collection and cron outbound webhooks.
API Endpoints
Section titled “API Endpoints”| Method | Endpoint | Description |
|---|---|---|
GET | /api/webhooks/logs | List webhook logs |
GET | /api/webhooks/logs?collection=name | Filter by collection |
GET | /api/webhooks/logs?status=failed | Filter by status |
GET | /api/webhooks/logs?page=1&perPage=50 | Paginate results |
Webhooks are configured via collection management:
| Method | Endpoint | Description |
|---|---|---|
POST | /api/collections | Create collection with triggers |
PATCH | /api/collections/:name | Update collection triggers |
From the command line: vski webhooks logs, vski webhooks logs --status failed,
vski webhooks trigger <id>.
Security Best Practices
Section titled “Security Best Practices”- Use HTTPS: always use HTTPS URLs for webhooks
- Secure tokens: store API tokens in environment variables
- Verify signatures: implement signature verification on receiving endpoints (future feature)
- Rate limiting: implement rate limiting on webhook endpoints
- Validate payloads: always validate incoming webhook data
- Use authentication: include authentication headers in triggers
- Monitor logs: regularly check webhook logs for failures
- Test endpoints: verify webhook endpoints work before production
Testing Webhooks
Section titled “Testing Webhooks”Using Webhook Testing Services
Section titled “Using Webhook Testing Services”Use webhook testing services during development:
- https://webhook.site - Get a temporary webhook URL
- https://requestbin.com - Inspect HTTP requests
- ngrok - Expose local endpoints
# vski/default/collections.yaml: collection with a test webhook URLversion: 1database: default
collections: test_collection: type: base fields: - {name: data, type: text, required: true} options: triggers: - action: create url: https://webhook.site/your-unique-id method: POST# Create a test record to trigger the webhook,# then check webhook.site to see the payloadawait client.collection("test_collection").create({"data": "Test data"})Manual Testing
Section titled “Manual Testing”await client.collection("notifications").create( {"title": "Test Notification", "message": "This is a test", "status": "active"})
logs = await client.webhook_logs.list(collection="notifications", page=1, per_page=10)print(logs)