# Send SMS Message — Esendex

> Send an SMS message to a recipient. See the documentation

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

## Description

Send an SMS message to a recipient. [See the documentation](https://developers.esendex.com/api-reference/#messagedispatcher)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `accountReference` | `string` | Yes | The account reference to use for the request Options are loaded from the connected account. |
| `to` | `string` | Yes | The phone number to send the message to. E.g. 447700900123 |
| `message` | `string` | Yes | The message to send |
| `from` | `string` | No | The default alphanumeric originator that the message appears to originate from. This must be either a valid phone number or an alphanumeric value with a maximum length of 11 characters, that may contain letters, numbers and the following special characters: * $ ? ! ” # % & _ - , @ ' +. Special characters may not work for all networks in France. |
| `sendAt` | `string` | No | The scheduled time to send the messages in this request. The format is yyyy-MM-ddThh:mm:ssZ where y=year, M=month, d=day, T=separator, h=hour, m=min and s=seconds. The value is treated as per ISO 8601 semantics, e.g. without time zone information the value is assumed to be the local time of the server, otherwise as an offset from UTC with Z representing a UTC time. |
| `characterSet` | `string` | No | The character set of the message to be used. Valid values are: GSM, Unicode and Auto. When using Auto the most appropriate character set is automatically detected. The default value is GSM. When using auto, if unicode characters are detected, the number of characters available in a message will change from 160 to 70. |
| `validity` | `integer` | No | The validity period for this message in hours (default to 0 which indicates the MAX allowed). The maximum allowed validity period is 72 hours. |

## 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": "esendex",
      },
    },
  },
)

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: "esendex-send-sms-message",
  arguments: {
    accountReference: "Account Reference",
    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: "esendex-send-sms-message",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    esendex: { authProvisionId: "apn_xxxxxxx" },
    accountReference: "Account Reference",
    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": "esendex-send-sms-message",
    "configured_props": {
      "esendex": { "authProvisionId": "apn_xxxxxxx" },
      "accountReference": "Account Reference",
      "to": "To"
    }
  }'
```

---

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