evodesk
Back to Home

AI Call System - Technical Setup Guide

How to connect real phone service so AI actually answers calls with custom prompts

Option 1: Vapi.ai (RECOMMENDED)

Why Vapi: Easiest setup, handles all telephony, built-in OpenAI integration, ~$0.05-0.10/min

Step 1: Enable Backend Functions

Go to Base44 Dashboard → Settings → Enable Backend Functions

This lets you create server-side code that Vapi can call

Step 2: Create Function to Get User Instructions

Create this backend function in Base44:

// functions/getAIInstructions.js
export default async function getAIInstructions({ phone_number }) {
  const configs = await base44.entities.AIConfiguration.filter({ 
    assigned_phone: phone_number 
  });
  
  if (configs.length === 0) {
    return {
      instructions: "Hello, thank you for calling.",
      company_name: "Our Company"
    };
  }
  
  const config = configs[0];
  return {
    instructions: config.ai_instructions,
    company_name: config.company_name,
    voice_accent: config.voice_accent,
    voice_tone: config.voice_tone
  };
}

Step 3: Get Vapi API Key

Sign up at vapi.ai and get your API key

Store it in Base44: Settings → Secrets → Add "VAPI_API_KEY"

Step 4: Create Vapi Assistant

In Vapi dashboard, create assistant and configure:

  • • System prompt: Pull from your Base44 function
  • • Voice settings: Match user preferences
  • • Webhook URL: Point to your Base44 function

Step 5: Auto-Provision Numbers

Add this to your Onboarding completion:

const response = await fetch('https://api.vapi.ai/phone-number', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_VAPI_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    provider: "twilio",
    assistantId: "your-assistant-id"
  })
});

const { phoneNumber } = await response.json();

// Save to user's config
await base44.entities.AIConfiguration.update(configId, {
  assigned_phone: phoneNumber,
  status: 'active'
});

Option 2: Bland.ai (Good Alternative)

Simpler API, less customization than Vapi

Quick Setup:

const response = await fetch('https://api.bland.ai/v1/agents', {
  method: 'POST',
  headers: {
    'authorization': 'YOUR_BLAND_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    prompt: userConfig.ai_instructions,
    voice: userConfig.voice_accent,
    phone_number: "buy_new"
  })
});

Get API key from bland.ai

Option 3: Twilio + OpenAI (Full Control)

Warning: Much more complex. Requires webhook setup, WebSocket handling, and OpenAI Realtime API integration.

You'll need:

  • • Twilio account + API credentials
  • • OpenAI API key (Realtime API access)
  • • WebSocket server for audio streaming
  • • TwiML webhook handlers

See Twilio's WebSocket documentation for full implementation

Testing Without Buying Numbers

  • • Vapi offers test numbers in their dashboard
  • • Call the test number to verify it reads your user's custom instructions
  • • Once working, enable production mode to provision real numbers

Security Notes

  • • Store API keys in Base44 Secrets (Settings → Secrets)
  • • Never expose API keys in frontend code
  • • Use backend functions for all API calls
  • • Validate all incoming webhook requests