Post to Slack Block

Send messages from your AI Worker directly to a Slack channel

The Post to Slack Block allows you to send messages directly to a Slack channel as part of your workflow. This block is perfect for automating updates, team notifications, or alerts with customizable formatting.

Configurations

Message Type

Choose how the message will be formatted before sending to Slack:

  • Markdown Text: Use Slack-compatible Markdown to create formatted text messages (e.g., *bold*, _italic_, > for blockquotes).

  • Slack Block Kit Blocks: Design a highly customized message layout using Slack's Block Kit. Block Kit enables advanced formatting, such as interactive elements, sections, dividers, and more. Learn more at Slack Block Kit Documentation.

Channel

Connect to a Slack channel where the message will be posted.

  • Click Add to Slack to authenticate and link your Slack account.

  • Once connected, select the desired channel from your Slack workspace.

Message Content

Compose your message in markdown or build your custom Slack block.


How to Write Slack Blocks

Slack blocks are modular and interactive components used to create rich, visually engaging messages in Slack. With the Slack Block Kit, you can stack and arrange blocks to design powerful message layouts that deliver information or enable user interactions.

Block Basics

Blocks are the building units for creating structured, visually appealing Slack messages. They are stackable components designed to display text, images, buttons, and other elements in a flexible, layout-friendly way.

Types of Blocks

Blocks are the core components used to structure and organize the content of your Slack messages.

Block Type
Description

Actions

Contains interactive elements like buttons and menus.

Context

Displays small contextual information with images or text.

Divider

Adds a horizontal line to separate content.

File

Displays information about remote files.

Header

Displays large, bold text for headings.

Image

Displays standalone images.

Input

Collects user input via various input types.

Rich Text

Allows formatted and structured text.

Section

Displays text alongside optional block elements like buttons or images.

Video

Embeds a video player.

Block Elements

Block elements are the interactive or visual components embedded inside blocks to enrich the functionality of your message.

Element Type
Description

Button

Provides users with a direct path to performing actions like confirming tasks.

Checkboxes

Allows users to select multiple options from a list.

Date/Time Pickers

Enables users to select a date, time, or both.

Dropdown Menus

Lets users choose from a list of options.

Plain Text Input

Allows users to enter freeform text.

Radio Buttons

Limits users to selecting one option.

Image

Displays an image as part of a larger block of content.

Overflow Menu

Provides a button that shows a list of additional options.

Multi-Select Menu

Lets users select multiple options from a dropdown list.

Composition Objects

Composition objects allow you to enhance the structure of blocks and elements, enabling even more customization and interactivity.

Composition Object
Description

Confirmation Dialog Object

Adds a confirmation step to interactive elements like buttons.

Conversations Filter Object

Filters the list of options in conversation selector menus.

Option Object

Represents a single item in a list of options for selection elements.

Option Group Object

Groups options in select menus for better organization.

Text Object

Defines text formatting for different blocks and elements.

Workflow Object

Contains workflow trigger information for running specific workflows.

Slack File Object

Represents a file for use in Image or File blocks.


Design Slack Blocks Using Slack's Block Kit Builder

Slack’s Block Kit Builder lets you visually design your blocks, test layouts, and prototype quickly. It provides:

  • Drag-and-drop elements to stack and organize blocks.

  • Previews to refine your design.

  • Click Copy Payload button to copy and paste JSON into your app.

Slack Block Kit Reference Examples

Example 1: Simple Task Update

{
  "blocks": [
    {
      "type": "header",
      "text": {
        "type": "plain_text",
        "text": "Task Update"
      }
    },
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "*Task Completed:* The task `{{taskName}}` is finished!"
      }
    },
    {
      "type": "divider"
    },
    {
      "type": "actions",
      "elements": [
        {
          "type": "button",
          "text": {
            "type": "plain_text",
            "text": "View Task"
          },
          "url": "{{taskLink}}"
        }
      ]
    }
  ]
}

Example 2: Collecting User Feedback

{
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "We’d love your feedback! How would you rate your experience?"
      }
    },
    {
      "type": "actions",
      "elements": [
        {
          "type": "radio_buttons",
          "options": [
            {
              "text": {
                "type": "plain_text",
                "text": "Excellent"
              },
              "value": "excellent"
            },
            {
              "text": {
                "type": "plain_text",
                "text": "Good"
              },
              "value": "good"
            },
            {
              "text": {
                "type": "plain_text",
                "text": "Needs Improvement"
              },
              "value": "needs_improvement"
            }
          ]
        }
      ]
    }
  ]
}

Last updated