So my goal is to include an image, with buttons, in a message. However, the file is not public and files_upload method takes away the functionality of the buttons, issue similar to this https://github.com/slackapi/bolt-python/issues/411.
While working on the solution to 1. upload the file, 2. unfurl the permalink, I managed to make it work but the output is not what I would like:
I would like the unfurled link image to appear under the blocks while keeping the blocks in the attachment section. Is this achievable? Also, the only time I can unfurl is to include the link within the test section, can this be changed? Sourcecode:
upload_resp = slack_client.files_upload(
initial_comment=uploadfiles["initial_comment"],
file=uploadfiles["file"],
filename=uploadfiles["filename"],
filetype=uploadfiles["filetype"],
title=uploadfiles["title"]
)
attachments = [
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Hi !*" ,
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Title*"
}
}
,{
"type": "actions",
"block_id": "actionblock",
"elements": [
{
"type": "button",
"action_id" : "rerun_action",
"text": {
"type": "plain_text",
"text": "Rerun",
"emoji": True
},
"style": "primary",
"value": "rerun"
},
{
"type": "button",
"action_id" : "launch_wizard",
"text": {
"type": "plain_text",
"text": "Launch Wizard",
"emoji": True
},
"style": "primary",
"value": "launch"
}
]
}
]
}
]
resp = slack_client.chat_postMessage(
channel=message["channel_id"],
text=upload_resp['file']['permalink'],
attachments = attachments,
blocks=[],
unfurl_links=True,
unfurl_media=True
)