# SendMessage

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Unknown

Source code: <https://github.com/FrendsPlatform/Frends.Slack/tree/main/Frends.Slack>

{% tabs %}
{% tab title="Parameter: Input" %}

| Name                 | Description                                                                                                                                                                                                                                                  |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ChannelId : `String` | <p>The Slack channel or user ID.</p><p><br>Default: <code>-</code><br>Example: <code>C01234567 or U12345678</code></p>                                                                                                                                       |
| Mode : `MessageMode` | <p>Message format mode.</p><p>Possible values:</p><ul><li><code>PlainText</code>:</li></ul><p>Message format mode.</p><ul><li><code>Blocks</code>:</li></ul><p>Message format mode.</p><p><br>Default: <code>-</code><br>Example: <code>PlainText</code></p> |
| Text : `String`      | <p>The plain text of the message to send.</p><p><br>Default: <code>-</code><br>Example: <code>Hello from our integration!</code></p>                                                                                                                         |
| Blocks : `String`    | <p>Slack Block Kit JSON for rich formatting.</p><p><br>Default: <code>-</code><br>Example: <code>\[{ "type": "section", "text": { "type": "mrkdwn", "text": "</code><em><code>Hello</code></em> <em><code>world</code></em><code>!" } }]</code></p>          |
| ThreadTs : `String`  | <p>Timestamp of a message to reply in a thread.</p><p><br>Default: <code>-</code><br>Example: <code>1234567890.123456</code></p>                                                                                                                             |
| {% endtab %}         |                                                                                                                                                                                                                                                              |

{% tab title="Parameter: Connection" %}

| Name               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 🗝Token : `String` | <p>Slack OAuth token used for authentication.</p><p>If the token is a <strong>bot token</strong> (starts with "xoxb"), messages</p><p>will be sent as the Slack app's bot user.</p><p>If the token is a <strong>user token</strong> (starts with "xoxp"), messages</p><p>will be sent as the Slack user who authorized the token.</p><p>Note: User tokens require the user to have authorized the app via OAuth</p><p>with appropriate scopes (e.g., "chat:write").</p><p><br>Default: <code>-</code><br>Example: <code>xoxb-123456789</code></p> |
| {% endtab %}       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

{% tab title="Parameter: Options" %}

| Name                             | Description                                                                                                                                                                                                                                   |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| UnfurlLinks : `Boolean`          | <p>Whether to expand URLs in the message into rich previews (e.g. YouTube, websites).</p><p>Note: Slack may unfurl a link only once per channel to reduce duplication.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p> |
| UnfurlMedia : `Boolean`          | <p>Whether to show media previews (e.g. images, video thumbnails) for links in the message.</p><p>Note: Media previews may appear only on first post of the same link.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p> |
| ThrowErrorOnFailure : `Boolean`  | <p>True: Throw an exception.</p><p>False: Error will be added to the Result.Error.AdditionalInformation list instead of stopping the Task.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                             |
| ErrorMessageOnFailure : `String` | <p>Message what will be used when error occurs.</p><p><br>Default: <code>Failed to send message to Slack</code><br>Example: <code>Task failed during execution</code></p>                                                                     |
| {% endtab %}                     |                                                                                                                                                                                                                                               |

{% tab title="Result: Result" %}

| Name                 | Description                                                                                                                                         |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Success : `Boolean`  | <p>Indicates whether the message was sent successfully.<br>Example: <code>true</code></p>                                                           |
| MessageTs : `String` | <p>The timestamp (ID) of the sent message.<br>Example: <code>1234567890.123456</code></p>                                                           |
| Error : `Error`      | <p>Error that occurred during task execution.<br>Example: <code>object { string Message, object { Exception Exception } AdditionalInfo }</code></p> |
| {% endtab %}         |                                                                                                                                                     |

{% tab title="Changelog" %}

## Changelog

### \[2.0.0] - 2026-03-04

#### Fixed

* Blocks JSON string is now correctly parsed to JArray before sending to Slack API.
* \[Breaking change] - Input.Blocks type changed from JArray to string. Users should now provide raw JSON string instead of parsed JArray.

### \[1.0.0] - 2025-06-03

#### Added

* Initial implementation
  {% endtab %}
  {% endtabs %}
