SMS tool not sending messages after assigning to a...
# support
k
Hi VAPI team, I’m using the SMS tool and have already assigned it to my agent, but it’s not sending out SMS messages. The tool executes but I keep getting an error instead of delivery. Here’s the error I’m receiving: { "success": false, "errorCode": "INVALID_PHONE_NUMBER", "message": "Invalid recipient phone number format" } And here are my SMS tool details: { "id": "9bde4e90-4137-4b71-87ca-cd55ca953271", "createdAt": "2025-09-03T13:22:06.685Z", "updatedAt": "2025-09-03T20:49:51.413Z", "type": "sms", "function": { "name": "send_text", "description": "Send a pre-approved text message to the prospect. When a lead wants to book a showing, but prefers to self-schedule. Message: Thank you for your interest! You can book a private showing here: https://www.booking.com\n\n", "parameters": { "type": "object", "properties": {}, "required": [] } }, "messages": [ { "type": "request-start", "content": "I'll send you a text message right now with the appointment booking link.", "blocking": false }, { "role": "assistant", "type": "request-complete", "content": "Perfect! I've sent you the text message with the appointment booking link. You should receive it shortly.", "endCallAfterSpokenEnabled": false } ], "metadata": { "from": "+18564925986" }, "orgId": "e431800d-ac23-4af2-bb19-50f45b16351f" } Please help me to solve that Thanks in advance!
v
Thank you for sharing the error details. To help troubleshoot, could you please confirm the exact format of the recipient phone number you are using when sending the SMS? (For example, is it in the format
+1234567890
?) This will help determine if the issue is due to the phone number format.
k
@Vapi @Vapi Support Bot I don’t have to pass the callee number anywhere — the SMS is triggered automatically by the tool when the agent runs it. I assumed it should automatically pick the recipient’s number, so I’m not manually providing any phone number in the request. Could you please confirm if I need to explicitly pass the callee’s number, or should it work automatically as designed?
v
To resolve the "INVALID_PHONE_NUMBER" error, explicitly provide the recipient's phone number in E.164 format (e.g.,
+1234567890
) when triggering the SMS tool.
If your tool or function does not automatically pick up the callee's number, update your agent or tool configuration to include the recipient number as a parameter, like this:
Copy code
json
{
  "to": "+1234567890",
  "message": "Thank you for your interest! You can book a private showing here: https://www.booking.com"
}
This ensures the SMS is sent to the correct recipient and avoids format errors. [See Vapi documentation for SMS tool usage.](https://docs.vapi.ai/tools/default-tools) Source: - [Default Tools Vapi Documentation](https://docs.vapi.ai/tools/default-tools)
k
Thanks for clarifying. But in my case, the callee number will be different on every call. How should we handle this scenario? Since the recipient changes dynamically on every call, we can’t manually create a separate tool with a hardcoded number for each call. Is there a way to automatically pass the callee’s number into the SMS tool at runtime, so it dynamically sends to the correct recipient on each call? @Vapi Support Bot
v
To send SMS messages to the current callee dynamically, use the
{{customer.number}}
variable in your tool configuration or function call. For example:
Copy code
json
{
  "to": "{{customer.number}}",
  "message": "Thank you for your interest! You can book a private showing here: https://www.booking.com"
}
This ensures the SMS tool automatically uses the recipient's number from each call at runtime. [See Vapi dynamic variables documentation.](https://docs.vapi.ai/assistants/dynamic-variables) Source: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables)
k
curl -X POST https://api.vapi.ai/tool \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "type": "sms", "function": { "name": "send_text", "description": "Send a pre-approved text message: Thank you for your interest! You can book a private showing here: https://www.booking.com" }, "messages": [ { "type": "request-start", "content": "I'\''ll send you a text message right now with the appointment booking link.", "blocking": false }, { "role": "assistant", "type": "request-complete", "content": "Perfect! I'\''ve sent you the text message with the appointment booking link. You should receive it shortly.", "endCallAfterSpokenEnabled": false } ], "metadata": { "from": "+18564925986" } }' ``````````````````could you write right cURL for me with defining to and all``````give me full updated one @Vapi Support Bot
v
Here’s an updated cURL example for your SMS tool, using the dynamic recipient number:
Copy code
bash
curl -X POST https://api.vapi.ai/tool \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "sms",
    "function": {
      "name": "send_text",
      "description": "Send a pre-approved text message: Thank you for your interest! You can book a private showing here: https://www.booking.com",
      "parameters": {
        "to": "{{customer.number}}"
      }
    },
    "messages": [
      {
        "type": "request-start",
        "content": "I'll send you a text message right now with the appointment booking link.",
        "blocking": false
      },
      {
        "role": "assistant",
        "type": "request-complete",
        "content": "Perfect! I've sent you the text message with the appointment booking link. You should receive it shortly.",
        "endCallAfterSpokenEnabled": false
      }
    ],
    "metadata": {
      "from": "+18564925986"
    }
  }'
Replace
<YOUR_TOKEN>
with your actual API token. This setup ensures the SMS is sent to the current callee on each call.
[See Vapi dynamic variables documentation.](https://docs.vapi.ai/assistants/dynamic-variables) Source: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables)
k
Copy code
{
  "message": [
    "function.parameters.property to should not exist",
    "function.parameters.type must be one of the following values: object",
    "function.parameters.type must be a string",
    "function.parameters.properties must be an object"
  ],
  "error": "Bad Request",
  "statusCode": 400
}
@Vapi Support Bot i am getting this error
v
Your error is due to the incorrect structure of the
function.parameters
field.
Update your cURL request as follows, ensuring
"parameters"
is an object with
"type": "object"
and a
"properties"
object that defines
"to"
as a string:
Copy code
bash
curl -X POST https://api.vapi.ai/tool \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "sms",
    "function": {
      "name": "send_text",
      "description": "Send a pre-approved text message: Thank you for your interest! You can book a private showing here: https://www.booking.com",
      "parameters": {
        "type": "object",
        "properties": {
          "to": { "type": "string" }
        },
        "required": ["to"]
      }
    },
    "messages": [
      {
        "type": "request-start",
        "content": "I'll send you a text message right now with the appointment booking link.",
        "blocking": false
      },
      {
        "role": "assistant",
        "type": "request-complete",
        "content": "Perfect! I've sent you the text message with the appointment booking link. You should receive it shortly.",
        "endCallAfterSpokenEnabled": false
      }
    ],
    "metadata": {
      "from": "+18564925986"
    }
  }'
When triggering the tool, pass
"to": "{{customer.number}}"
in the function call to send the SMS to the current callee.
[See Vapi dynamic variables documentation.](https://docs.vapi.ai/assistants/dynamic-variables) Source: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables)
k
{ "message": "Unterminated string in JSON at position 458 (line 17 column 24)", "error": "Bad Request", "statusCode": 400 } i am getting this error @Vapi Support Bot
v
Your error is due to a JSON syntax issue—likely a missing or mismatched quote or bracket. Try this corrected cURL command (ensure you use single quotes for the outer string and double quotes for JSON keys/values):
Copy code
bash
curl -X POST https://api.vapi.ai/tool \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "sms",
    "function": {
      "name": "send_text",
      "description": "Send a pre-approved text message: Thank you for your interest! You can book a private showing here: https://www.booking.com",
      "parameters": {
        "type": "object",
        "properties": {
          "to": { "type": "string" }
        },
        "required": ["to"]
      }
    },
    "messages": [
      {
        "type": "request-start",
        "content": "I'll send you a text message right now with the appointment booking link.",
        "blocking": false
      },
      {
        "role": "assistant",
        "type": "request-complete",
        "content": "Perfect! I've sent you the text message with the appointment booking link. You should receive it shortly.",
        "endCallAfterSpokenEnabled": false
      }
    ],
    "metadata": {
      "from": "+18564925986"
    }
  }'
Double-check for any stray or missing quotes/brackets. This should resolve the "Unterminated string" error. Source: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables)
k
curl -X POST https://api.vapi.ai/tool \ -H "Authorization: Bearer 0515322c-6590-483d-957e-5b217ad40191" \ -H "Content-Type: application/json" \ -d '{ "type": "sms", "function": { "name": "send_text", "description": "Send a pre-approved text message: Thank you for your interest! You can book a private showing here: https://www.booking.com", "parameters": { "type": "object", "properties": { "to": { "type": "string" } }, "required": ["to"] } }, "messages": [ { "type": "request-start", "content": "I'\''ll send you a text message right now with the appointment booking link.", "blocking": false }, { "role": "assistant", "type": "request-complete", "content": "Perfect! I'\''ve sent you the text message with the appointment booking link. You should receive it shortly.", "endCallAfterSpokenEnabled": false } ], "metadata": { "from": "+18564925986" } }' ``````````````````````````but where you defined "to" like customer caller number and all @Vapi Support Bot
v
To clarify your workflow: When you trigger the SMS tool, are you passing the
"to": "{{customer.number}}"
value in the function call payload at runtime, or is the tool being triggered without specifying the recipient? This step is essential for the tool to dynamically use the current caller's number. [See Vapi dynamic variables documentation.](https://docs.vapi.ai/assistants/dynamic-variables) Source: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables)
k
so give me updated full
so give me updated full @Vapi Support Bot
v
Here’s a complete cURL example for your SMS tool, including the correct parameters schema and a sample function call payload using the dynamic recipient number:
Copy code
bash
curl -X POST https://api.vapi.ai/tool \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "sms",
    "function": {
      "name": "send_text",
      "description": "Send a pre-approved text message: Thank you for your interest! You can book a private showing here: https://www.booking.com",
      "parameters": {
        "type": "object",
        "properties": {
          "to": { "type": "string" }
        },
        "required": ["to"]
      }
    },
    "messages": [
      {
        "type": "request-start",
        "content": "I'll send you a text message right now with the appointment booking link.",
        "blocking": false
      },
      {
        "role": "assistant",
        "type": "request-complete",
        "content": "Perfect! I've sent you the text message with the appointment booking link. You should receive it shortly.",
        "endCallAfterSpokenEnabled": false
      }
    ],
    "metadata": {
      "from": "+18564925986"
    }
  }'
When triggering the tool, ensure the function call payload includes:
Copy code
json
{ "to": "{{customer.number}}" }
This setup will dynamically send the SMS to the current callee on each call. [See Vapi dynamic variables documentation.](https://docs.vapi.ai/assistants/dynamic-variables) Source: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables)