# Post Text Message — Sunshine Conversations

> Post a text message, optionally with action buttons. See the documentation

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

## Description

Post a text message, optionally with action buttons. [See the documentation](https://developer.zendesk.com/api-reference/conversations/#tag/Messages/operation/PostMessage)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `userId` | `string` | No | The ID of the user on whose behalf the message is posted. Required when Author Type is user. Also filters the Conversation ID dropdown; leave blank for a business post and enter the conversation ID directly. |
| `conversationId` | `string` | Yes | The ID of the conversation to get messages for. Options are loaded from the connected account. |
| `authorType` | `string` | Yes | The author type. Either user or business. |
| `subtypes` | `string[]` | No | An array that indicates the author's subtypes |
| `displayName` | `string` | No | The display name of the message author |
| `avatarUrl` | `string` | No | A custom message icon URL. The image must be JPG, PNG, or GIF format |
| `text` | `string` | No | The text content of the message. Required unless actions, htmlText, or markdownText is provided |
| `htmlText` | `string` | No | HTML text content of the message. Can be provided in place of text. Cannot be used with markdownText. If no text is provided, will be converted to text upon reception to be displayed on channels that do not support rich text. See rich text documentation for more information |
| `blockChatInput` | `boolean` | No | When set to true, the chat input will be disabled on supported client implementations when the message is the most recent one in the history. Can be used for guided flows or to temporarily disable the user's ability to send messages in the conversation |
| `markdownText` | `string` | No | Markdown text content of the message. Can be provided in place of text. Cannot be used with htmlText. Will be converted to htmlText upon reception. If converted htmlText exceeds 4096 characters, the message will be rejected. If no text is provided, will be converted to text upon reception to be displayed on channels that do not support rich text. See rich text documentation for more information |
| `payload` | `string` | No | The payload of a reply button response message |
| `actions` | `string[]` | No | An array of action-button objects to embed in the message. Each item must be a JSON object, for example: {"type":"link","text":"Visit site","uri":"https://example.com"} or {"type":"reply","text":"Yes","payload":"confirm_yes"}. Valid action types: link, reply, webview, postback. Max 10 per message; reply actions cannot be mixed with other action types. Required unless text, htmlText, or markdownText is provided. |
| `metadata` | `object` | No | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size |

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

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: "sunshine_conversations-post-text-message",
  arguments: {
    userId: "User ID",
    conversationId: "Conversation ID",
  },
})
```

**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: "sunshine_conversations-post-text-message",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    sunshine_conversations: { authProvisionId: "apn_xxxxxxx" },
    userId: "User ID",
    conversationId: "Conversation ID",
  },
})

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": "sunshine_conversations-post-text-message",
    "configured_props": {
      "sunshine_conversations": { "authProvisionId": "apn_xxxxxxx" },
      "userId": "User ID",
      "conversationId": "Conversation ID"
    }
  }'
```

---

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