diff --git a/fern/workflows/nodes/api-request.mdx b/fern/workflows/nodes/api-request.mdx index fb69f1e2c..cd1524243 100644 --- a/fern/workflows/nodes/api-request.mdx +++ b/fern/workflows/nodes/api-request.mdx @@ -22,4 +22,62 @@ The **API Request** enables your workflow to interact with external APIs. It sup ## Usage -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. \ No newline at end of file +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. + +1. **HTTP Configuration**: Enter the URL you want the workflow to call and select the HTTP method. +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. +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. + +For example, if the expected API response is +```jsx +{ + "name": "Jaden Dearsley", + "age": 25, + "isActive": true, +} +``` + +Define an output JSON schema for the API request with +```jsx +{ + ... + "output": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "name of the user", + }, + "age": { + "type": "number", + "description": "age of the user", + }, + "isActive": { + "type": "boolean", + "description": "whether the user is active", + } + } + }, +} +``` + +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. + +```jsx +{ + ... + "output": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "name of the user", + "target": "user_name" // renamed "name" to "user_name" + }, + ... + } + }, +} +``` + +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. \ No newline at end of file diff --git a/fern/workflows/nodes/gather.mdx b/fern/workflows/nodes/gather.mdx index 3c7609d6c..cfc87d4ee 100644 --- a/fern/workflows/nodes/gather.mdx +++ b/fern/workflows/nodes/gather.mdx @@ -13,9 +13,11 @@ The **Gather** collects input from users during an interaction. It is used to ca Define one or more variables to gather from the user with: - **Name:** A unique identifier. - **Description:** Details about the expected input to help the LLM get the right information from the caller. -- **Data Type:** String, number, or boolean. +- **Data Type:** String, number, boolean, enum. - **Required:** Mark whether the variable is required or optional. ## Usage -Use **Gather** when you need to prompt users for information—such as their name, email, or ZIP code—that will drive subsequent conversation steps. \ No newline at end of file +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. + +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. \ No newline at end of file