Webhook
Outgoing webhook configuration.
Defines webhooks that listen to events and deliver HTTP
notifications to external endpoints with optional filtering.
Attributes:
name: Unique webhook identifier
event: Event to listen to (e.g., "doc.created", "doc.updated")
doctype_filter: Optional DocType filter (e.g., "Invoice")
condition: Optional JMESPath/SimpleEval expression to filter events
url: Webhook endpoint URL
method: HTTP method (POST or PUT)
headers: Custom HTTP headers to send
payload_transform: Optional Jinja2 template to transform event payload
enabled: Whether the webhook is active
secret: Secret for HMAC-SHA256 signature verification
Source: webhook.py
Fields
| Field | Type | Required | Description | Validators |
|---|---|---|---|---|
| name | str | ✓ | Unique webhook identifier | minLen: 1, maxLen: 255 |
| event | str | ✓ | Event to listen to (e.g., 'doc.created') | minLen: 1 |
| doctype_filter | str | None | Filter by DocType (e.g., 'Invoice', 'Order') | |
| condition | str | None | JMESPath or SimpleEval expression to filter events (e.g., 'status == paid') | |
| url | str | ✓ | Webhook endpoint URL | minLen: 1 |
| method | str | HTTP method (POST or PUT) | - | |
| headers | dict[str, Any] | Custom HTTP headers to send with request | - | |
| payload_transform | str | None | Jinja2 template to transform event payload (e.g., '{"text": "{{ doc.name }}"}') | |
| enabled | bool | Whether the webhook is active | - | |
| secret | str | None | Secret for HMAC-SHA256 signature (X-Webhook-Signature header) |
Permissions
| Role | Create | Delete | Read | Write |
|---|---|---|---|---|
| Admin | ✓ | ✓ | ✓ | ✓ |
| Manager | ✓ | ✓ |
Configuration
| Setting | Value |
|---|---|
| Submittable | False |
| Track Changes | True |
Controller
Controller hooks are implemented in *_controller.py files.
Available lifecycle hooks:
validate()- Called before save, raise exceptions for validation errorsbefore_insert()- Called before inserting a new documentafter_insert()- Called after successfully insertingbefore_save()- Called before saving (insert or update)after_save()- Called after savingbefore_delete()- Called before deletingafter_delete()- Called after deleting