Closed maximepvrt closed 1 year ago
@maximepvrt do you mean for this kind of "block"?
It's not possible currently, but we'd accept a PR for this.
Yes @jbrooksuk. My PR #74 was closed by @taylorotwell.
Could you please review my initial attempt at integrating this type of block and provide me with your feedback? I'm willing to continue working on this PR and add tests if you think it has a chance of being merged.
@maximepvrt your PR was closed as it did not include any explanation, reasoning or examples. I would say that setting the color
to denote an "attachment" is not a clear DX.
Your PR will also need to include additional tests.
@jbrooksuk, thank you for your feedback. I understand your concerns regarding the lack of explanation, reasoning, and examples in PR. Regarding the use of color to denote an 'attachment' not being clear for DX, I would like to point out that the only differing factor from a regular message in the new 'Block Kit' format for Slack is the addition of a vertical colored bar.
You can test by switching Message to Attachment on this page
Could you please elaborate on what improvements you suggest for a better DX ? I'm open to your suggestions and would appreciate your insights on how to enhance the clarity and usability of this feature. Additionally, I will make sure to include the necessary additional tests in the PR.
@maximepvrt actually, having read a bit more about the "Attachment" option, it looks like Slack considers this deprecated.
In early 2019 we introduced a new way of composing messages, by using blocks to create rich layouts and enable interactivity. Slack apps designed and built before then may have used features such as attachments which are now considered outmoded.
These older features will continue to work, but apps using them will miss out on the new layout and interactivity features blocks provide. — https://api.slack.com/messaging/attachments-to-blocks
As such, if you need to use the older attachments, I'd consider using the SlackMessage
class, which still exists in 3.x
@jbrooksuk, thank you for sharing that information. I appreciate your clarification regarding the "Attachment" option in Slack's messaging. It seems that there might have been a misunderstanding regarding the deprecation status.
I would like to highlight that Slack has introduced 'Attachments to Blocks' as a means to aid migration and to provide a smoother transition for older features to the new layout and interactivity features that blocks offer.
Finding equivalents for older visual elements Nearly every older visual element has a direct equivalent in blocks or block elements. If you were using attachments, you can find a list of block alternatives for each visual component in our attachment fields reference guide.
There is one exception, and that's the color parameter, which currently does not have a block alternative. If you are strongly attached (🎺) to the color bar, use the blocks parameter within an attachment.
This will let you place newer blocks inside of an attachment, but bear in mind the advice above and use the opportunity to rethink your message composition. Users will increasingly associate attachments with less-important secondary content because they have a lower visual hierarchy compared to blocks.
There are a few more things to watch out for if you're an old hand at pre-block message composition.
— https://api.slack.com/messaging/attachments-to-blocks#direct_equivalents
@maximepvrt it may be supported, but the way I read it is that Slack still don't recommend it:
This will let you place newer blocks inside of an attachment, but bear in mind the advice above and use the opportunity to rethink your message composition. Users will increasingly associate attachments with less-important secondary content because they have a lower visual hierarchy compared to blocks.
I think what you are looking for is remote files https://api.slack.com/messaging/files/remote
Would a PR to add this get considered?
Can you maintain
Attachment
type with the newBlock Kit
? Currently it only possible useMessage
type.An example of
Attachement Block Kit
https://app.slack.com/block-kit-builder/T92LZA0G7#%7B%22blocks%22:%5B%7B%22type%22:%22header%22,%22text%22:%7B%22type%22:%22plain_text%22,%22text%22:%22Invoice%20Paid%22%7D%7D,%7B%22type%22:%22context%22,%22elements%22:%5B%7B%22type%22:%22plain_text%22,%22text%22:%22Customer%20#1234%22%7D%5D%7D,%7B%22type%22:%22section%22,%22text%22:%7B%22type%22:%22plain_text%22,%22text%22:%22An%20invoice%20has%20been%20paid.%22%7D,%22fields%22:%5B%7B%22type%22:%22mrkdwn%22,%22text%22:%22*Invoice%20No:*%5Cn1000%22%7D,%7B%22type%22:%22mrkdwn%22,%22text%22:%22*Invoice%20Recipient:*%5Cntaylor@laravel.com%22%7D%5D%7D,%7B%22type%22:%22divider%22%7D,%7B%22type%22:%22section%22,%22text%22:%7B%22type%22:%22plain_text%22,%22text%22:%22Congratulations!%22%7D%7D%5D%7D