> ## 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.

# DialNexa Custom Functions

> Configure DialNexa custom functions with API endpoints, authentication, parameters, JSON schemas, timeouts, and response variables.

DialNexa custom functions let an agent call your external API during a conversation. Use a custom function when the agent needs live data or needs to create something in a system that is not already handled by a dashboard integration.

<img src="https://mintcdn.com/dialnexa/0efoAN-6So4r-6NC/images/documentation/screenshots/custom-function-modal.png?fit=max&auto=format&n=0efoAN-6So4r-6NC&q=85&s=c885de7165b638c47a3d76dc5a5570b6" alt="DialNexa Custom Function modal showing name, description, holding message, API endpoint, API token, timeout, headers, and save controls." style={{ width: '100%', maxWidth: '800px', margin: '8px 0 24px', border: '1px solid #e5e7eb', borderRadius: '6px' }} width="1138" height="1838" data-path="images/documentation/screenshots/custom-function-modal.png" />

<Warning>
  A custom function turns a conversation into an integration. That is useful, and also a reason to test like you mean it.
</Warning>

## Custom Function Fields

Each field changes how the agent calls the external service.

| Field              | Purpose                                                                   |
| ------------------ | ------------------------------------------------------------------------- |
| Description        | Tells the model when and why to use the function.                         |
| API Endpoint       | The URL of the service the function calls.                                |
| HTTP Method        | The request method used by the function.                                  |
| API Token          | Optional bearer-style credential for the target API.                      |
| Timeout            | Maximum wait time in milliseconds. The default reducer value is `120000`. |
| Headers            | Additional key-value headers.                                             |
| Query Parameters   | Key-value values appended to the URL.                                     |
| Response Variables | Named values the agent can use after the API response.                    |
| JSON Schema        | Defines the format the model should return for function arguments.        |

Use [dashboard integrations](/docs/dashboard-integrations/overview) when the action is available as a managed provider connection. Use a custom function when you own the API contract, need custom authentication, or need response variables from your own service during the call.

## Dynamic Authorization For Chained API Calls

Custom function authentication can use values returned or supplied during the same tool call flow. This is useful when one function obtains a token and a later function must send that token to another API.

| Pattern          | Behavior                                                                                                                |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------- |
| Static API token | Saved token is sent as `Authorization` when no custom header already sets it.                                           |
| Token argument   | Arguments named `access_token`, `auth_token`, `api_token`, or `authorization` can be used for the Authorization header. |
| Template token   | API token values such as `Bearer %(access_token)s` are filled from function arguments.                                  |
| Template headers | Custom headers can also use `%(key)s` substitutions from function arguments.                                            |

Bare token values are normalized to `Bearer <token>` when they come from token argument fields. If the argument is named `authorization`, DialNexa sends the value as provided.

## Example JSON Schema Pattern

```json theme={null}
{
  "type": "object",
  "properties": {
    "customer_id": { "type": "string" },
    "requested_slot": { "type": "string" }
  },
  "required": ["customer_id"]
}
```

## Speech Behavior While A Function Runs

Callers should not sit in silence without context.

<CardGroup cols={2}>
  <Card title="Holding message" icon="message-circle" href="/docs/voice-ai/latency-turn-taking-and-interruptions">
    Short message spoken before calling the tool, useful when the API may take time.
  </Card>

  <Card title="Speak during execution" icon="volume-2" href="/docs/agent-settings/functions">
    Allows the agent to keep the caller informed while the tool runs.
  </Card>

  <Card title="Speak after execution" icon="check-circle" href="/docs/monitoring/call-detail-page">
    Lets the agent explain the result after the tool returns.
  </Card>

  <Card title="Response variables" icon="braces" href="/docs/agents/dynamic-variables">
    Expose API result values that the agent can mention or use in the next turn.
  </Card>
</CardGroup>

## Custom Function Review Questions

<AccordionGroup>
  <Accordion title="Can the function fail gracefully?">
    Write prompt instructions for API errors, missing data, and timeouts.
  </Accordion>

  <Accordion title="Is the timeout realistic?">
    A very long timeout may keep a caller waiting. A very short one may fail healthy APIs.
  </Accordion>

  <Accordion title="Are secrets in the right place?">
    Use the API token or connection fields, not dynamic variables in prompts.
  </Accordion>

  <Accordion title="Can the model produce valid arguments?">
    Keep JSON schema simple and test edge cases.
  </Accordion>
</AccordionGroup>

## Related Reading

<CardGroup cols={2}>
  <Card title="Functions" icon="settings" href="/docs/agent-settings/functions">
    See all function types.
  </Card>

  <Card title="External Webhooks" icon="webhook" href="/docs/api-access/external-webhooks">
    Configure event delivery separately.
  </Card>

  <Card title="Dashboard Integrations" icon="plug" href="/docs/dashboard-integrations/overview">
    Use managed provider actions when they fit the job.
  </Card>

  <Card title="Testing Agents" icon="phone-call" href="/docs/agents/testing-agents">
    Test function calls in real calls.
  </Card>
</CardGroup>
