For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
WebsiteStatusSupportDashboard
DocumentationAPI ReferenceMCPSDKsCLI (new)What's New?
DocumentationAPI ReferenceMCPSDKsCLI (new)What's New?
  • Get started
    • Introduction
    • Phone calls
    • Web calls
    • Vapi Guides
    • Composer
    • CLI quickstart
  • Assistants
    • Quickstart
      • Variables
      • Multilingual support
      • Personalization with user information
      • Voice formatting plan
      • Flush syntax
      • Background messages
      • Idle messages
      • Assistant hooks
      • Background speech denoising
      • Pronunciation dictionaries
      • Email address reading
    • Tools
    • Custom keywords
    • Custom voices
    • Custom transcriber
    • Custom TTS
  • Observability
    • Boards
  • Squads
    • Quickstart
    • Overview
    • Handoff tool
    • Passing data between assistants
  • Best practices
    • Prompting guide
    • Debugging voice agents
    • Enterprise environments (DEV/UAT/PROD)
    • IVR navigation
  • Phone numbers
    • Free Vapi number
    • Inbound SMS
    • Phone Number Hooks
  • Calls
    • Call end reasons
    • Troubleshoot call errors
  • Outbound Campaigns
    • Quickstart
    • Overview
  • Chat
    • Quickstart
    • Streaming
    • Non-streaming
    • OpenAI compatibility
    • Session management
    • Variable substitution
    • SMS chat
    • Web widget
    • Webhooks
  • Workflows
    • Quickstart
    • Overview
LogoLogo
WebsiteStatusSupportDashboard
On this page
  • Overview
  • How Personalization Works
  • Prerequisites
  • Implementation
  • Error Handling
  • Common Issues
AssistantsConversation behavior

Personalization with user information

Add customer-specific information to your voice assistant conversations

Was this page helpful?
Edit this page
Previous

Voice formatting plan

Format LLM output for natural-sounding speech

Next
Built with

Overview

Personalization lets you include customer-specific information in your voice assistant conversations. When a customer calls, your server can provide data about that customer, which is then used to tailor the conversation in real time.

This approach is ideal for use cases like customer support, account management, or any scenario where the assistant should reference details unique to the caller.

How Personalization Works

1

Customer Calls Your Number

When a call comes in, Vapi sends a request to your server instead of using a fixed assistant configuration.

2

Your Server Looks Up the Caller

Your server receives the request, identifies the caller (for example, by phone number), and fetches relevant customer data from your database or CRM.

3

Your Server Responds with Assistant Details

Your server responds to Vapi with either:

  • An existing assistant ID and a set of dynamic variables to personalize the conversation, or
  • A complete assistant configuration, with customer data embedded directly in the prompts or instructions.
4

Vapi Handles the Call

Vapi uses the personalized assistant configuration or variables to guide the conversation, referencing the customer’s information as needed.

Prerequisites

  • A Vapi phone number
  • A created Vapi Assistant
  • A server endpoint to receive Vapi’s requests

Implementation

1

Add Dynamic Variables to Your Assistant

Use variable placeholders in your assistant’s instructions or messages with the {{variable_name}} syntax.

Example:
"Hello {{customerName}}! I see you've been a {{accountType}} customer since {{joinDate}}."

2

Configure Your Phone Number to Use Your Server

Update your phone number so that Vapi sends incoming call events to your server, rather than using a static assistant.

1PATCH /phone-number/{id}
2{
3 "assistantId": null,
4 "squadId": null,
5 "server": {
6 "url": "https://your-server.com/api/assistant-selector"
7 }
8}

Your server must respond within 7.5 seconds, or the call will fail.

3

Implement Your Server Endpoint

Your server should handle POST requests from Vapi and return either:

Option 1: Use an Existing Assistant with Dynamic Variables

1app.post("/api/assistant-selector", async (req, res) => {
2 if (req.body.message?.type === "assistant-request") {
3 const phoneNumber = req.body.call.from.phoneNumber;
4 const customer = await crmAPI.getCustomerByPhone(phoneNumber);
5
6 res.json({
7 assistantId: "asst_customersupport",
8 assistantOverrides: {
9 variableValues: {
10 customerName: customer.name,
11 accountType: customer.tier,
12 joinDate: customer.createdAt
13 }
14 }
15 });
16 }
17});

Option 2: Return a Complete Assistant Configuration

1app.post("/api/assistant-selector", async (req, res) => {
2 if (req.body.message?.type === "assistant-request") {
3 const phoneNumber = req.body.call.from.phoneNumber;
4 const customer = await crmAPI.getCustomerByPhone(phoneNumber);
5
6 res.json({
7 assistant: {
8 name: "Dynamic Customer Support Assistant",
9 model: {
10 provider: "openai",
11 model: "gpt-4o",
12 messages: [{
13 role: "system",
14 content: `You are helping ${customer.name}, a ${customer.tier} member since ${customer.createdAt}.`
15 }]
16 },
17 voice: {
18 provider: "11labs",
19 voiceId: "shimmer"
20 }
21 }
22 });
23 }
24});

Error Handling

If your server encounters an error or cannot find the customer, return a response like this to end the call with a spoken message:

1{
2 "error": "Unable to find customer record. Please try again later."
3}

Common Issues

  • Use the exact {{variable_name}} syntax for variables in your assistant configuration.
  • Your server must respond within 7.5 seconds.
  • Implement fallbacks for missing or incomplete customer data.
  • Ensure your endpoint is highly available to avoid missed calls.