Skip to main content

What are Custom Functions?

Custom functions allow you to extend your AI agent’s capabilities by integrating with external APIs or writing custom business logic. Unlike built-in functions, custom functions are fully configurable to match your specific needs. Three Types:
  • Pre-Call - Modify system prompt and metadata before call starts
  • In-Call - Execute actions during active calls
  • Post-Call - Process call data after call ends

Basic vs Advanced Mode

Basic Mode (API Integration)

Configure functions through a user-friendly interface without writing code. Features:
  • API URL configuration
  • HTTP method selection (GET, POST, PUT, DELETE)
  • Headers and authentication
  • Parameter mapping from call data
  • Perfect for integrating with existing APIs

Advanced Mode (Custom Code)

Write Python or JavaScript code for complex business logic. Features:
  • Full programming capabilities
  • AI-powered code generation - Generate functions using AI
  • Pre-imported libraries (axios, moment, lodash for post-call)
  • Security-validated execution environment
  • Complete control over function behavior
Start with Basic Mode for simple API integrations, then upgrade to Advanced Mode when you need custom logic.

Function Types Comparison

Key Differences

FeaturePre-CallIn-CallPost-Call
Execution TimeBefore call startsDuring active callAfter call ends
Language (Advanced)PythonPythonJavaScript
Description RequiredNoYes (AI trigger)No
ParametersOptionalRequired (typed)JSON with mapping
Primary UseSetup & customizationReal-time actionsData processing

Common Use Cases

Pre-Call Functions

  • Fetch user preferences from database
  • Customize system prompt based on lead data
  • Set language and greeting based on region
  • Load context from CRM

In-Call Functions

  • Check inventory availability
  • Book appointments (non-Cal.com)
  • Validate customer data
  • Query databases
  • Call external APIs during conversation

Post-Call Functions

  • Calculate next date of action (NDOA)
  • Update CRM with call results
  • Send follow-up emails
  • Generate reports
  • Trigger workflows based on call outcome

Getting Started

1

Choose Function Type

Select pre-call, in-call, or post-call based on when you need the function to execute
2

Select Mode

Basic for API integration, Advanced for custom code
3

Configure Function

Set up API details or write code
4

Test

Test your function with sample calls
Advanced mode functions can be generated using AI. Click “Generate with AI” in the code editor!

Variable Mapping

All custom functions can access call data through variable mapping: Available Sources:
  • Call Metadata - Fields you define (name, email, phone, etc.)
  • Post-Call Variables - AI-extracted data from conversation
  • Static Values - Fixed text or numbers
This allows your functions to use real call data when making API calls or executing logic.

Next Steps

Choose a function type to learn more: