Skip to main content

What are custom functions?

Custom functions let your Voice AI agent call your own APIs during live conversations. Check order status, update a CRM, book appointments, or integrate with any system - all while on a call.
Bolna custom functions follow the OpenAI function calling specification. If you’ve used OpenAI function calling before, you’ll feel right at home.
Bolna custom function configuration modal with dark code editor showing JSON schema with name test, description, pre_call_message, parameters with startTime and endTime, key custom_task, and value with method GET, url, api_token, and headers

Custom function JSON editor showing a function schema with name, description, pre_call_message, parameters, and API configuration


How custom functions work

1

LLM Reads Function Definition

The LLM sees your function’s name and description to understand what the function does
2

Decides When to Call

Based on conversation context, the LLM decides if this function should be triggered
3

Extracts Parameters

The LLM collects required parameter values from the conversation with the caller
4

Bolna Executes API Call

Bolna makes the HTTP request to your API endpoint with the extracted parameters
5

Response Feeds Back

The API response is returned to the LLM, which continues the conversation naturally
The description is everything. The LLM relies heavily on your description to know when to call the function. A vague description = unreliable triggering.

Creating a custom function

You can create a custom function in two ways from the Tools Tab:
Bolna Add a Custom Tool section with Custom Function card showing Write manually button and Generate from cURL button side by side

Add a Custom Tool section showing the Write manually and Generate from cURL options

Click Write manually to open the JSON editor and define the function schema from scratch. This gives you full control over every field.
Bolna custom function configuration modal with dark code editor, JSON schema with name test, description, pre_call_message, parameters, key custom_task, and value object with method, url, api_token, and headers

Custom function JSON editor with a sample schema showing name, description, pre_call_message, parameters, key, and API configuration

The fields name, description, key, and method are mandatory. The key must always be set to "custom_task".

Go deeper

Schema reference

Every field in the function definition and API configuration, plus %(name)s format specifiers.

Examples

Complete GET and POST request schemas you can copy and adapt.

Variables & context

Use prompt variables and auto-injected call data so the agent never asks for what it already knows.

Pre-call webhooks

Notify your system before the tool’s main API call runs, for example with a transfer reason.

Source IP whitelist

Bolna calls your endpoint from a fixed set of source IPs. If your API sits behind a firewall or an IP allowlist, permit all three or the tool call will fail and the agent will have nothing to say back to the caller:
The same IPs apply to pre-call webhooks and to post-call webhooks.

Best practices

Write detailed descriptions

Include synonyms and variations: “Use when customer asks about order status, shipping, delivery, or tracking”

Always add pre-call message

Set a friendly message like “Let me check that for you” so callers know to wait

Use required fields wisely

Only mark parameters as required if the function truly cannot work without them

Test APIs first

Verify your API works with tools like curl or Postman before adding to Bolna

Leverage auto-injection

Put known data in the agent prompt to avoid asking callers for information you already have

Match names exactly

Parameter names in properties and param must be identical (case-sensitive)

Troubleshooting

Cause: Description doesn’t match what the caller is saying.Fix: Make your description more comprehensive. Include synonyms and example phrases.
Cause: Incorrect URL, authentication, or headers.Fix: Test your API with curl or Postman first. Verify api_token format and required headers.
Cause: Typo or format specifier mismatch.Fix: Ensure parameter names match exactly between properties and param. Use %(name)s format.
Cause: Variable not defined in agent prompt.Fix: Add the variable to your agent prompt using {variable_name} syntax.

Next steps

Context variables

Learn about dynamic variable injection

Transfer calls

Route calls to human agents

Calendar integration

Book appointments via Cal.com

Using webhooks

Receive execution data, including pre-call webhooks

Agent API

Programmatic function configuration