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. |
|
channel | String | Required. The name of the channel, or a channelID, to send the message. See Slack API for more information. |
|
text | String | Required. The message to be posted to Slack in the specified |
|
threadTs | String | Optional. Timestamp belonging to parent message, used to create a message reply in a thread. |
|
attachment | Map | Optional. Allows attaching a file with a message onto the specified | |
attachment.filename | String | Required when using |
|
attachment.content | String | Required when using |
|
selectors | List | Optional. The selectors to get only the specified parameters as output. |
|
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 |
channelID | String | ID of the channel where the message is posted. |
success | Boolean |
|
errorMessage | String | Failure reason as message. |
Example 1: Send a Slack message
Workflow example |
|---|
Inputs: Expected output: |
Example 2: Attach a file
Workflow example |
|---|
Expected output: |