-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Notifier] Add Google Chat bridge #36488
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
Conversation
2818f7b
to
f6be85f
Compare
src/Symfony/Component/Notifier/Bridge/GoogleChat/Component/ComponentTrait.php
Outdated
Show resolved
Hide resolved
if ('googlechat' === $scheme) { | ||
$space = explode('/', $dsn->getPath())[3]; | ||
$accessKey = $dsn->getOption('key'); | ||
$accessToken = $dsn->getOption('token'); |
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.
You should probably throw an exception of the key and/or token is empty. Or perhaps better, user the username/password like other providers.
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.
I like the simplicity of copy-paste the webhook url without too much alteration. Changing the scheme is already a trap I fell into while coding this bridge.
But maybe it's a good thing to move apart from the url provided by Google in order to make clear for developers that they have to parse it in their mind and rewrite it following a custom pattern.
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.
Regarding how other DSN are made, I chose to use a DSN totally different from the webhook url.
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.
After a review of existing DSN, I applied the following format:
googlechat://ACCESS_KEY:ACCESS_TOKEN@default/SPACE?threadKey=THREAD
Where THREAD
is optional.
f24c202
to
467b481
Compare
This PR was not getting much attention. Since the scope was a little too large, I've removed some non-essential features (card DSL, create transform from webhookUrl) in 1b1946c. I hope It can be accepted with this scope. |
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 with some minor comments.
src/Symfony/Component/Notifier/Bridge/GoogleChat/GoogleChatTransport.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Notifier/Bridge/GoogleChat/GoogleChatTransport.php
Outdated
Show resolved
Hide resolved
Thanks for the review. Each comment has been treated. |
Thank you @GromNaN. |
@GromNaN Can you submit a PR on symfony/recipes (you can have a look at other notifier bridge recipes to get some inspiration)? |
…transports (GromNaN) This PR was squashed before being merged into the master branch. Discussion ---------- [Notifier] Add GoogleChat to the list of supported chat transports Documentation for symfony/symfony#36488 Commits ------- 7bfacde [Notifier] Add GoogleChat to the list of supported chat transports
Uses the webhook to send messages.
The
threadKey
can be any string, it allows to post all messages to the same thread instead of creating a new thread for each message.Example of notification for exceptions:
