Text the caller from a Vapi assistant

Give a Vapi assistant a text_caller tool that sends the person on the line a link, an address or a confirmation by SMS, from TextKit, while the call is still going.

How it works

The tool is one HTTP request to POST https://api.jointextkit.com/v1/messages. Vapi fills to with {{ customer.number }}, the caller's number, when the tool runs. The agent writes only body, the text itself. So the agent can text the person on the call and nobody else, and you never have to read a phone number out loud or trust the agent to copy one correctly.

The request carries your key in an Authorization: Bearer header, stored on the Vapi side. TextKit answers with the message (id, status), which the agent can use to say "Sent."

1. Create the tool

Vapi's API Request tool sends a fixed request with the values the assistant fills in. Create it with Vapi's API (or in the dashboard under Tools, with the same fields):

bash
curl -X POST https://api.vapi.ai/tool \
  -H "Authorization: Bearer $VAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d @text-caller.json

text-caller.json:

json
{
  "type": "apiRequest",
  "name": "text_caller",
  "description": "Text the caller a link, an address or a confirmation. Use only after the caller agrees to get a text.",
  "method": "POST",
  "url": "https://api.jointextkit.com/v1/messages",
  "headers": {
    "type": "object",
    "properties": {
      "Authorization": { "type": "string", "value": "Bearer ssms_sk_test_..." }
    }
  },
  "body": {
    "type": "object",
    "properties": {
      "body": {
        "type": "string",
        "description": "The full text to send, under 300 characters, with the link or details the caller asked for."
      }
    },
    "required": ["body"],
    "additionalProperties": false
  },
  "parameters": [
    { "key": "to", "value": "{{ customer.number }}" }
  ]
}

parameters are static body fields: Vapi merges them in after the assistant writes body, and a static field wins over one the model sends, so to is always the caller. {{ customer.number }} is the caller ID on an inbound call and the number dialed on an outbound one. To keep the key out of the tool itself, store it as a Vapi custom credential and pass credentialId instead of the Authorization header.

2. Attach it and tell the assistant when to use it

In the dashboard, open Assistants, pick your assistant, add text_caller on its Tools tab, and publish. Then add a line to the system prompt:

text
When the caller asks for a link, an address or a confirmation in writing,
offer to text it to the number they are calling from. If they say yes, call
text_caller with the full text, under 300 characters, and say "Sent." when it
returns. Never read the caller's number back to them.

Test it in the sandbox

Use a test key (ssms_sk_test_...) from the API keys page and verify your own cell under Settings in the console. Then call your agent from that phone and ask for the text. A test key delivers to your verified phone for real (up to 10 a day, ending "- via TextKit sandbox"); a call from any other phone is simulated, and the message shows in the console's log tagged Test · simulated. Browser and web test calls have no caller number, so test with a real phone call.

Before you go live

  • Swap in a live key (ssms_sk_live_) and buy a number; with one number on the account, from is optional. Register your use case so carriers accept the texts.
  • Have the agent offer the text and send it only after the caller says yes. STOP and HELP replies are handled for you (opt-out).
  • Quiet hours apply: a text sent during a call after 9pm in the caller's local time is held until 8am, unless it is a one-time code.
  • US and Canadian numbers only. A send to any other number is refused, and the agent gets the error back in the tool result.

Vapi also connects MCP servers, and TextKit's works there (https://mcp.jointextkit.com, with the same Bearer header). Vapi imports every tool a server exposes, all 142, so for a phone assistant the single tool above is the tighter fit.

Sources

More in integrations