# Webhook (Automation)

Description

The Webhook component facilitates real-time data transmission between applications whenever a specific event occurs. In our algorithm, the webhook acts as an input, enabling our system to receive and process data instantly upon the triggering event.

<figure><img src="/files/SFzke9SLefZz2uDdKXZQ" alt=""><figcaption></figcaption></figure>

## Component settings&#x20;

| Parameter Name                               | Description                                                                                                                                                          |
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Webhook endpoint (Test URL / Production URL) | <p>You can copy the webhook endpoint<br><br>- Test URL: Use for the flow with status "Draft."<br><br>- Production URL: Use for the flow with status "Published."</p> |
| API Key                                      | <p>You can choose API Key from the list of API Keys in your Workspace<br><br>Default value: <em>API Key created by Diaflow</em></p>                                  |
| Body                                         | You can add a key and specify whether it is required or optional.                                                                                                    |

## Use case

Here's a use case for the Webhook component: it is used to analyze a PDF document by asking, "*How to scale the B2B engine?*"

<figure><img src="/files/ljHsWOu9p91MGEp4qb2S" alt=""><figcaption></figcaption></figure>

## How to Set up a Node Trigger Webhook

### **Step 1: Set Up the Node Trigger Webhook**

Setting up the node trigger webhook.\
In the **"Config"** tab, select **Type = "Webhook"**

<figure><img src="/files/LpYHyrrrGPgCtJwsE0bq" alt=""><figcaption></figcaption></figure>

### **Step 2: Choose API Key**

Choose API Key from your API Keys List.

Make sure that your API Key is included in the header when calling the webhook. This security

measure helps protect your data and environment.&#x20;

<figure><img src="/files/9WDqp2tVQBh6Hg0NxvDb" alt=""><figcaption></figcaption></figure>

### **Step 3: Configure the Body Fields**

Enter the values in the **Body** section. These are the data fields the system will receive from the Webhook. You can mark them as **"Optional"** or **"Required"**.

**Note:** If the system receives a Webhook request that does not contain the required fields, an error will be returned.

<figure><img src="/files/N5Ho1ObwI4biNgi1D1mJ" alt=""><figcaption></figcaption></figure>

### **Step 4: Preview the Webhook**

You can test the Webhook using one of the following methods:

**Recommendation**: Use **Postman** to preview the Webhook.

<https://www.postman.com/>

**Steps to Test with Postman**

* Copy the Webhook URL on Diaflow

<figure><img src="/files/u4nS2M2HM0wqMEbyMC6z" alt=""><figcaption></figcaption></figure>

* Open **Postman**.
* Use the **"POST"** method.
* Paste the Webhook URL.
* Go to the **"Body"** tab:
  * Select **"Raw"** format.
  * Enter the data fields (e.g., Name, Age, Gender).

<figure><img src="/files/ae2xS0z16FObPgPYiHps" alt=""><figcaption></figcaption></figure>

* Click **"Send"**.
* If the response contains `"success": true`, the connection is successful. You can now use this Webhook configuration to transmit data.

<figure><img src="/files/KApkOuvTMWKsyQUyWghU" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.diaflow.io/workflow-builder/nodes/trigger/webhook-automation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
