Skip to content

VAP-9999: add API request tool docs + improve DTMF docs #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 135 additions & 17 deletions fern/tools/default-tools.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: Default Tools
subtitle: 'Adding Transfer Call, End Call, and Dial Keypad capabilities to your assistants.'
subtitle: 'Adding Transfer Call, End Call, Dial Keypad, and API Request capabilities to your assistants.'
slug: tools/default-tools
---

Vapi voice assistants are given additional functions: `transferCall`,`endCall`, and `dtmf` (to dial a keypad with [DTMF](https://en.wikipedia.org/wiki/DTMF)). These functions can be used to transfer calls, hang up calls, and enter digits on the keypad.
Vapi voice assistants are given additional functions: `transferCall`, `endCall`, `sms`, `dtmf` (to dial a keypad with [DTMF](https://en.wikipedia.org/wiki/DTMF)), and `apiRequest`. These functions can be used to transfer calls, hang up calls, send SMS messages, enter digits on the keypad, and integrate business logic with your existing APIs.

<Info>
To add Default Tools to your agent, you need to add them in the `tools` array of your assistant. You can do this in your api request, or by creating a new tool in the dashboard tools page, and assigning it to your assistant.
Expand Down Expand Up @@ -94,6 +94,7 @@ This function is provided when `sms` is included in the assistant's list of avai
#### Dial Keypad (DTMF)

This function is provided when `dtmf` is included in the assistant's list of available tools (see configuration options [here](/api-reference/assistants/create#request.body.model.openai.tools.dtmf)). The assistant will be able to enter digits on the keypad.
Useful for IVR navigation or data entry.

```json
{
Expand Down Expand Up @@ -122,31 +123,148 @@ There are three methods for sending DTMF in a phone call:
3. **Out-of-band via SIP INFO messages**: tones are sent as separate SIP INFO messages. While this can be more reliable than in-band DTMF, it's not as widely supported as the RFC 2833 method.

<Note>
Vapi's DTMF tool uses in-band method. Please note that this method may not work with certain IVRs. If you are running into this issue, the recommended approach is to have your assistant say the options out loud if available. For example, when an IVR says "Press 1 or say Sales for the Sales department," prefer having the assistant say "Sales."
Vapi's DTMF tool integrates with telephony provider APIs to send DTMF tones using the out-of-band RFC 2833 method. This approach is widely supported and more reliable for transmitting the signals, especially in VoIP environments.
Note, the tool's effectiveness depends on the IVR system's configuration and their capturing method. If you are running into issues, try different telephony providers or have your assistant say the options out loud if available.
</Note>

##### Tool Effectiveness
#### API Request

To evaluate this tool, we set up a Vapi assistant with the DTMF tool enabled and conducted calls to a range of IVR systems, including a Twilio IVR (configured via Studio Flows) and several third-party IVRs such as pharmacies and insurance companies.
This tool allows your assistant to make HTTP requests to any external API endpoint during conversations. This tool fills the gap between Vapi and your existing business logic, bringing your own endpoints into the conversation flow.
See configuration options [here](/api-reference/tools/create).

**Testing Methodology**
##### Dynamic Variables with LiquidJS

We called and navigated through the IVRs using three different strategies:
Use **LiquidJS syntax** to reference conversation variables and user data in your URLs, headers, and request bodies. This allows your API requests to adapt dynamically based on the conversation context.

1. **Direct Dialpad**: calling from a personal phone and dialing options using the dialpad.
2. **Vapi DTMF Tool**: an assistant configured with the DTMF tool.
3. **Manual DTMF Sound**: calling from a personal phone and playing DTMF tones generated by software. _(similar approach as the Vapi DTMF Tool)_
##### Basic Examples

**Key Findings**

- The assistant successfully navigated some of the third-party IVRs.
- The assistant encountered issues with Twilio IVRs, likely due to Twilio's preference for RFC 2833.
- Observed occasional delays in DTMF tone transmission, which may affect effectiveness with IVRs that have short timeouts.
**GET Request Example**
```json
{
"model": {
"provider": "openai",
"model": "gpt-4o",
"messages": [
{
"role": "system",
"content": "You help users check their order status. When they provide an order number, use the checkOrderStatus function."
}
],
"tools": [
{
"type": "apiRequest",
"function": {
"name": "api_request_tool"
},
"name": "checkOrderStatus",
"url": "https://api.yourcompany.com/orders/{{orderNumber}}",
"method": "GET",
"body": {
"type": "object",
"properties": {
"orderNumber": {
"description": "The user's order number",
"type": "string"
}
},
"required": ["orderNumber"]
}
}
]
}
}
```

**Conclusion**
**POST Request Example**
```json
{
"model": {
"provider": "openai",
"model": "gpt-4o",
"messages": [
{
"role": "system",
"content": "You help users book appointments. When they want to schedule, use the bookAppointment function."
}
],
"tools": [
{
"type": "apiRequest",
"function": {
"name": "api_request_tool"
},
"name": "bookAppointment",
"url": "https://api.yourcompany.com/appointments",
"method": "POST",
"headers": {
"type": "object",
"properties": {
"x-api-key": {
"type": "string",
"value": "123456789"
}
}
},
"body": {
"type": "object",
"properties": {
"date": {
"description": "The date of the appointment",
"type": "string"
},
"customerName": {
"description": "The name of the customer",
"type": "string"
},
"customerPhoneNumber": {
"description": "The phone number of the customer",
"type": "string"
}
},
"required": [
"date",
"customerName",
"customerPhoneNumber"
]
}
}
]
}
}
```

The tool's effectiveness depends on the IVR system's configuration and DTMF capturing method. We are working to improve compatibility and reduce transmission delays for broader and more reliable support.
##### Advanced Configuration

**With Retry Logic**
```json
{
"type": "apiRequest",
"function": {
"name": "api_request_tool"
},
"name": "checkOrderStatus",
"url": "https://api.yourcompany.com/orders/{{orderNumber}}",
"method": "GET",
"body": {
"type": "object",
"properties": {
"orderNumber": {
"description": "The user's order number",
"type": "string"
}
},
"required": [
"orderNumber"
]
},
"backoffPlan": {
"type": "exponential",
"maxRetries": 3,
"baseDelaySeconds": 1
},
"timeoutSeconds": 45
}
```

<Accordion title="Custom Functions: Deprecated">
### Custom Functions
Expand Down
Loading