# Send Outbound Message — LoopMessage

> Action to send a message to an individual recipient.

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

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `contact` | `string` | Yes | Recipient phone number or email address. |
| `text` | `string` | Yes | Message text. |
| `subject` | `string` | No | Optional. Message subject. A recipient will see this subject as a bold title before the text. For iMessage only. |
| `effect` | `string` | No | Optional. Add effect to your message. For iMessage only. |
| `sender` | `string` | No | Optional. Use a specific Sender Name for outbound message. Options are loaded from the connected account. |
| `attachments` | `string[]` | No | Optional. An array of strings. The string must be a full URL of your image. URL should start with https://. HTTP links (without SSL) are not supported. This must be a publicly accessible file URL: we will not be able to reach any URLs that are hidden or that require authentication. |
| `replyToId` | `string` | No | Optional. Reply to a message with a specific ID |
| `channel` | `string` | No | Optional. You can choose which service to use to deliver the message. By default, the required channel will be determined automatically. Use this parameter only in cases when you need to override the delivery channel for a specific request. DON'T use it as a default parameter for all requests. |
| `passthrough` | `string` | No | Optional. A string of metadata you wish to store in this request. Max length: 1000 characters. |

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

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: "loopmessage-send-text-message",
  arguments: {
    contact: "Contact",
    text: "Text",
  },
})
```

**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: "loopmessage-send-text-message",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    loopmessage: { authProvisionId: "apn_xxxxxxx" },
    contact: "Contact",
    text: "Text",
  },
})

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": "loopmessage-send-text-message",
    "configured_props": {
      "loopmessage": { "authProvisionId": "apn_xxxxxxx" },
      "contact": "Contact",
      "text": "Text"
    }
  }'
```

---

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