From 62ea1cffa56c8f18efac8133d50bd9155e9f44ec Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Tue, 24 Nov 2026 16:21:03 -0800 Subject: [PATCH] Added new pages for the SMS tool --- fern/chat/sms-chat.mdx | 1 + fern/docs.yml | 6 ++ fern/phone-numbers/inbound-sms.mdx | 1 + fern/tools/default-tools.mdx | 27 +----- fern/tools/introduction.mdx | 2 + fern/tools/send-text.mdx | 64 ++++++++++++++ fern/tools/send-text/configure.mdx | 134 +++++++++++++++++++++++++++++ 7 files changed, 211 insertions(+), 24 deletions(-) create mode 100644 fern/tools/send-text.mdx create mode 100644 fern/tools/send-text/configure.mdx diff --git a/fern/chat/sms-chat.mdx b/fern/chat/sms-chat.mdx index 04448c69a..43f0e26cb 100644 --- a/fern/chat/sms-chat.mdx +++ b/fern/chat/sms-chat.mdx @@ -115,6 +115,7 @@ Enhance your SMS chat implementation: * **[Chat API](/chat/quickstart)** - Understand the underlying chat technology * **[Session management](/chat/session-management)** - Learn how sessions work in detail * **[Assistant configuration](/assistants/quickstart)** - Optimize your assistant for text conversations +* **[Send Text tool](/tools/send-text)** - Let your assistant send a text during a voice call For the best SMS experience, configure your assistant with concise responses and clear conversation flows. SMS users expect quick, direct answers. diff --git a/fern/docs.yml b/fern/docs.yml index 5fbb85f45..d1f9bb59d 100644 --- a/fern/docs.yml +++ b/fern/docs.yml @@ -392,6 +392,12 @@ navigation: contents: - page: Configure the DTMF tool path: tools/dtmf/configure.mdx + - section: Send Text tool + path: tools/send-text.mdx + icon: fa-light fa-message-sms + contents: + - page: Configure the Send Text tool + path: tools/send-text/configure.mdx - section: SIP Request tool path: tools/sip-request.mdx icon: fa-light fa-phone-arrow-right diff --git a/fern/phone-numbers/inbound-sms.mdx b/fern/phone-numbers/inbound-sms.mdx index 001975078..04b3bf6e7 100644 --- a/fern/phone-numbers/inbound-sms.mdx +++ b/fern/phone-numbers/inbound-sms.mdx @@ -84,3 +84,4 @@ Now that you have inbound SMS enabled: * **[SMS chat](/chat/sms-chat)** - Learn how customers can have full conversations with your assistants via SMS * **[Session management](/chat/session-management)** - Understand how SMS conversations maintain context automatically * **[Chat quickstart](/chat/quickstart)** - Explore the underlying chat technology powering SMS interactions +* **[Send Text tool](/tools/send-text)** - Let your assistant send a text during a voice call diff --git a/fern/tools/default-tools.mdx b/fern/tools/default-tools.mdx index af0e3b869..563355f7d 100644 --- a/fern/tools/default-tools.mdx +++ b/fern/tools/default-tools.mdx @@ -25,30 +25,9 @@ To add built-in tools to your agent, you need to add them in the `tools` array o #### Send Text -This function is provided when `sms` is included in the assistant's list of available tools. For configuration options, see [Create Tool](/api-reference/tools/create#request.body.sms). The assistant can use this function to send SMS messages using a configured Twilio account. - -```json -{ - "model": { - "provider": "openai", - "model": "gpt-4o", - "messages": [ - { - "role": "system", - "content": "You are an assistant. When the user asks you to send a text message, use the sms function." - } - ], - "tools": [ - { - "type": "sms", - "metadata": { - "from": "+15551234567" - } - } - ] - } -} -``` + + Let the assistant send a text message from your Twilio number during a call, such as an appointment confirmation. + #### Dial Keypad (DTMF) diff --git a/fern/tools/introduction.mdx b/fern/tools/introduction.mdx index 2c1e302a2..d4a0ab770 100644 --- a/fern/tools/introduction.mdx +++ b/fern/tools/introduction.mdx @@ -31,6 +31,8 @@ Because the model controls both *when* a tool runs and the arguments it receives | [Hang Up tool](/tools/hang-up) | Ends the call when the assistant decides the conversation is complete, with an optional goodbye message | | [Handoff tool](/squads/handoff) | Moves a call from one assistant to another, carrying context and extracted variables | | [Voicemail tool](/tools/voicemail-tool) | Lets the assistant decide what to do when it reaches a voicemail system | +| [Send Text tool](/tools/send-text) | Sends a text message from your Twilio number during a voice call, such as an appointment confirmation | +| [DTMF tool](/tools/dtmf) | Sends keypad tones during a phone call, for example to navigate a phone menu or enter an account number | | [SIP Request tool](/tools/sip-request) | Sends a SIP INFO, MESSAGE, or NOTIFY request on a live SIP call, for example to pass call details to your PBX or contact center platform | | [Client-side tools](/tools/client-side-websdk) | Runs in the browser through the Web SDK, with no server URL | | [Query tool](/knowledge-base/using-query-tool) | Searches a [knowledge base](/knowledge-base) and returns matching content | diff --git a/fern/tools/send-text.mdx b/fern/tools/send-text.mdx new file mode 100644 index 000000000..670e06add --- /dev/null +++ b/fern/tools/send-text.mdx @@ -0,0 +1,64 @@ +--- +title: Send Text tool +subtitle: Send a text message during a voice call +slug: tools/send-text +description: Use the Send Text tool to let a Vapi assistant send an SMS message from your Twilio number during a voice call, such as an appointment confirmation. +--- + +The Send Text tool is a built-in tool that lets your assistant send a text message (SMS) during a voice call. The text is sent from a Twilio phone number that you imported into Vapi, through your Twilio account. + + + When you send or receive SMS messages, you are responsible for following the messaging laws and carrier requirements that apply where your recipients are located. For details, see the [Vapi Terms of Service](https://vapi.ai/terms-of-service) and the [Twilio Messaging Policy](https://www.twilio.com/en-us/legal/messaging-policy). + + +## When to use the Send Text tool + +Use the Send Text tool when the caller asks for details they'll want to keep after the call ends. Common examples: + +- **Confirm an appointment.** After your assistant books an appointment, it texts the caller the date, time, and address. +- **Send a link.** Your assistant texts a link to a form, a payment page, or a reschedule page, so the caller doesn't have to write down a URL. +- **Share details that are hard to hear.** Your assistant texts an order number, a reference code, or an address that's easier to read than to listen to. + +To handle texts that people send to your number, see [SMS chat](/chat/sms-chat). + +## Limits + +Each time the assistant calls the tool, it sends one text. The tool has these limits: + +- It only sends text messages. +- It works during phone calls and web calls, but not in [chats](/chat/quickstart). +- It isn't available on [GPT-Live](/gpt-live/configuration) models. + +## Requirements + +- **A Twilio phone number imported into Vapi.** The text is sent from this number. See [Import a Twilio number](/phone-numbers/import-twilio). Numbers from other providers, including free Vapi numbers, Telnyx, Vonage, and BYO SIP trunks, can't send texts with this tool. +- **US phone numbers only.** Both the sender and the recipient must be US phone numbers. +- **SMS sending enabled in Twilio.** The number must be able to send SMS messages in Twilio. Register the number for [application-to-person 10-digit long code (A2P 10DLC)](https://www.twilio.com/docs/messaging/compliance/a2p-10dlc) messaging, or [verify it](https://www.twilio.com/docs/messaging/compliance/toll-free/console-onboarding) if it's a toll-free number. + +## Send Text tool and SMS chat + +Vapi has two SMS features. They work differently: + +| | Send Text tool | SMS chat | +| --- | --- | --- | +| What happens | Your assistant sends a text during a voice call | A person texts your number and your assistant replies by text | +| Who starts it | Your assistant | The person texting | +| Setup | Add the Send Text tool to your assistant | Import a Twilio number with **SMS Enabled** and assign an assistant | +| Learn more | This page | [SMS chat](/chat/sms-chat) | + +## How the tool works during a call + +When your assistant calls the tool, the assistant fills in the recipient's phone number and the message, unless you preset them: + +- **Recipient.** By default, the assistant chooses the number. It can text the caller or another number given during the call. If it doesn't provide a number, the text goes to the caller. To make sure the assistant only texts the caller, preset the recipient. See [Send texts only to the caller](/tools/send-text/configure#send-texts-only-to-the-caller). +- **Message.** By default, the assistant writes the message. To send the same wording every time, preset the message. Presets can include [variables](/assistants/dynamic-variables). + +A preset always overrides what the assistant would fill in. + +The assistant gets back a result: success, or an error that explains what went wrong. A success result means Twilio accepted the message, not that it was delivered. + +## Next steps + + + Create the tool, limit texts to the caller, tell the assistant when to send a text, set tool messages, and troubleshoot texts that weren't sent. + diff --git a/fern/tools/send-text/configure.mdx b/fern/tools/send-text/configure.mdx new file mode 100644 index 000000000..06f6af299 --- /dev/null +++ b/fern/tools/send-text/configure.mdx @@ -0,0 +1,134 @@ +--- +title: Configure the Send Text tool +subtitle: Create the tool, guide the assistant, and control what the caller hears +slug: tools/send-text/configure +description: Configure the Vapi Send Text tool in the dashboard, limit texts to the caller, prompt the assistant, set tool messages, and troubleshoot texts that weren't sent. +--- + +Configure the Send Text tool in the dashboard, then add it to an assistant. You choose the sending Twilio number, who the assistant can text, when it sends a text, and what the caller hears afterward. This page also covers how to verify a text was sent and how to troubleshoot texts that weren't sent. + +Before you start, read [Send Text tool](/tools/send-text) for what the tool does and its requirements. You need a Twilio number imported into Vapi that can send SMS messages to US numbers. + +## Create the tool + + + + In the [Dashboard](https://dashboard.vapi.ai), select **Tools**, then select **Create Tool**. + + + Under **Phone Call Tools**, select **Send Text**. + + + Give the tool a name and description. The description tells the assistant when to send a text. + + + Under **From Phone Number**, select the Twilio number to send texts from. If the list is empty, [import a Twilio number](/phone-numbers/import-twilio) first. + + + Under **To Phone Number (Preset)**, enter the number to send texts to. See [Send texts only to the caller](#send-texts-only-to-the-caller). + + + Under **Message Body (Preset)**, enter the message to send every time. You can include [variables](/assistants/dynamic-variables), such as `Your appointment is confirmed for {{appointmentDate}}.` + + + Under **Messages**, set what the assistant says after the text is sent. See [Tool messages](#tool-messages). + + + Publish the tool, then add it to your assistant. + + + +## Send texts only to the caller + +Unless you preset the recipient, the assistant chooses who to text. It can send a text to any number given during the call. + +To send texts only to the caller, enter `{{customer.number}}` under **To Phone Number (Preset)**. The assistant can't change the recipient, and it only writes the message. + +Web calls don't have a caller phone number. On a web call, a text with this preset isn't sent, and the tool returns an error. + +## Tell the assistant when to send a text + +Add instructions to your system prompt that say when to send a text and what to include. Refer to the tool by the name you gave it. For example: + +```txt wordWrap +After you book the appointment, ask the caller if they'd like a text with the details. If they say yes, use `send_text_tool` to send the date, time, and address. +``` + +If you don't preset the recipient, also tell the assistant which number to use. For example: + +```txt wordWrap +Send the text to the number the caller is calling from unless they give you a different number. Repeat the number back before you send. +``` + +## Tool messages + +The Send Text tool has no default messages. If you don't set any, the assistant says nothing after the text is sent and waits for the caller to speak. + +This tool's messages all play after the text is sent, not before. The first message that applies is the one that plays: + +1. **Request Failed** (`request-failed`), if the text wasn't sent. +2. **Request Start** (`request-start`), if you set one. It plays instead of Request Complete. +3. **Request Complete** (`request-complete`). + +Because nothing plays before the text is sent, write any Request Start message as something the caller hears afterward, not "Sending that now." + +We recommend setting a Request Complete message and a Request Failed message, so the caller knows whether to expect a text. In the dashboard, open the tool's **Messages** section, select **Add Message**, choose the message type, and enter your message. + +To let the assistant respond in its own words instead of speaking fixed text, set the message `role` to `system` through the API. The message content goes to the model as a hint, and the assistant continues the conversation: + +```json +{ + "messages": [ + { + "type": "request-complete", + "role": "system", + "content": "The text was sent. Tell the caller to check their phone, then continue the conversation." + }, + { + "type": "request-failed", + "role": "system", + "content": "The text could not be sent. Apologize, read the details out loud instead, then continue the conversation." + } + ] +} +``` + +To change messages through the API, use the [Update Tool](/api-reference/tools/update#request.body.sms) endpoint. + +## Rejection plan + +To stop the tool from running under certain conditions, add a [tool rejection plan](/tools/tool-rejection-plan). + +## Verify the text was sent + +Place a test call and ask for a text. Then check these places: + +1. **The tool call and its result.** In the [Dashboard](https://dashboard.vapi.ai), select **Logs**, open the call, and select the [Messages](/observability/logs/call-logs#messages) tab. Find the Send Text tool call to see the number and message the assistant used, and the result that came back. A successful result includes the Twilio message ID. An error result includes an error code. +2. **Your Twilio account.** A success result means Twilio accepted the message. To confirm it was delivered, find the message ID in your Twilio Console messaging logs. + +## Troubleshoot the Send Text tool + +| What you see | What to check | +| --- | --- | +| No Send Text tool call in the Messages tab | The assistant didn't call the tool. Make the system prompt and tool description more specific about when to send a text. See [Tell the assistant when to send a text](#tell-the-assistant-when-to-send-a-text). | +| The assistant says nothing after the text is sent | The tool has no default messages. Set a Request Complete message. See [Tool messages](#tool-messages). | +| The text went to the wrong number | The assistant chose the recipient. To text only the caller, preset the recipient. See [Send texts only to the caller](#send-texts-only-to-the-caller). | +| The result is a success, but the text didn't arrive | Twilio accepted the message but didn't deliver it. Find the message ID in your Twilio Console messaging logs, and check the number's A2P 10DLC or toll-free registration. | +| The result includes `UNSUPPORTED_PROVIDER` | The **From Phone Number** isn't a Twilio number. Select a number you imported from Twilio. | +| The result includes `CONFIGURATION_ERROR` | The **From Phone Number** wasn't found in your Vapi account. Select a number from the list, or import it again. | +| The result includes `MISSING_REQUIRED_PARAMETER` | No sender, recipient, or message. Check that **From Phone Number** is set. On web calls, there's no caller number to text. | +| The result includes `INVALID_FROM_NUMBER` | The Twilio number can't send SMS messages. Check its SMS capability and registration in Twilio. | +| The result includes `INVALID_PHONE_NUMBER` | The recipient's number isn't valid. Tell the assistant to confirm the number with the caller, including the country code. | +| The result includes `TWILIO_CLIENT_ERROR` | The Twilio credentials saved with the phone number don't work. Update them on the phone number in Vapi. | +| The result includes `INSUFFICIENT_FUNDS` | Your Twilio account doesn't have enough balance. Add funds in your Twilio Console. | +| The result includes `TWILIO_API_ERROR` | Twilio rejected the message for another reason. The result includes Twilio's error message. | +| The assistant can't be saved with the Send Text tool | GPT-Live models don't support the Send Text tool. Use a different model, or remove the tool. | + +## Related + +- [Send Text tool](/tools/send-text) +- [SMS chat](/chat/sms-chat) +- [Inbound SMS](/phone-numbers/inbound-sms) +- [Import a Twilio number](/phone-numbers/import-twilio) +- [Built-in tools](/tools/default-tools) +- [Send Text tool in the Create Tool API reference](/api-reference/tools/create#request.body.sms)