# Send Message — Twilio

> Send an SMS text with optional media files. See the documentation

- Key: `twilio-send-message`
- Type: Action (Write)
- Version: 0.0.4
- App: Twilio (`twilio`) — https://pipedream.com/apps/twilio.md
- This page (HTML): https://pipedream.com/apps/twilio/actions/send-message
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/twilio/actions/send-message/send-message.mjs

## Description

Send an SMS text with optional media files. [See the documentation](https://www.twilio.com/docs/sms/api/message-resource#create-a-message-resource)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `from` | `string` | Yes | The sender's Twilio phone number (in E.164 format), alphanumeric sender ID, Wireless SIM, short code, or channel address (e.g., whatsapp:+15554449999). The value of the from parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using messaging_service_sid, this parameter can be empty (Twilio assigns a from value from the Messaging Service's Sender Pool) or you can provide a specific sender from your Sender Pool Options are loaded from the connected account. |
| `to` | `string` | Yes | The destination phone number in E.164 format. Format with a + and country code (e.g., +16175551212). |
| `body` | `string` | Yes | The text of the message you want to send, limited to 1600 characters. |
| `mediaUrl` | `string[]` | No | The URL of the media you wish to send out with the message. The media size limit is 5MB. You may provide up to 10 media URLs per message. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "twilio",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "twilio-send-message",
  arguments: {
    from: "From",
    to: "To",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "twilio-send-message",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    twilio: { authProvisionId: "apn_xxxxxxx" },
    from: "From",
    to: "To",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "twilio-send-message",
    "configured_props": {
      "twilio": { "authProvisionId": "apn_xxxxxxx" },
      "from": "From",
      "to": "To"
    }
  }'
```

---

- App: https://pipedream.com/apps/twilio.md · All apps: https://pipedream.com/apps
