-
Notifications
You must be signed in to change notification settings - Fork 860
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
fix(notifications): include icon in slack legacy url #1303
fix(notifications): include icon in slack legacy url #1303
Conversation
…-icon-url, and added tests for new features
Codecov Report
@@ Coverage Diff @@
## main #1303 +/- ##
==========================================
+ Coverage 63.65% 63.86% +0.21%
==========================================
Files 23 23
Lines 1527 1536 +9
==========================================
+ Hits 972 981 +9
Misses 465 465
Partials 90 90
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous implementation assumed that the discord URL had a trailing path argument in the URL path
Ex: https://discordapp.com/api/webhooks/WEBHOOK_ID/TOKEN/slack
Yes, this is because that is the slack API emulation endpoint for discord. Using the regular discord webhook API with a slack client would not work.
Proper discord support is added through shoutrrr, and this is only a helper that creates a shoutrrr URL from the arguments. It should behave as the original implementation.
Added support for the --notification-slack-icon-url
This was actually an unintended regression, so this should probably be added.
Looking through the parsing of the hookURL in the GetURL function the /slack endpoint is never parsed and therefore makes no difference when it is present or not. I however have not looked through the shoutrrr source and would not be surprised if shoutrrr is adding the /slack endpoint back in. I made this change to help simplify discord notification integration. IMHO when you are given a webhook URL you shouldn't have to modify the URL to use it. The lack of documentation when it comes to using discord notifications requires digging into the source to determine that the webhook URL needs an extra endpoint (actually any endpoint works ex. I do plan on adding documentation for discord notifications in the next week. I have tested this PR both with and without the /slack endpoint and can verify that it functions the same either way. |
That's because the discord-over-slack-API is not recommended, nor supported. We only added the helper so that it wouldn't break the current users use-cases.
No, it doesn't, because it's got native discord support. It's not using the slack-emulation in the discord API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
Modified parsing of discord URLs:
https://discordapp.com/api/webhooks/WEBHOOK_ID/TOKEN/slack
https://discordapp.com/api/webhooks/WEBHOOK_ID/TOKEN
/slack
argument is never parsed by watchtower or sent to shoutrrr it should not be a requirementhttps://discordapp.com/api/webhooks/WEBHOOK_ID/TOKEN/slack
andhttps://discordapp.com/api/webhooks/WEBHOOK_ID/TOKEN
Added support for the
--notification-slack-icon-url
argument when using a discord webhook:Added two tests for my additions
WEBHOOK_ID
andTOKEN
when there is no trailing path argument in the discord webhook URL--notification-slack-icon-url
argument with a discord webhook URL--notification-slack-identifier
argument with a discord webhook URL (not previously tested)