L2 Hub
Slack
bot
Send Block Message as Response

L2 Construct: send_block_message_as_response

slack bot message send

Description

Sends a message with blocks to a Slack channel.

If the ResponseURL is provided, the message is sent as a response to a slash command or interactive message. If the ResponseURL is not provided, the message is sent as a new message to a channel.

L2 Data

  1. Provider: slack
  2. Module: bot
  3. Action: send_block_message_as_response

Example Step

{
  "name": "insert-your-step-name",
  "type": "l2",
  "l2_data": {
    "provider": "slack",
    "module": "bot",
    "action": "send_block_message_as_response",
    "metadata": {}
  }
}
 

Input

Example

{
  "response_url": "https://hooks.slack.com/commands/T06S34567890/1234567890/abcdeFGHIJklmnoPQRSTUVwxyz",
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "Hello, World!"
      }
    },
    {
      "type": "divider"
    },
    {
      "type": "image",
      "image_url": "https://example.com/image.jpg",
      "alt_text": "An example image"
    }
  ],
  "response_type": ""
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/slack/send-block-message-input",
  "$ref": "#/$defs/SendBlockMessageInput",
  "$defs": {
    "Accessory": {
      "properties": {
        "type": {
          "type": "string"
        },
        "text": {
          "$ref": "#/$defs/TextObject"
        },
        "value": {
          "type": "string"
        },
        "action_id": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["type", "action_id"]
    },
    "Block": {
      "properties": {
        "type": {
          "type": "string"
        },
        "text": {
          "$ref": "#/$defs/TextObject"
        },
        "fields": {
          "items": {
            "$ref": "#/$defs/TextObject"
          },
          "type": "array"
        },
        "accessory": {
          "$ref": "#/$defs/Accessory"
        },
        "image_url": {
          "type": "string"
        },
        "alt_text": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["type"]
    },
    "SendBlockMessageInput": {
      "properties": {
        "response_url": {
          "type": "string"
        },
        "blocks": {
          "items": {
            "$ref": "#/$defs/Block"
          },
          "type": "array"
        },
        "response_type": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["response_url", "blocks", "response_type"]
    },
    "TextObject": {
      "properties": {
        "type": {
          "type": "string"
        },
        "text": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["type", "text"]
    }
  }
}
 

Output

Example

{
  "ok": true,
  "error": {
    "is_error": false
  }
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/slack/send-block-message-output",
  "$ref": "#/$defs/SendBlockMessageOutput",
  "$defs": {
    "HandlerError": {
      "properties": {
        "is_error": {
          "type": "boolean"
        },
        "errors": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["is_error"]
    },
    "SendBlockMessageOutput": {
      "properties": {
        "ok": {
          "type": "boolean"
        },
        "error": {
          "$ref": "#/$defs/HandlerError"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["ok", "error"]
    }
  }
}