• /
  • EnglishEspañolFrançais日本語한국어Português
  • ログイン今すぐ開始

Post a Slack message

|View as Markdown (English)

Sends a message to a Slack channel with an optional file attachment.

For prerequisites, see Slack chat actions.

Post a message

The action identifier is slack.chat.postMessage.

Sends a message to a Slack channel, with an optional file attachment.

The following table describes all available input fields for this action.

Input

Type

Description

Example

token

Secret

Required. The Slack bot token to use. This should be passed as a secret syntax. Refer to Add Slack configuration for instructions on setting up a token.

${{ :secrets:slackToken }}

channel

String

Required. The name of the channel, or a channelID, to send the message. See Slack API for more information.

my-slack-channel

text

String

Required. The message to be posted to Slack in the specified channel.

Hello World!

threadTs

String

Optional. Timestamp belonging to parent message, used to create a message reply in a thread.

<digits>.<digits>

attachment

Map

Optional. Allows attaching a file with a message onto the specified channel.

attachment.filename

String

Required when using attachment. Specify the filename for the uploaded file in Slack.

file.txt

attachment.content

String

Required when using attachment. The content of the file to upload as UTF8.

Hello\nWorld!

selectors

List

Optional. The selectors to get only the specified parameters as output.

[{\"name\": \"threadTs\", \"expression\": \".threadTs\"}, {\"name\": \"channelID\", \"expression\": \".channelID\"}]

The following table describes all output fields returned by this action.

Output

Type

Description

threadTs

String

Timestamp of the message thread. May be used in future postMessage calls to post a reply in a thread. Example: <digits>.<digits>.

channelID

String

ID of the channel where the message is posted.

success

Boolean

true on success, false on failure.

errorMessage

String

Failure reason as message. null on success.

Example 1: Send a Slack message

Workflow example

name: SendMessage
steps:
- name: send_slack_message
type: action
action: slack.chat.postMessage
version: 1
inputs:
token: ${{ :secrets:dn_staging_slack_token }}
channel: ${{ .workflowInputs.channel }}
text: ${{ .workflowInputs.text }}
selectors:
- name: threadTs
expression: ".threadTs"
- name: channelID
expression: ".channelID"

Inputs:

{
"inputs": [
{
"key": "channel",
"value": "test-channel-workflow"
},
{
"key": "text",
"value": "This is my message *with bold text* and `code backticks`"
}
]
}

Expected output:

[
{
"threadTs": "1718897637.400609",
"channelID": "C063JK1RHN1",
"success": true
}
]

Example 2: Attach a file

Workflow example

name: SendFileMessage
steps:
- name: postCsv
type: action
action: slack.chat.postMessage
version: 1
inputs:
token: ${{ :secrets:dn_staging_slack_token }}
channel: test-channel-workflow
text: "Please find the attached file:"
attachment:
filename: 'file.txt'
content: "Hello\nWorld!"

Expected output:

[
{
"threadTs": "1718897637.400609",
"channelID": "C063JK1RHN1",
"success": true
}
]
Copyright © 2026 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.