Skip to content

Commit b53d08f

Browse files
authored
updates workflow docs for Gather and API Request (#287)
* more details on Gather and Api Request * slash
1 parent 95f2b95 commit b53d08f

File tree

2 files changed

+63
-3
lines changed

2 files changed

+63
-3
lines changed

fern/workflows/nodes/api-request.mdx

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,62 @@ The **API Request** enables your workflow to interact with external APIs. It sup
2222

2323
## Usage
2424

25-
Use the API Request to fetch information from an external API to use in your workflow, or to update information in your CRM or database.
25+
Use the API Request to fetch information from an external API to use in your workflow, or to update information in your CRM or database.
26+
27+
1. **HTTP Configuration**: Enter the URL you want the workflow to call and select the HTTP method.
28+
2. **API Metadata**: Specify key-value pairs for Headers and Body (for POST requests). This allows you to include authentication tokens and payload data with your API request.
29+
3. **Define Output**: Set the expected output schema for the API response. This schema is used to extract variables that can be utilized later in your workflow.
30+
31+
For example, if the expected API response is
32+
```jsx
33+
{
34+
"name": "Jaden Dearsley",
35+
"age": 25,
36+
"isActive": true,
37+
}
38+
```
39+
40+
Define an output JSON schema for the API request with
41+
```jsx
42+
{
43+
...
44+
"output": {
45+
"type": "object",
46+
"properties": {
47+
"name": {
48+
"type": "string",
49+
"description": "name of the user",
50+
},
51+
"age": {
52+
"type": "number",
53+
"description": "age of the user",
54+
},
55+
"isActive": {
56+
"type": "boolean",
57+
"description": "whether the user is active",
58+
}
59+
}
60+
},
61+
}
62+
```
63+
64+
This will make `name`, `age`, and `isActive` available as variables for use throughout the rest of the workflow. To rename a variable, use the `target` option to specify a different variable name.
65+
66+
```jsx
67+
{
68+
...
69+
"output": {
70+
"type": "object",
71+
"properties": {
72+
"name": {
73+
"type": "string",
74+
"description": "name of the user",
75+
"target": "user_name" // renamed "name" to "user_name"
76+
},
77+
...
78+
}
79+
},
80+
}
81+
```
82+
83+
If your expected output has a complex or nested structure, we support the full JSON schema through the API. Refer to the API documentation on [`output`](/api-reference/workflow/workflow-controller-create#request.body.nodes.apiRequest.output) for more details.

fern/workflows/nodes/gather.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ The **Gather** collects input from users during an interaction. It is used to ca
1313
Define one or more variables to gather from the user with:
1414
- **Name:** A unique identifier.
1515
- **Description:** Details about the expected input to help the LLM get the right information from the caller.
16-
- **Data Type:** String, number, or boolean.
16+
- **Data Type:** String, number, boolean, enum.
1717
- **Required:** Mark whether the variable is required or optional.
1818

1919
## Usage
2020

21-
Use **Gather** when you need to prompt users for information—such as their name, email, or ZIP code—that will drive subsequent conversation steps.
21+
Use **Gather** to extract specific details from user responses—such as their name, email, or ZIP code—to inform subsequent steps in your conversation. The Gather node doesn't directly prompt users; instead, it analyzes the conversation history to find the requested information and will ask follow-up questions if the user's response isn't clear. Make sure to precede it with a [`Say`](/workflows/nodes/say) node that explicitly prompts the user for the information you want to gather.
22+
23+
To use an extracted string variable in a [`Conditional`](/workflows/edges/logical-conditions) branch, we recommend using the `enum` option. This ensures the extracted value will reliably match your conditions later in the workflow.

0 commit comments

Comments
 (0)