The conversation ID for the channel you are sending the message to
C123456
D123ABC456
The textual message to send to channel
Optional parametersAdditional
metadataabout the message, which can then be used an
workflow event trigger.
Buttons to send with the message. Must be wrapped in a block. Accepts either
button
or
workflow_button
elements only.
Required parametersAn individual instance of the message you sent
The channel-specific unique identifier for this message, also serves as a confirmation that the message was sent.
Permalink URL of the message that was sent
Optional parametersIf
interactive_blocks
was provided, the action object contains the
buttonproperties (see
action payloadbelow)
If
interactive_blocks
is provided as an input parameter, the
interactivitycontext becomes available
Sends a message to a specific channel. The message
input only supports non-interactive rich_text
.
This function returns a timestamp of the new message, which also serves as a confirmation that the message was sent.
Direct messages
The send_message
function does not allow for direct messages to users — use the send_dm
function instead.
The interactive_blocks
input only supports the button
and workflow_button
interactive blocks.
Ensure that you do not use non-interactive elements via the interactive_blocks
input, as this could cause unintended behavior.
If you include a button in the message, the function execution will not continue until a user clicks on that button.
ExampleTo collect a formatted message from your end users and send it as-is, you can use a form to collect the formatted text, and a Slack function to send it:
import { DefineWorkflow, Schema } from "deno-slack-sdk/mod.ts";
export const RichTextWorkflow = DefineWorkflow({
callback_id: "rich_text_workflow",
title: "rich-text input workflow",
input_parameters: {
properties: {
interactivity: { type: Schema.slack.types.interactivity },
channel: { type: Schema.slack.types.channel_id },
},
required: ["interactivity", "channel"],
},
});
const inputForm = RichTextWorkflow.addStep(
Schema.slack.functions.OpenForm,
{
title: "Send formatted message",
interactivity: RichTextWorkflow.inputs.interactivity,
submit_label: "Send formatted message",
fields: {
elements: [
{
name: "formattedInput",
title: "Formatted input",
type: Schema.slack.types.rich_text,
},
{
name: "channel",
title: "Post in:",
type: Schema.slack.types.channel_id,
default: RichTextWorkflow.inputs.channel,
},
],
required: ["channel", "formattedInput"],
},
},
);
RichTextWorkflow.addStep(Schema.slack.functions.SendMessage, {
channel_id: inputForm.outputs.fields.channel,
message: inputForm.outputs.fields.formattedInput,
interactive_blocks: [{
"type": "actions",
"elements": [
{
"type": "button",
"text": { "type": "plain_text", "text": "Approve" },
"style": "primary",
"value": "approve",
"action_id": "approve_button",
},
],
}],
});
Here's an example with just regular text:
import { DefineWorkflow, Schema } from "deno-slack-sdk/mod.ts";
export const createAnnouncement = DefineWorkflow({
callback_id: "create-announcement",
title: "Workflow for creating announcements",
input_parameters: { properties: {}, required: [] },
});
const sendPreview = createAnnouncement.addStep(
Schema.slack.functions.SendMessage,
{
channel_id: "CTLC2K3JS",
message: "Good to see you here!",
},
);
Action payload
Example action
payload:
{
"action_id": "WaXA",
"block_id": "=qXel",
"text": {
"type": "plain_text",
"text": "View",
"emoji": true
},
"value": "click_me_123",
"type": "button",
"action_ts": "1548426417.840180"
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4