You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thank you for sharing this with the community. You rock!
I'd like to have a way to customize the messages sent to Slack, without having to edit platform2slack code. This could be just a callback, given when setting up my hook, much like validateToken():
// Optional settings$settings = [
'channel' => '#random',
'region' => 'eu',
];
$platformsh2slack = newHanoii\Platformsh2Slack\Platformsh2Slack(
'https://hooks.slack.com/services/...',
$settings
);
// 'environment.delete' come from the `switch ($platformsh->type)`$platformsh2slack->customizeSlackText('environment.delete', function ($defaultText, $platformsh) {
returnsprintf('Oh noes, the env "%s" has been deleted', $platformsh->payload->environment->name);
});
// "all" is a special event$platformsh2slack->customizeSlackText('all', function ($defaultText, $platformsh) {
returnsprintf('Hey @here: %s', $defaultText); // Prefix any message sent to slack.
});
My own usecase is that I want to customize the way routes are displayed, to make it more user-friendly (read: project manager friendly)
I'm willing to take some time and write the PR, but I wanted to know if you were interested in such a new feature.
The text was updated successfully, but these errors were encountered:
Hey, thanks, I am glad you like it. I appreciate the suggestion, I recently moved this into a proper composer library and the formatting of message was carried over from the original script. It's definitely a place to improve.
To be honest, I believe that callbacks are not the way to go. Not very OOP.
What you could and show do is extend the class and override the methods you need.
Right now that's processPlatformshPayload(), however, it kind of have quite a bit of logic. That function needs to be properly refactored into something that's easier to extend from upper classes and make better functions to extend.
If you are want to contribute some refactor I am happy to review.
Also, if if you want to suggest a more user friendly way of displaying routes, and if I like it more or it looks better that what I did, I am also happy to change it. I haven't given it much thought.
Hi!
First of all, thank you for sharing this with the community. You rock!
I'd like to have a way to customize the messages sent to Slack, without having to edit
platform2slack
code. This could be just a callback, given when setting up my hook, much likevalidateToken()
:My own usecase is that I want to customize the way routes are displayed, to make it more user-friendly (read: project manager friendly)
I'm willing to take some time and write the PR, but I wanted to know if you were interested in such a new feature.
The text was updated successfully, but these errors were encountered: