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
[Notifier] [Slack] [DX] Improve the DX #39560
Comments
?channel=#channel works if you escape the # |
Oh nice to know 😄 |
If we have a dedicated - slack://TOKEN@default?user=@OskarStark
+ slack://TOKEN@default?user=OskarStark |
AFAIK, slack deprecate webApi for
Maybe we should follow the same move, and instead of having multiple query params available, having only DSN could be :
|
I like your idea a lot @Jibbarth 👍 |
This PR was squashed before being merged into the 5.3-dev branch. Discussion ---------- [Notifier] [Slack] Validate token syntax | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | --- | License | MIT | Doc PR | - This PR follows #39560 @odolbeau @malteschlueter @norkunas @fabpot can you confirm all your tokens start with `xox`? _From the Slack documentation:_ * Bot user token strings begin with `xoxb-` * User token strings begin with `xoxp-` * Workspace access token strings begin with `xoxa-2` Commits ------- 59f29c5 [Notifier] [Slack] Validate token syntax
This PR was squashed before being merged into the 5.3-dev branch. Discussion ---------- [Notifier] [Slack] Validate token syntax | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | --- | License | MIT | Doc PR | - This PR follows symfony/symfony#39560 @odolbeau @malteschlueter @norkunas @fabpot can you confirm all your tokens start with `xox`? _From the Slack documentation:_ * Bot user token strings begin with `xoxb-` * User token strings begin with `xoxp-` * Workspace access token strings begin with `xoxa-2` Commits ------- 59f29c592b [Notifier] [Slack] Validate token syntax
Thank you for this issue. |
I don't have so much time right now, lets close this for now 👍 |
Improvements for
symfony/slack-notifier
The generic
channel
optionThe problem:
Right now you can provide a
channel=
option, and you can pass nearly everything... 🤔This is the full DSN:
SLACK_DSN=slack://TOKEN@default?channel=CHANNEL
I tried a lot to figure out WHAT you need to pass exactly:
#support
->?channel=support
✅@OskarStark
->?channel=@OskarStark
✅@OskarStark
you can also use the UserId, which can be found in your profile ->?channel=U68xxxx
🤔 ✅So far this looks ok, but there are some pitfalls we can avoid. One would think he can just use:
?channel=#support
❌ NO # sign allowed 😮?channel=OskarStark
❌ NO, @ sign needed 😮?channel=@U68xxxx
❌ NO @ sign allowed 😮My proposal:
A new
user=
(orhandle
=) anduser_id=
parameter.We can now validate, that a channel must not start with
#
, a user must start with@
and a user_id must not start with@
(maybe it also has a dedicated length which can be taken into account).So valid DSN would be:
The correct token - PR #39606
The Problem:
Because we switched back and forth from a token to a webhook_id, which can be considered a "token" too, it could be hard to find out, if you are using the correct token.
My proposal:
Let's validate the token syntax in the transport and give a clear error message.
Slack has a clear syntax for their tokens which makes us able to validate the syntax before we perform a request.
xoxb-
xoxp-
xoxa-2
Questions
cc @malteschlueter as we both had some trouble in the past
The text was updated successfully, but these errors were encountered: