Replies: 3 comments 4 replies
-
No, we want to keep this package very simple. If you need blocks, use another package 👍 |
Beta Was this translation helpful? Give feedback.
-
For rich messages you can use https://github.com/slack-php/slack-php-block-kit |
Beta Was this translation helpful? Give feedback.
-
@freekmurze I completely understand the point of keeping this package simple, as anyone wanting more exciting stuff can always just use plane on-demand notifications 👍 But just wanted to share my thoughts anyway, so please just disregard if this is not up your alley 😎 If instead of directly making an HTTP request, it would send a new My motivation is that for all of the system notifications we have, then we have an array of keys and values that represent some data, like the user that signed up, the job that completed, etc.. Example if the package used its own Notification: SlackAlert::to('marketing')
->message("New sale: {$subscription->name}!", function (SlackMessage $message) {
// here the developer can do WHATEVER they want - an example could be adding attachment:
$message->attachment(function ($attachment) use ($url) {
$attachment->title('Invoice 1322', $url)
->fields([
'Title' => 'Server Expenses',
'Amount' => '$1,234',
'Via' => 'American Express',
'Was Overdue' => ':-1:',
]);
});
}); an alternative approach could be to use a more opinionated approach where the user does not have the same flexibility (access to the underlying Notification), but instead can pass an array of stuff: SlackAlert::to('marketing')->message("New sale: {$subscription->name}!", [
// these will be added as fields
'Title' => 'Server Expenses',
'Amount' => '$1,234',
'Via' => 'American Express',
'Was Overdue' => ':-1:',
]);
// Or when sending an error:
SlackAlert::to('marketing')->error("Transaction failed: {$subscription->name}!", [
// ...
]);
// Or a success
SlackAlert::to('marketing')->success("Transaction failed: {$subscription->name}!", [
// ...
]); but again, if this is really the implementation then maybe a simple static method on a custom |
Beta Was this translation helpful? Give feedback.
-
Hi,
are there any plans to support
blocks
parameter? Which allows creating rich messages, see example belowBeta Was this translation helpful? Give feedback.
All reactions