# Send message — Sendbird

> Sends a message to a channel. See the docs here

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

## Description

Sends a message to a channel. [See the docs here](https://sendbird.com/docs/chat/v3/platform-api/message/messaging-basics/send-a-message)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `applicationId` | `string` | Yes | Specifies the unique ID of the Application. To find the application ID, sign in to Sendbird Dashboard, go to Settings > Application > General, and then check Application ID. |
| `channelType` | `string` | Yes | Specifies the type of the channel. Acceptable values are open_channels and group_channels. |
| `channelUrl` | `string` | Yes | Specifies the url of the channel. Options are loaded from the connected account. |
| `userId` | `string` | Yes | Specifies the user ID of the sender. Options are loaded from the connected account. |
| `sendPush` | `boolean` | No | Determines whether to send a push notification for the message to the members of the channel (applicable to group channels only). Unlike text and file messages, a push notification for an admin message is not sent by default. (Default: true) |
| `mentionType` | `string` | No | Specifies the mentioning type which indicates the user scope who will get a notification for the message. Acceptable values are users and channel. If set to users, only the specified users with the mentioned_users property below will get notified. If set to channel, all users in the channel will get notified. (Default: users) |
| `mentionedUserIds` | `string[]` | No | Specifies an array of one or more IDs of the users who will get a notification for the message. Options are loaded from the connected account. |
| `isSilent` | `boolean` | No | Determines whether to send a message without updating some of the channel properties. If a message is sent in a channel, with this property set to true, the channel's last_message is updated only for the sender while its unread_message_count remains unchanged for all channel members. |
| `dedupId` | `string` | No | Specifies the unique message ID created by other system. In general, this property is used to prevent the same message data from getting inserted when migrating the messages of the other system to Sendbird server. If specified, the server performs a duplicate check using the property value. |
| `messageType` | `string` | Yes | Specifies the type of the 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": "sendbird",
      },
    },
  },
)

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: "sendbird-send-message",
  arguments: {
    applicationId: "Application Id",
    channelType: "Channel Type",
  },
})
```

**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: "sendbird-send-message",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    sendbird: { authProvisionId: "apn_xxxxxxx" },
    applicationId: "Application Id",
    channelType: "Channel Type",
  },
})

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": "sendbird-send-message",
    "configured_props": {
      "sendbird": { "authProvisionId": "apn_xxxxxxx" },
      "applicationId": "Application Id",
      "channelType": "Channel Type"
    }
  }'
```

---

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