-
-
Notifications
You must be signed in to change notification settings - Fork 198
Slack blocks node
Block Kit is a Slack framework to create complex interactions with the chatbot (panels, buttons, UI elements), the "Block" can be visually composed using the Block Kit Builder.
When the Block is ready, just copy and paste the JSON in the Slack Blocks node
, for example:
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hello *{{firstName}}*"
}
},
{
"type": "actions",
"block_id": "my_block_id",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Say Hello",
"emoji": true
},
"value": "the_value"
}
]
}
]
}
In any part of the JSON is also possible to use the chat context variables.
For interactive Blocks the result of the user interactions is sent to the chatbot as a response
type message (like
Dialog node), the payload is an hash object that contains the block_id of the UI element (a button, a dropdown, etc) and related value. If the block_id is not specified in the JSON, it will be auto-generated one.
For example clicking the button in the example above will send the following message to the chatbot
{
type: 'response',
content: {
my_block_id: 'the_value'
}
}
A response
type message can be chained directly to a Context node to store the results directly in the current user chat context.
The JSON can be passed through the payload by the upstream node:
msg.payload = {
blocks: '[{ ... }]'
};
Available parameters for the msg.payload
Name | Type | Description |
---|---|---|
blocks | string | The JSON string of the Slack Block |