Skip to content

Commit 37a56b1

Browse files
authored
docs: webhook component playground test (#6053)
* webhook-component-test * add-api-pane-pointer
1 parent 8531e1b commit 37a56b1

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

docs/docs/Components/components-data.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,28 @@ This component fetches content from one or more URLs, processes the content, and
194194

195195
## Webhook
196196

197-
This component defines a webhook input for the flow. The flow can be triggered by an external HTTP POST request (webhook) sending a JSON payload.
197+
This component defines a webhook trigger that runs a flow when it receives an HTTP POST request.
198198

199-
If the input is not valid JSON, the component wraps it in a "payload" field. The component's status reflects any errors on the processed data.
199+
If the input is not valid JSON, the component wraps it in a `payload` object so that it can be processed and still trigger the flow. The component does not require an API key.
200+
201+
When a **Webhook** component is added to the workspace, a new **Webhook cURL** tab becomes available in the **API** pane that contains an HTTP POST request for triggering the webhook component. For example:
202+
203+
```bash
204+
curl -X POST \
205+
"http://127.0.0.1:7860/api/v1/webhook/**YOUR_FLOW_ID**" \
206+
-H 'Content-Type: application/json'\
207+
-d '{"any": "data"}'
208+
```
209+
210+
To test the webhook component:
211+
212+
1. Add a **Webhook** component to the flow.
213+
2. Connect the **Webhook** component's **Data** output to the **Data** input of a [Data to Message](/components-processing#pasrse-data-data-to-message) component.
214+
3. Connect the **Data to Message** component's **Message** output to the **Text** input of a [Chat Output](/components-io#chat-output) component.
215+
4. To send a POST request, copy the code from the **Webhook cURL** tab in the **API** pane and paste it into a terminal.
216+
5. Send the POST request.
217+
6. Open the **Playground**.
218+
Your JSON data is posted to the **Chat Output** component, which indicates that the webhook component is correctly triggering the flow.
200219

201220
### Inputs
202221

docs/docs/Concepts/concepts-api.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,16 @@ Props with the type JSON need to be passed as stringified JSONs, with the format
206206
| width | Number | No | Sets the width of the chat window in pixels. |
207207
| window_title | String | No | Sets the title displayed in the chat window's header or title bar. |
208208
209+
## Webhook cURL
210+
211+
When a **Webhook** component is added to the workspace, a new **Webhook cURL** tab becomes available in the **API** pane that contains an HTTP POST request for triggering the webhook component. For example:
212+
213+
```bash
214+
curl -X POST \
215+
"http://127.0.0.1:7860/api/v1/webhook/**YOUR_FLOW_ID**" \
216+
-H 'Content-Type: application/json'\
217+
-d '{"any": "data"}'
218+
```
219+
220+
To test the **Webhook** component in your flow, see the [Webhook component](/components-data#webhook).
221+

0 commit comments

Comments
 (0)