# SaveWebHook - Advanced Documentation ## Overview Creates or updates a webhook. When an item of the webhook's type (Contact, Staff, Event, Task, Claim, Request) is processed, Backdocket POSTs a JSON payload to the webhook Url. ## Client Secret - ClientSecret is write-only. It is never returned by SaveWebHook or GetWebHooks. - Sending a blank ClientSecret on update keeps the currently stored secret. - When a secret is stored, every request is signed. The `backdocket-signature` header holds the Base64-encoded HMAC-SHA256 of the raw request body, keyed with the client secret. Receivers should recompute it over the exact body bytes and compare. - Without a secret, no signature header is sent. ## Request - Method: POST - Content-Type: application/json; charset=utf-8 - User-Agent: Backdocket-Webhooks/1.0 (+https://www.backdocket.com) - A non-2xx response is treated as a failure and recorded in the webhook log. ## Payload The body is one flat JSON object: - `Type` - the webhook type name. - `ItemID` - the ID of the item that triggered the webhook. - Each entry in `Fields` becomes a top-level property, Key as the name and Value as a string. - Filter search columns, when a FilterSearch is set (see below). Name collisions: - A Field named `Type` or `ItemID` is skipped. - A filter column with the same name as a Field replaces the Field value. ## Filter Search FilterSearch runs the saved advanced search using the ItemID. - Zero rows: the webhook is not sent. - One row: each column is added as a top-level property. - More than one row: all rows are added under `Data` as a JSON array serialized as a string. ## Example ```json { "Type": "Contact", "ItemID": 123, "Source": "Backdocket" } ```