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.

FieldTypeDetails
idPKThe webhook ID
typeenumThe request type to send data to your URL, GET, POST, PUT, PATCH, DELETE, defaults to POST
urlstringThe URL to send the events to
tablestringThe table the webhook relates to
user_identifierstringIf the webhook is created or restricted to a specific user, defaults to null
on_createbooleanIf the webhook should fire on new records, defaults to true
on_updatebooleanIf the webhook should fire on updated records, defaults to true
on_deletebooleanIf 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:

VariableDetails
WEBHOOK_LOG_DAYSThe number of days which webhook log records are kept, defaults to 1
CACHE_WEBHOOKS_TTLThe TTL for caching table webhooks*
CRON_EXPRESSION_WEBHOOKS_SENDOverride 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.