docs: add webhook auth note (#8015)
* webhook-update * remove-trailing-space-to-restart-ci
This commit is contained in:
parent
9ee4df696e
commit
e3bce8b8d8
2 changed files with 24 additions and 21 deletions
|
|
@ -97,4 +97,4 @@ Langflow provides multiple caching options that can be configured using the `LAN
|
||||||
|
|
||||||
- Linux/WSL: `~/.cache/langflow/`
|
- Linux/WSL: `~/.cache/langflow/`
|
||||||
- macOS: `/Users/<username>/Library/Caches/langflow/`
|
- macOS: `/Users/<username>/Library/Caches/langflow/`
|
||||||
- Windows: `%LOCALAPPDATA%\langflow\langflow\Cache`
|
- Windows: `%LOCALAPPDATA%\langflow\langflow\Cache`
|
||||||
|
|
@ -13,36 +13,39 @@ To connect the **Webhook** to a **Parser** component to view and parse your data
|
||||||
2. Add a [Parser](/components-processing#parser) component to your flow.
|
2. Add a [Parser](/components-processing#parser) component to your flow.
|
||||||
3. Connect the **Webhook** component's **Data** output to the **Parser** component's **Data** input.
|
3. Connect the **Webhook** component's **Data** output to the **Parser** component's **Data** input.
|
||||||
4. In the **Template** field of the **Parser** component, enter a template for parsing the **Webhook** component's input into structured text.
|
4. In the **Template** field of the **Parser** component, enter a template for parsing the **Webhook** component's input into structured text.
|
||||||
Create variables for values in the `template` the same way you would in a [Prompt](/components-prompts) component.
|
:::important
|
||||||
For example, to parse `id`, `name`, and `email` strings:
|
The component may fail to build because it needs data from the **Webhook** first.
|
||||||
```text
|
If you experience issues, change the **Mode** on the **Parser** component to **Stringify**, so the component outputs a single string.
|
||||||
ID: {id} - Name: {name} - Email: {email}
|
:::
|
||||||
```
|
Create variables for values in the `template` the same way you would in a [Prompt](/components-prompts) component.
|
||||||
|
For example, to parse `id`, `name`, and `email` strings:
|
||||||
:::important
|
```text
|
||||||
The component may fail to build because it needs data from the **Webhook** first.
|
ID: {id} - Name: {name} - Email: {email}
|
||||||
If you experience issues, change the **Mode** on the **Parser** component to **Stringify**, so the component outputs a single string.
|
```
|
||||||
:::
|
|
||||||
|
|
||||||
5. In the **Endpoint** field of the **Webhook** component, copy the API endpoint for your external requests.
|
5. In the **Endpoint** field of the **Webhook** component, copy the API endpoint for your external requests.
|
||||||
6. Optionally, to retrieve a complete example request from the component, click **Controls**, and then copy the command from the **cURL** value field.
|
6. Optionally, to retrieve a complete example request from the component, click **Controls**, and then copy the command from the **cURL** value field.
|
||||||
|
:::important
|
||||||
|
The default curl command includes a field for `x-api-key`. This field is **optional** and can be deleted from the command if you aren't using authentication.
|
||||||
|
:::
|
||||||
7. Send a POST request with any data to trigger your flow.
|
7. Send a POST request with any data to trigger your flow.
|
||||||
This example uses `id`, `name`, and `email` strings.
|
This example uses `id`, `name`, and `email` strings.
|
||||||
Replace **YOUR_FLOW_ID** with your flow ID.
|
Replace **YOUR_FLOW_ID** with your flow ID.
|
||||||
```text
|
```text
|
||||||
curl -X POST "http://127.0.0.1:7860/api/v1/webhook/YOUR_FLOW_ID" \
|
curl -X POST "http://127.0.0.1:7860/api/v1/webhook/YOUR_FLOW_ID" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{"id": "12345", "name": "alex", "email": "alex@email.com"}'
|
-d '{"id": "12345", "name": "alex", "email": "alex@email.com"}'
|
||||||
```
|
```
|
||||||
|
|
||||||
This response indicates Langflow received your request:
|
This response indicates Langflow received your request:
|
||||||
```
|
|
||||||
{"message":"Task started in the background","status":"in progress"}
|
```text
|
||||||
```
|
{"message":"Task started in the background","status":"in progress"}
|
||||||
|
```
|
||||||
|
|
||||||
8. To view the data received from your request, in the **Parser** component, click <Icon name="TextSearch" aria-label="Inspect icon" />.
|
8. To view the data received from your request, in the **Parser** component, click <Icon name="TextSearch" aria-label="Inspect icon" />.
|
||||||
|
|
||||||
You should see a string of parsed text, like `ID: 12345 - Name: alex - Email: alex@email.com`.
|
You should receive a string of parsed text, like `ID: 12345 - Name: alex - Email: alex@email.com`.
|
||||||
|
|
||||||
You have successfully parsed data out of an external JSON payload.
|
You have successfully parsed data out of an external JSON payload.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue