Webhooks
Llana ships with webhooks so you can keep your backend applications fully synchronized with your database.
Webhooks are maintained in the _llana_webhook
table and logging can be found in the _llana_webhook_log
table.
Manage Webhooks
You can manage webhooks via the _llana_webhook
table.
Field | Type | Details |
---|---|---|
id | PK | The webhook ID |
type | enum | The request type to send data to your URL, GET , POST , PUT , PATCH , DELETE , defaults to POST |
url | string | The URL to send the events to |
table | string | The table the webhook relates to |
user_identifier | string | If the webhook is created or restricted to a specific user, defaults to null |
on_create | boolean | If the webhook should fire on new records, defaults to true |
on_update | boolean | If the webhook should fire on updated records, defaults to true |
on_delete | boolean | If the webhook should fire on deleted records, defaults to true |
Example:
{
"webhook_type": "POST",
"webhook_url": "https://example.ext/endpoint",
"table": "Customer",
"user_identifier": null,
"on_create": true,
"on_update": true,
"on_delete": true
}
Endpoints
Use Llana to manage your webhooks via API using the /webhook/
endpoint. These are also added to your automated API documentation portal.
Event
The webhook event looks like:
{
webhook_id: number
type: CREATE | UPDATE | DELETE
[table_primary_key]: string | number
}
Optional Configuration
The following .env
values can be used:
Variable | Details |
---|---|
WEBHOOK_LOG_DAYS | The number of days which webhook log records are kept, defaults to 1 |
CACHE_WEBHOOKS_TTL | The TTL for caching table webhooks* |
CRON_EXPRESSION_WEBHOOKS_SEND | Override the default cron expression of every 30 seconds */30 * * * * |
- Cache is cleared on system reboot, we also clear cache hits for tables if updates to webhook records containing that table name occur.