Hey, I have a scenario running that ends in a Slack message, including blocks with buttons. Then, I have a second scenario, started by a webhook, triggered by the button click in the Slack message. That e.g. then triggers an e-mail. I’d like to avoid multiple clicks on the same button, so I would like to update the Slack message after the button click.
In general, updating the Slack message works and I can remove everything and replace it with a new text.
What I try to achieve now is: The Slack message contains multiple blocks. I’d like to remove only the block with the buttons. I do neither find a way to re-use the blocks in a new message nor any way to edit only a part of that message.
Any suggestions?
My blocks e.g. look like this. I would be fine with always removing all blocks with the type “actions”. But right now, I do not find at all a way to re-use blocks in a new/updated slack message.
"blocks": [
{
"type": "section",
"block_id": "+qXt4",
"text": {
"type": "mrkdwn",
"text": "Yay, we got a new lead! :tada:",
"verbatim": false
}
},
{
"type": "divider",
"block_id": "LvvqY"
},
{
"type": "header",
"block_id": "7yQT+",
"text": {
"type": "plain_text",
"text": "Company",
"emoji": true
}
},
{
"type": "section",
"block_id": "W6GCX",
"fields": [
{
"type": "mrkdwn",
"text": "*Type:*\nGastro",
"verbatim": false
},
{
"type": "mrkdwn",
"text": "*Contact:*\nMax Mustermann",
"verbatim": false
}
]
},
{
"type": "section",
"block_id": "XXwgx",
"fields": [
{
"type": "mrkdwn",
"text": "*E-Mail:*\n<mailto:e@mail.com|e@mail.com>",
"verbatim": false
},
{
"type": "mrkdwn",
"text": "*VAT:*\nDE123456789",
"verbatim": false
}
]
},
{
"type": "divider",
"block_id": "SBl0N"
},
{
"type": "context",
"block_id": "JlCZI",
"elements": [
{
"type": "mrkdwn",
"text": "Request ID: 1234567899",
"verbatim": false
}
]
},
{
"type": "actions",
"block_id": "EWHBO",
"elements": [
{
"type": "button",
"action_id": "send-price-mail",
"text": {
"type": "plain_text",
"text": "Send Price-List E-Mail",
"emoji": true
},
"style": "primary",
"value": "1234567899"
},
{
"type": "button",
"action_id": "ignore",
"text": {
"type": "plain_text",
"text": "Ignore",
"emoji": true
},
"value": "1234567899"
}
]
}
]