# Dynamic Webhook

### Overview

The **Dynamic Webhook component** allows users to subscribe to a webhook URL, triggering the connector when a request is received at that URL. It can be used to listen for incoming HTTP requests and process their data in real time.

### Usage

#### Features

* Automatically generates a webhook URL upon activation.
* Supports HTTP methods for subscribing (`POST`, `PUT`, `GET`, `PATCH`) and unsubscribing (`DELETE`, `POST`, `PUT`, `GET`, `PATCH`).
* Can capture request data, headers, query parameters, and method details.
* Allows configuring immediate response behavior.

#### Input Parameters

| Parameter               | Type      | Description                                                                              |
| ----------------------- | --------- | ---------------------------------------------------------------------------------------- |
| `onStartRequestUrl`     | `string`  | URL to subscribe the webhook when the flow starts.                                       |
| `onStartRequestMethod`  | `string`  | HTTP method to use when subscribing. Options: `POST`, `PUT`, `GET`, `PATCH`.             |
| `onStartRequestHeaders` | `object`  | HTTP headers to send when subscribing.                                                   |
| `onStartRequestBody`    | `object`  | Request body data to send when subscribing.                                              |
| `onStopRequestUrl`      | `string`  | URL to unsubscribe the webhook when the flow stops.                                      |
| `onStopRequestMethod`   | `string`  | HTTP method to use when unsubscribing. Options: `DELETE`, `POST`, `PUT`, `GET`, `PATCH`. |
| `onStopRequestHeaders`  | `object`  | HTTP headers to send when unsubscribing.                                                 |
| `onStopRequestBody`     | `object`  | Request body data to send when unsubscribing.                                            |
| `immediateResponse`     | `boolean` | Whether to send an immediate response when a request is received. Defaults to `true`.    |

#### Output Parameters

| Parameter | Description                              |
| --------- | ---------------------------------------- |
| `method`  | The HTTP method of the incoming request. |
| `data`    | The body of the incoming request.        |
| `query`   | Query parameters from the request URL.   |
| `headers` | HTTP headers of the incoming request.    |

### Instructions

1. **Configure Webhook Subscription**
   * Provide the `onStartRequestUrl` and `onStartRequestMethod` to define how the webhook should be registered.
   * Set necessary headers and request body for subscription if required.
2. **Listen for Incoming Requests**
   * The webhook will trigger whenever a request is sent to the generated URL.
   * Captured request details (method, headers, body, query) will be forwarded to the output port.
3. **Configure Webhook Unsubscription**
   * Provide `onStopRequestUrl` and `onStopRequestMethod` to define how to remove the webhook upon stopping.
   * Use runtime expressions to pass response data from the start request.
4. **Immediate Response Option**
   * Enable `immediateResponse` if you want to return an automatic response to incoming requests.
   * If disabled, use a Response component later in the flow.


---

# 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.appmixer.com/connector-configuration/utils/http/dynamicwebhook.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.
