Christian Kaal
Christian Kaal

Reputation: 232

Laravel Slack documentation?

I've read the page about the new notifications in Laravel 5.3, and seen some tutorials from Laracasts, but I would like to know what is available in terms of variables etc.

In the Slack API documentation, I can see that I can create buttons in the notification, however, the notification (using SlackMessage) shows that I can't use action() and it throws

Error

Call to undefined method Illuminate\Notifications\Messages\SlackMessage::action()

Does anyone have some information about this?

Thanks in advance!

Upvotes: 0

Views: 1102

Answers (1)

Lionel Chan
Lionel Chan

Reputation: 8059

What I think is you are reading the documentation wrongly. According to Laravel's Slack Notification, it doesn't help you create "button" in Slack.

The Laravel Notification is a mechanism for you to create notification through different channels, like SMS (Nexmo), Database, Emails, Slack. So if you think about this carefully, "button" is actually not a common pattern in these channels, hence action is not implemented here in Slack.

In contract, the action method found in SimpleMessage or MailMessage is actually referring to "call-to-action" button. It helps you create a button in the email nicely. This is not true in other type of notifications, such as DatabaseMessage, NexmoMessage, or SlackMessage. You simply don't (or doesn't make sense) to create buttons in these channels.

If you need to create additional content with SlackMessage, simply extend it and build one for your own.

Upvotes: 2

Related Questions