laravel / slack-notification-channel

Slack Notification Channel for laravel.
https://laravel.com/docs/notifications#slack-notifications
MIT License
865 stars 59 forks source link

[1.0] Add actions (buttons) to attachments #6

Closed Jeroen-G closed 5 years ago

Jeroen-G commented 5 years ago

This PR adds the option to show buttons, called actions, under attachments in Slack notifications.

Slack API: https://api.slack.com/docs/message-attachments#action_fields

How it could look: afbeelding

How this would look in the notification class:

public function toSlack($notifiable): SlackMessage
    {
        return (new SlackMessage())
            ->error()
            ->attachment(function (SlackAttachment $attachment) {
                $attachment
                    ->title('🚨 '.$this->site->name.' lijkt offline.')
                    ->content('URL: '.$this->url)
                    ->action('🔎  Monitor openen', url('/'));
            });
    }
taylorotwell commented 5 years ago

This doesn't support the "style" setting?

Jeroen-G commented 5 years ago

Now it does 😄