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
Function Types Comparison
Pre-Call Functions
Modify system prompt and metadata before calls start
In-Call Functions
Execute actions during active calls with AI triggers
Post-Call Functions
Process call data and execute business logic after calls
Key Differences
| Feature | Pre-Call | In-Call | Post-Call |
|---|---|---|---|
| Execution Time | Before call starts | During active call | After call ends |
| Language (Advanced) | Python | Python | JavaScript |
| Description Required | No | Yes (AI trigger) | No |
| Parameters | Optional | Required (typed) | JSON with mapping |
| Primary Use | Setup & customization | Real-time actions | Data 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