***

title: sendSms
slug: /reference/typescript/agents/function-result/send-sms
description: Send an SMS or MMS message from a tool function.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[functionresult]: /docs/server-sdks/reference/typescript/agents/function-result

Send an SMS or MMS message to a phone number. At least one of `body` or `media`
must be provided. Generates a SWML `send_sms` verb under the hood.

Throws `Error` if neither `body` nor `media` is provided.

## **Parameters**

<ParamField path="opts" type="object" required={true} toc={true}>
  SMS configuration object.
</ParamField>

<Indent>
  <ParamField path="opts.toNumber" type="string" required={true} toc={true}>
    Destination phone number in E.164 format (e.g., `"+15551234567"`).
  </ParamField>

  <ParamField path="opts.fromNumber" type="string" required={true} toc={true}>
    Sender phone number in E.164 format. Must be a number in your SignalWire project.
  </ParamField>

  <ParamField path="opts.body" type="string" toc={true}>
    Text body of the message.
  </ParamField>

  <ParamField path="opts.media" type="string[]" toc={true}>
    List of media URLs to include as MMS attachments.
  </ParamField>

  <ParamField path="opts.tags" type="string[]" toc={true}>
    Tags to associate with the message for searching and filtering in the
    SignalWire dashboard.
  </ParamField>

  <ParamField path="opts.region" type="string" toc={true}>
    Region to originate the message from.
  </ParamField>
</Indent>

## **Returns**

[`FunctionResult`][functionresult] -- `this`, for chaining.

## **Examples**

### Text Message

```typescript {4}
import { FunctionResult } from '@signalwire/sdk';

const result = new FunctionResult('SMS sent.')
  .sendSms({
    toNumber: '+15551234567',
    fromNumber: '+15559876543',
    body: 'Your appointment is confirmed for tomorrow at 3 PM.',
  });
```

### MMS with Media

```typescript {4}
import { FunctionResult } from '@signalwire/sdk';

const result = new FunctionResult("I've sent your receipt.")
  .sendSms({
    toNumber: '+15551234567',
    fromNumber: '+15559876543',
    body: "Here's your receipt:",
    media: ['https://example.com/receipt.pdf'],
  });
```