# Send SMS — Textlocal

> This Action can be used to send text messages to either individual numbers or entire contact groups. See the docs here Note: While both numbers and group_id are optional parameters, one or the other must be included in the request for the…

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

## Description

This Action can be used to send text messages to either individual numbers or entire contact groups. [See the docs here](https://api.txtlocal.com/docs/sendsms)
    Note: While both numbers and group_id are optional parameters, one or the other must be included in the request for the message to be sent.

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `sender` | `string` | Yes | Use this field to specify the sender name for your message. This must be at least 3 characters in length but no longer than 11 alphanumeric characters or 13 numeric characters. If this is excluded it will use the default sender name configured on your account |
| `message` | `string` | Yes | The message content. This parameter should be no longer than 765 characters. See Helpful Information for message length details. The message also must be URL Encoded to support symbols like &. |
| `numbers` | `string` | No | Note: While both numbers and group_id are optional parameters, one or the other must be included in the request for the message to be sent. |
| `groupId` | `integer` | No | Note: While both numbers and group_id are optional parameters, one or the other must be included in the request for the message to be sent. Options are loaded from the connected account. |
| `simpleReply` | `boolean` | No | Set to true to enable the Simple Reply Service for the message. This will override any sender value, as a Simple Reply Service number will be used instead. |
| `scheduleTime` | `string` | No | This parameter can be used to specify a schedule date/time for your message, which should be provided in Unix timestamp format. Times should be provided in GMT. |
| `receiptUrl` | `string` | No | Use this field to specify an alternative URL to which the delivery receipt(s) will be sent. See handling receipts documentation. |
| `custom` | `string` | No | This value will be set against the message batch and will passed back in the delivery receipts. This allows you to match delivery receipts to their corresponding messages. |
| `optouts` | `boolean` | No | Can be set to true in order to check against your own opt-outs list and Textlocal's global opt-outs database. Your message will not be sent to numbers within these lists. If not provided defaults to false. |
| `validity` | `string` | No | Can be set, up to 72 hours in advance, to say after which time, you don't want the message delivered. This should be in a Unix timestamp format. |
| `unicode` | `boolean` | No | Set this value to true to specify that your message body will contain unicode characters. See Encoding/Decoding Unicode Documentation |
| `trackingLinks` | `boolean` | No | Set this value to true to specify that the message contains links and they should be converted to short links (trackable in messenger), Please note that links must be url encoded before being placed into the message |
| `test` | `boolean` | Yes | Set this field to true to enable test mode, no messages will be sent and your credit balance will be unaffected. If not provided defaults to false |

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

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: "textlocal-send-sms",
  arguments: {
    sender: "Sender",
    message: "Message",
  },
})
```

**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: "textlocal-send-sms",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    textlocal: { authProvisionId: "apn_xxxxxxx" },
    sender: "Sender",
    message: "Message",
  },
})

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": "textlocal-send-sms",
    "configured_props": {
      "textlocal": { "authProvisionId": "apn_xxxxxxx" },
      "sender": "Sender",
      "message": "Message"
    }
  }'
```

---

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