L2 Construct: slack_block
formatters slack_block_formatter slackDescription
SlackBlockFormatter converts an arbitrary object into a list of Slack blocks.
L2 Data
- Provider: pontus
- Module: formatter
- Action: slack_block
Example Step
{
"name": "insert-your-step-name",
"type": "l2",
"l2_data": {
"provider": "pontus",
"module": "formatter",
"action": "slack_block",
"metadata": {}
}
}
Input
Example
{
"objects": [
{
"name": "John Doe"
},
{
"headers": ["Name", "Age", "City"],
"rows": [
["Alice", 30, "New York"],
["Bob", 25, "San Francisco"],
["Charlie", 35, "London"]
]
}
]
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/pontus/formatters/slack-block-formatter-input",
"$ref": "#/$defs/SlackBlockFormatterInput",
"$defs": {
"SlackBlockFormatterInput": {
"properties": {
"objects": {
"items": true,
"type": "array"
}
},
"additionalProperties": false,
"type": "object",
"required": ["objects"]
}
}
}
Output
Example
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hello, this is a *section* block with _markdown_."
}
},
{
"type": "divider"
},
{
"type": "image",
"image_url": "https://example.com/image.jpg",
"alt_text": "An example image"
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "This is a plain text section."
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "Click me!"
},
"value": "button_click",
"action_id": "button_1"
}
}
]
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/pontus/formatters/slack-block-formatter-output",
"$ref": "#/$defs/SlackBlockFormatterOutput",
"$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"]
},
"SlackBlockFormatterOutput": {
"properties": {
"blocks": {
"items": {
"$ref": "#/$defs/Block"
},
"type": "array"
}
},
"additionalProperties": false,
"type": "object",
"required": ["blocks"]
},
"TextObject": {
"properties": {
"type": {
"type": "string"
},
"text": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object",
"required": ["type", "text"]
}
}
}