> ## Documentation Index
> Fetch the complete documentation index at: https://dialnexa.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Custom Function Nodes In DialNexa Workflows

> Call a public HTTP API from a DialNexa workflow with custom function nodes, templates, response variables, and success or failure branches.

Custom Function nodes let a DialNexa workflow call a public HTTP API and route the lead based on the response. Configure the request, map response values into lead variables, and connect both Success and Failure outputs before activating the workflow.

<img src="https://mintcdn.com/dialnexa/mx2NwRoHMy0C3T9I/images/documentation/screenshots/workflow-custom-function-node.png?fit=max&auto=format&n=mx2NwRoHMy0C3T9I&q=85&s=15827565d199e7e065c86e1e71c35471" alt="DialNexa workflow builder showing a Custom Function node with a POST endpoint, lead-variable JSON body, response mapping, timeout, and output connectors." style={{ width: '100%', maxWidth: '980px', margin: '8px 0 24px', border: '1px solid #e5e7eb', borderRadius: '6px' }} width="1158" height="1074" data-path="images/documentation/screenshots/workflow-custom-function-node.png" />

## When To Use Custom Function Nodes

Use a Custom Function node when a workflow must read or update a system that is not available as a connected DialNexa integration. Examples include checking eligibility, creating a record in an internal application that has a public API, or fetching a value used by a later Conditional node.

Use an [Application node](/docs/workflows/application-nodes) when DialNexa already provides the required connected integration action.

## Before You Begin

* Prepare a public `http` or `https` endpoint. Localhost, private network, and other non-public addresses are blocked.
* Decide which lead variables the request needs and add workflow fallback values for required variables that no earlier node creates.
* Decide which response values later nodes need.
* Design separate Success and Failure paths.
* Avoid placing credentials in the URL. Send authentication through request headers.

## Configure The Request

| Setting            | Supported value                                                   |
| ------------------ | ----------------------------------------------------------------- |
| Function name      | A readable name used in the builder and execution evidence.       |
| Endpoint           | A public `http` or `https` URL without embedded credentials.      |
| Method             | `GET`, `POST`, `PUT`, `PATCH`, or `DELETE`.                       |
| Headers            | Key-value request headers.                                        |
| Query parameters   | Key-value URL query parameters.                                   |
| JSON body          | A valid JSON body for methods other than `GET`.                   |
| Timeout            | 1,000 to 30,000 milliseconds. The default is 10,000 milliseconds. |
| Response variables | A lead-variable key and a response path for each value to store.  |
| Outputs            | One destination for Success and one for Failure.                  |

Request URLs, headers, query parameters, and body values can reference lead variables with `{{variable_name}}`. In JSON values, use `{{json variable_name}}` when the inserted value must remain a JSON number, boolean, object, array, or `null` instead of becoming a string.

## Map Response Variables

Each response-variable row has a key and a path. The key becomes a lead dynamic variable. The path selects a value from the response body.

| Response body                        | Path            | Stored result                |
| ------------------------------------ | --------------- | ---------------------------- |
| `{ "customer": { "tier": "gold" } }` | `customer.tier` | `gold`                       |
| `{ "items": [{ "id": 42 }] }`        | `items[0].id`   | `42`                         |
| Any complete JSON response           | `$`             | The complete response value. |

Objects and arrays are stored as JSON text. A missing or `null` path becomes an empty value. Later nodes can reference the stored key through their normal lead-variable controls.

## Build A Safe Success And Failure Flow

<Steps>
  <Step title="Add the node">
    Drag a Custom Function node onto the workflow canvas and give it a clear function name.
  </Step>

  <Step title="Configure the request">
    Select the HTTP method, enter the public endpoint, and add the required headers, query parameters, and JSON body.
  </Step>

  <Step title="Add response variables">
    Map only the response values that later nodes need. Use dot paths or array indexes to select nested values.
  </Step>

  <Step title="Connect both outputs">
    Send Success to the normal next step. Send Failure to a retry, wait, notification, or intentional terminal path.
  </Step>

  <Step title="Provide required fallbacks">
    Add fallback values for required lead variables unless an earlier Custom Function node produces them on every path.
  </Step>

  <Step title="Test with one lead">
    Run a controlled test, then inspect lead history and invocation evidence before adding production leads.
  </Step>
</Steps>

## Request And Response Limits

* HTTP status codes from `200` through `299` use the Success output. Other status codes and request errors use Failure.
* A response body can be at most 512 KiB.
* DialNexa follows at most three redirects.
* Authentication, API key, token, secret, and cookie headers are removed before a cross-origin redirect.
* Each redirect target is checked again and must resolve to a public address.
* Request and response evidence is recorded with sensitive values redacted where supported.

## Verify The Result

Open the workflow lead history and confirm the node followed the expected output. Review the HTTP status, latency, invocation ID, and stored response-variable keys. Then inspect the next Conditional, Call, or Application node to confirm it received the expected values.

## Troubleshooting

<AccordionGroup>
  <Accordion title="The endpoint is rejected before execution">
    Use a public HTTP or HTTPS URL. Remove embedded credentials and confirm DNS does not resolve to localhost, private, link-local, or another non-public address.
  </Accordion>

  <Accordion title="A template value is blank">
    Add the lead variable to the uploaded lead, create it in an earlier Custom Function node, or configure a workflow fallback value.
  </Accordion>

  <Accordion title="A response variable is blank">
    Compare the configured path with the actual JSON response. Check property spelling, array indexes, and whether the endpoint returned an empty or `null` value.
  </Accordion>

  <Accordion title="The node follows Failure on a valid-looking response">
    Confirm the endpoint returned a `2xx` status within the timeout and that its response stayed below the size limit.
  </Accordion>
</AccordionGroup>

## Related Pages

<CardGroup cols={2}>
  <Card title="Workflow Builder Concepts" icon="square-chart-gantt" href="/docs/workflows/builder-concepts">
    Understand nodes, edges, configs, and outputs.
  </Card>

  <Card title="Lead Variables" icon="braces" href="/docs/workflows/lead-variables-and-call-attributes">
    Supply request values and fallback data.
  </Card>

  <Card title="Lead History" icon="route" href="/docs/workflows/lead-history-and-debugging">
    Review execution and branch evidence.
  </Card>

  <Card title="Application Nodes" icon="plug" href="/docs/workflows/application-nodes">
    Use connected integration actions.
  </Card>
</CardGroup>
