> For the complete documentation index, see [llms.txt](https://docs.scaleflex.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scaleflex.com/digital-asset-management-dam/settings/automations/webhooks.md). Agents can also search and read this documentation through its [MCP server](https://docs.scaleflex.com/~gitbook/mcp).

# Webhooks

Webhooks allow you to call a third-party web service upon specific triggers and send all asset data in the JSON body.

The Webhooks can be accessed from the *Settings > Library > Automations > Webhooks* menu.

You can add up to 15, individually configured and activated, webhooks.

<figure><img src="https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2Fnag32KESxV0wgbNqlW0a%2Fwebhook%20initialisation.png?alt=media&#x26;token=7e7224c7-ca4b-4d5c-a6db-85422a66c38d" alt=""><figcaption></figcaption></figure>

## **Webhook parameters:**

| Webhook parameter       | Description                                                                                 |
| ----------------------- | ------------------------------------------------------------------------------------------- |
| `Webhook url`           | Target webhook url to POST event to                                                         |
| `Hostname`              | The domain address of the third party service where to post data                            |
| `Path`                  | The domain path to post data to                                                             |
| `Delay (minutes)`       | Time to wait after the triggering event before sending the webhook. 0 sends it immediately. |
| `Basic Authentication`  | Requires a Username and a password                                                          |
| `oAuth2 Authentication` | Requires an authentication endpoint (with https\://), a username and a password             |

## Connection

To set up the webhook, the following information must be provided:

* **Hostname** - The domain name of the third-party API that will be contacted.
* **Path** - The specific path with the *Hostname* forms the complete target URL (*Webhook URL*) to which the data will be sent.<br>

## Delay the webhook

By default, a webhook is sent as soon as its trigger happens. To send it later, for example once post-processing on the asset has finished, set **Delay (minutes)** to a whole number of minutes from 0 to 10080 (7 days).

* The delay applies to every trigger the webhook listens to.
* **0**, the default, sends the webhook immediately.
* Next to the field, the delay is also shown in days, hours and minutes. For example, 10000 shows as **6 d 22 h 40 min**.

<figure><img src="https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2Fwkc1PvVIcIbdj29htmj1%2Fimage.png?alt=media&#x26;token=75a465c3-85a7-45b8-83be-4e0fe2d2ad3d" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The data sent describes the asset as it was when the event happened, not when the webhook is sent. Editing or deactivating the webhook during the delay does not cancel events that are already waiting: they are still sent, in the order they happened.
{% endhint %}

## Authentication

A consumer cannot always verify that the webhook it receives is coming from the expected source. Due to this, there are two authentication methods supported:

* **Basic authentication** - The simplest way to verify a webhook. It makes use of a `username` and a `password` that are used for authentication when sending the data to the *Webhook URL*.
* **OAuth2 authentication** - A more secure and complex authentication method that allows users to grant limited access to their resources without exposing their credentials. This type of authentication can be used in two ways:
  * By specifying the `Authentication endpoint`, `username` and `password` to retrieve a temporary token, which is then used in the webhook.
  * By directly entering the `Static bearer token` to use every time without generating a temporary one before the request.

## Custom headers <a href="#headers" id="headers"></a>

You can specify up to 10 additional headers to be sent to the endpoint with the payload. Those headers will have the classic form `name`:`value`:

<figure><img src="https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2FKJUptPnu6br8d0kVfRyv%2Fimage.png?alt=media&#x26;token=6375b301-9ff3-48c8-a9e2-704677eab94c" alt=""><figcaption></figcaption></figure>

## Triggers

The triggers determine the events that need to happen to execute the webhook. The following ones are available:<br>

### **Asset triggers**

* **On upload** - After a successful asset upload.
* **On move** - When the asset location is changed.
* **On rename** - When the asset is renamed.
* **On delete** - When the asset is deleted.
* **On Approval Status -** When the asset approval status is changed.
* **On change version** - When the asset version changed.

### **Metadata triggers**

* **On change meta** - When some specific (or any) metadata field is modified to a value (or any).
* **On change info** - When some asset's information (e.g. title, description, etc.) is changed.
* **On change tag** - When the asset's tags are edited.
* **On change label** - When the asset's labels are modified.
* **On change visibility -** When the asset visibility is changed.

## Data to sent

There is fine-grained control over which specific asset details are sent as part of the request JSON body to the selected API endpoint. This ensures that only the necessary information to handle the event effectively is communicated. Those details are divided into several categories depending on the asset type:

| File (All assets)      | Video               | Image  | Additional                |
| ---------------------- | ------------------- | ------ | ------------------------- |
| Name                   | Width               | Width  | All system metadata\*     |
| Size                   | Height              | Height | All custom metadata\*\*\* |
| Path                   | Length (in seconds) |        | All embedded metadata\*   |
| MIME type              | Bitrate             |        | Visibility status         |
| CDN link               | HLS playlist URL    |        | Approval status           |
| File UUID              |                     |        |                           |
| Origin folder\*\*      |                     |        |                           |
| Origin folder UUID\*\* |                     |        |                           |

\* those global metadata packages to send along will include everything that is recorded for the asset in each of the 3 categories.

\*\* the folder the asset was moved from, by name and by UUID. When the **On move** trigger is selected, both are always sent: their checkboxes are ticked and locked, and you cannot clear them until you clear **On move**.

\*\*\* you can select which type of payload should be included for `custom metadata` of certain categories like single and multi-selects, or custom tags. If the `API Key` is selected, the payload sent will be the one corresponding to the unique identification value stored in database that is independent of the value displayed in the interface to ensure unicity. If the `Value` is selected (default) then the non-unique data used in interface will be sent as payload.

eg. for system metadata, it includes the file hash, labels, etc.

Note that for embedded metadata, it can be very voluminous, please only add if really necessary.
