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
    • Tools
      • Built-in call tools
      • Voicemail tool
      • Custom tools
      • Code tool
      • Client-side tools (Web SDK)
      • Tool rejection plan
      • Static variables and aliases
      • Custom tools troubleshooting
      • Handoff tool
      • Knowledge retrieval
      • Argument encryption
    • 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 it works
  • Voicemail behavior modes
  • How the modes map to the underlying fields
  • Configuration
  • Message configuration
  • Assistant voicemail message
  • Custom script mode
  • Skip mode (silent end-call)
  • Pre-recorded audio messages
  • Best practices
  • Detection prompting
  • Message structure
  • Error handling
  • Voicemail tool vs. automatic detection
  • Common use cases
  • Next steps
AssistantsTools

Voicemail Tool

Learn how to use the assistant-controlled voicemail tool for flexible voicemail handling

Was this page helpful?
Edit this page
Previous

Custom Tools

Learn how to create and configure Custom Tools for use by your Vapi assistants.
Next
Built with

Overview

The voicemail tool gives your assistant direct control over what happens when it reaches a voicemail system. Unlike automatic voicemail detection, which operates independently of your assistant, this tool lets your assistant decide when it’s hit voicemail and then either leave a configured message or silently end the call — depending on how you’ve set it up.

Key benefits:

  • Maximum flexibility — assistant decides when to invoke the tool, and you decide what happens when it does
  • Customizable — use template variables to personalize voicemails per call
  • Cost-effective — only triggers when needed
  • Simple integration — works like other built-in tools

How it works

When you add the voicemail tool to your assistant:

  1. Your assistant listens for voicemail indicators (greetings mentioning “unavailable”, “leave a message”, etc.)
  2. Upon detecting voicemail, the assistant calls the tool
  3. Depending on how you’ve configured the tool, it either delivers your configured message or skips speaking entirely
  4. The call ends automatically

This approach differs from automatic voicemail detection, which detects voicemail at the system level. The voicemail tool puts detection and response entirely in the assistant’s hands, so reliability depends heavily on your system prompt — see Detection prompting below for the indicators your prompt should explicitly call out.

Voicemail behavior modes

When you configure the voicemail tool, you choose what the caller hears once voicemail is detected:

ModeWhat happensWhen to use it
Use assistant voicemail messageThe tool falls back to the assistant’s top-level voicemailMessage field, then the call endsYou want the message managed at the assistant level rather than on the tool
Use custom scriptThe tool speaks a message specific to this tool, then the call endsYou want a voicemail message tailored to this assistant or campaign, with optional dynamic content via template variables
Skip speaking a voicemailThe call silently ends after the tool is invokedYou explicitly don’t want to leave a message but still need a reliable way to terminate calls on voicemail

How the modes map to the underlying fields

Two fields work together to drive these modes: the tool’s messages array (which can hold a request-start message with optional template variables) and the assistant-level voicemailMessage property. The dashboard radio buttons orchestrate these for you, but if you’re configuring via the API, set the fields directly:

ModeTool’s messagesAssistant’s voicemailMessage
Use assistant voicemail messageemptyset to the desired message
Use custom scriptrequest-start with contentignored — tool takes precedence
Skip speaking a voicemailemptyempty

Configuration

Add the voicemail tool to your assistant and configure your system prompt to invoke it when voicemail is detected.

Dashboard
API
  1. Go to Tools in the left nav and click Create Tool.
  2. Select Voicemail as the tool type.
  3. Give the tool a name and description. The description tells the LLM when to invoke the tool — keep it consistent with the voicemail-detection instruction you’ll add to your system prompt in step 7. Example: “Leave a voicemail message when you detect you’ve reached a voicemail system or auto-attendant.”
  4. Under Voicemail Script, choose a behavior mode: Use assistant voicemail message, Use custom script, or Skip speaking a voicemail. See Voicemail behavior modes for details.
  5. Save the tool.
  6. Attach the tool to your assistant: open the assistant, go to Tools, and add the voicemail tool you just created.
  7. Add a voicemail-detection instruction to your assistant’s system prompt. Without this, the LLM won’t know when to call the tool. See Detection prompting for indicators to include.

Voicemail tool configuration

Message configuration

Assistant voicemail message

To reuse the same voicemail across an assistant without configuring the tool separately, leave the tool’s messages empty and set voicemailMessage on the assistant:

API Configuration
1{
2 "voicemailMessage": "Hi, sorry I missed you — please give us a call back at 555-0100.",
3 "model": {
4 "provider": "openai",
5 "model": "gpt-4o",
6 "messages": [
7 {
8 "type": "system",
9 "content": "You are an outbound sales agent. If you detect a voicemail system, use the leave_voicemail tool to leave the configured message."
10 }
11 ],
12 "tools": [
13 {
14 "type": "voicemail",
15 "function": {
16 "name": "leave_voicemail",
17 "description": "Leave a voicemail when you detect a voicemail system"
18 },
19 "messages": []
20 }
21 ]
22 }
23}

Custom script mode

For custom-script mode, define the voicemail message inline:

API Configuration
1{
2 "model": {
3 "provider": "openai",
4 "model": "gpt-4o",
5 "messages": [
6 {
7 "type": "system",
8 "content": "You are a sales representative for Acme Corp. If at any point you determine you've reached a voicemail system, immediately use the leave_voicemail tool to deliver the configured message."
9 }
10 ],
11 "tools": [
12 {
13 "type": "voicemail",
14 "function": {
15 "name": "leave_voicemail",
16 "description": "Leave a voicemail message when you detect you've reached a voicemail system"
17 },
18 "messages": [
19 {
20 "type": "request-start",
21 "content": "Hi, this is {{company}}. {{message}}. Please call us back at {{phone}}."
22 }
23 ]
24 }
25 ]
26 }
27}

You can set a hardcoded message, or use template variables like {{company}}, {{message}}, and {{phone}} that are substituted at call time. See Variables for how to pass values.

Skip mode (silent end-call)

To silently terminate the call on voicemail, leave the tool’s messages array empty and clear voicemailMessage on the assistant:

API Configuration
1{
2 "model": {
3 "provider": "openai",
4 "model": "gpt-4o",
5 "messages": [
6 {
7 "type": "system",
8 "content": "You are calling prospects. If at any point you determine you've reached a voicemail system or auto-attendant (greeting mentions 'unavailable', 'leave a message', 'voicemail', 'press 1 for', etc.), immediately invoke the end_on_voicemail tool. Do not leave a message."
9 }
10 ],
11 "tools": [
12 {
13 "type": "voicemail",
14 "function": {
15 "name": "end_on_voicemail",
16 "description": "Silently end the call when you detect a voicemail system"
17 },
18 "messages": []
19 }
20 ]
21 }
22}

Use this mode for outbound outreach where the value is a live conversation and a missed voicemail is fine — silent termination keeps the call short and avoids the cost of running it to the max-duration cap.

Pre-recorded audio messages

For consistent quality and pronunciation, use pre-recorded audio files by providing the URL in the content field:

API Configuration
1{
2 "model": {
3 "provider": "openai",
4 "model": "gpt-4o",
5 "messages": [
6 {
7 "type": "system",
8 "content": "You are a sales representative for Acme Corp. If you detect a voicemail system, use the leave_voicemail tool to play our pre-recorded message."
9 }
10 ],
11 "tools": [
12 {
13 "type": "voicemail",
14 "function": {
15 "name": "leave_voicemail",
16 "description": "Leave a pre-recorded voicemail message"
17 },
18 "messages": [
19 {
20 "type": "request-start",
21 "content": "https://example.com/voicemail.mp3"
22 }
23 ]
24 }
25 ]
26 }
27}

Pre-recorded audio messages are ideal for brand-specific messaging or when you need precise pronunciation of phone numbers, website URLs, or company names. Supported formats: .wav and .mp3 files.

Best practices

Detection prompting

Be specific about voicemail indicators in your system prompt:

  • “unavailable”
  • “leave a message”
  • “voicemail”
  • “at the tone”
  • “beep”

For auto-attendants and IVR menus, add cues like:

  • “press 1 for…”
  • “for a list of departments”
  • “if you know your party’s extension”

Message structure

Keep voicemail messages:

  • Brief — under 30 seconds
  • Clear — state name, company, and purpose
  • Actionable — include callback number or next steps
  • Professional — match your brand voice

Error handling

Consider edge cases:

  • Long voicemail greetings
  • Voicemail box full scenarios
  • Systems requiring keypad input
  • Auto-attendants that loop their menu

Voicemail tool vs. automatic detection

FeatureVoicemail toolAutomatic detection
ControlAssistant-drivenSystem-driven
FlexibilityHigh — custom logic and behavior modesMedium — predefined behavior
CostLower — only when usedHigher — continuous monitoring
Setup complexitySimple — just add toolModerate — configure detection
Message customizationCustom message, assistant fallback, or no messageLimited to configured message
Detection accuracyDepends on promptProvider-specific (Vapi, Google, etc.)

Avoid combining the voicemail tool with automatic detection, as this could result in false positives and other complications.

Choose the voicemail tool when you need maximum flexibility and cost efficiency. Choose automatic detection when you need guaranteed system-level detection without relying on assistant prompting.

Common use cases

  • Sales outreach — personalized follow-up messages
  • Appointment reminders — leave detailed appointment information
  • Customer service — callback scheduling with ticket numbers
  • Lead qualification — leave targeted messages based on lead data
  • Outbound prospecting (no message) — cleanly terminate calls that hit voicemail when your strategy depends on live conversation

Next steps

  • Learn about other default tools
  • See how to create custom tools for your specific needs