-
-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change NotifySlack payload #412
Conversation
Codecov Report
@@ Coverage Diff @@
## master #412 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 94 94
Lines 11966 11968 +2
Branches 2011 2012 +1
=========================================
+ Hits 11966 11968 +2
Continue to review full report at Codecov.
|
Thanks for your pull request! 👍 🙏 |
@Quarky9
|
@artbycrunk That is correct but according to my tests it does not make a difference, details see https://api.slack.com/methods/chat.postMessage#arg_icon_url |
@Quarky9 Yeah so in my case I pass a different icon_url passed on the type of msg I am posting to a channel, and after this change, I noticed that it default to the icon set for the channel. |
Hi, As adding it back in does not affect my tests at least I will send another PR to re-add the line when I get to it. |
@Quarky9 thanks for the quick fix |
This new format seems to have undesirable effects. I"m wonder if there is a way we can blend the old way with your suggested way a bit better? |
@caronc During my changes, I kept the way of nesting the actual message within the top-level 'attachments' structure to preserve the original style incl. the coloured bars etc. We might want to try to also add the top-level 'text' element next to 'attachments' and see if that fixes the issues mentioned in |
I like your idea; I was experimenting already before you had replied and had a small PR which keeps your changes (and i tested all 4 combinations) and it works well. It just allows mobile stuff to work out of the gate, at the same time you still get to leverage the style you prefer. |
Tested both versions ( blocks yes/no). |
I had the escape break for the title, but no matter what i did for URL testing (using the block) the escaping worked fine. So i put that in if-block. The website kind of hints that you need to escape the content to avoid contents since it uses those keywords internally. |
In general escaping is probably the right thing but within the blocks and when you want to actually use markdown and eg. links escaping breaks it. See https://api.slack.com/reference/surfaces/formatting#linking-urls as example. |
Okay, I'll leave the escaping on for the legacy mode only then? Would that work better maybe? |
Ideally we only escape the fields which are text vs. skip escaping for anything being markdn |
@caronc Tested your latest commit. Works like a charm same as before using |
to use new blocks feature to allow more markdown parsing and formatting.
Description:
Changed the payload format of Slack from old attachment to new recommended
blocks
attachment.Incl. sections for body ( title optional as header section ) and footer as context block.
See: https://api.slack.com/reference/messaging/payload under
attachments
.I kept the outer attachment structure though for its support of the coloured bar.
Checklist
flake8
)All Slack related tests passed.