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

# send_sms

> Send an SMS or MMS message from a tool function.

[functionresult]: /docs/server-sdks/reference/python/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.

Raises `ValueError` if neither `body` nor `media` is provided.

## **Parameters**

**`to_number`** `str` — required

Destination phone number in E.164 format (e.g., `"+15551234567"`).

---

**`from_number`** `str` — required

Sender phone number in E.164 format. Must be a number in your SignalWire project.

---

**`body`** `Optional[str]` — default: None

Text body of the message.

---

**`media`** `Optional[list[str]]` — default: None

List of media URLs to include as MMS attachments.

---

**`tags`** `Optional[list[str]]` — default: None

Tags to associate with the message for searching and filtering in the
SignalWire dashboard.

---

**`region`** `Optional[str]` — default: None

Region to originate the message from.

---

## **Returns**

[`FunctionResult`][functionresult] — self, for chaining.

## **Examples**

### Text Message

```python {13}
from signalwire import AgentBase
from signalwire import FunctionResult

agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")

@agent.tool(name="send_confirmation", description="Send an order confirmation SMS")
def send_confirmation(args, raw_data):
    phone = args.get("phone_number")
    order_id = args.get("order_id")
    return (
        FunctionResult("I've sent you a confirmation text.")
        .send_sms(
            to_number=phone,
            from_number="+15559876543",
            body=f"Your order {order_id} has been confirmed!"
        )
    )

agent.serve()
```

### MMS with Media

```python {13}
from signalwire import AgentBase
from signalwire import FunctionResult

agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")

@agent.tool(name="send_receipt", description="Send a receipt with media attachment")
def send_receipt(args, raw_data):
    phone = args.get("phone_number")
    receipt_url = args.get("receipt_url")
    return (
        FunctionResult("I've sent your receipt.")
        .send_sms(
            to_number=phone,
            from_number="+15559876543",
            body="Here's your receipt:",
            media=[receipt_url]
        )
    )

agent.serve()
```