Slack -> Send Channel Message
Action summary
Slack -> Send Channel Message
Function Documentation: Slack -> Send Channel Message
Overview
This function sends a message to a specified Slack channel using the Slack API. It uses a pre-configured Slack token from the environment to authenticate the request and sends a message to the channel based on user inputs.
Inputs
slack_token
(registry|text) Required- Purpose: The Bot User OAuth Token that is automatically generated when you install an app to a Slack Workspace.
channel_id
(text) Required- Purpose: The ID of the Slack channel where the message will be sent.
message
(text) Required- Purpose: The content of the message to be sent to the Slack channel.
Function Stack
1. API Request to Slack
- Endpoint:
https://slack.com/api/chat.postMessage
- Method:
POST
- Parameters:
channel
: The Slack channel ID (channel_id
input).text
: The message content (message
input).
- Headers:
Authorization
: Bearerslack_token
- Purpose: Sends a message to the specified Slack channel using the Slack API.
- Method:
2. Create Variable: response
- Variable:
var: response = var: api_response.response.result
- Purpose: Stores the response from the Slack API after sending the message.
Response
- The function returns the response from Slack, which contains information about the message and its status.
Success Response
{
{
"ok": true,
"channel": "C07983****",
"ts": "1728480204.015929",
"message": {
"user": "U06UJRZ****",
"type": "message",
.
.
.
}
}
}
Error response
{
"ok": false,
"error": "channel_not_found"
}
Example
Input
```json
{
"channel_id": "C01A*****",
"message": "Hello, Slack channel!"
}
```
Output
{
{
"ok": true,
"channel": "C07983****",
"ts": "1728480204.015929",
"message": {
"user": "U06UJRZ****",
"type": "message",
.
.
.
}
}
}
Version notes
Current