laravel / slack-notification-channel

Slack Notification Channel for laravel.

Home Page:https://laravel.com/docs/notifications#slack-notifications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow `Attachement` type with the new `Block Kit`

maximepvrt opened this issue · comments

@maximepvrt do you mean for this kind of "block"?

CleanShot 2023-08-02 at 09 39 29@2x

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
Capture d’écran 2023-08-02 à 11 03 58

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?