Skip to content
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

[5.3] Added username, icon and channel options for Slack Notifications #14910

Merged
merged 2 commits into from
Sep 9, 2016
Merged

Conversation

kalfheim
Copy link
Contributor

@kalfheim kalfheim commented Aug 20, 2016

This PR allows you to set a custom username, icon (emoji) and channel override for incoming webhooks in Slack.

This is a totally supported feature in Slack, so why not take advantage of it?

<?php

class FooNotification extends Notification
{
    public function toSlack($notifiable)
    {
        return (new SlackMessage)
                    ->from('Ghostbot', ':ghost:')
                    ->to('#testytest') // `@username` is also supported
                    ->content('This is a message from a ghost posted in #testytest!');
    }
}

.. will give you this:

image

As the new methods are optional, this PR is not a breaking change.

Thoughts?

Edit: Renamed methods

@kalfheim
Copy link
Contributor Author

I guess as cannot be used as a method name 😭 Ideas, anyone?

@crynobone
Copy link
Member

@kalfheim from('Ghostbox', ':ghost:')?

@kalfheim
Copy link
Contributor Author

@crynobone Yup! Sounds good to me.

I also renamed in to to. Makes more sense when sending a notification to a user instead of a channel (by typing @username as opposed to #some_channel)

@taylorotwell
Copy link
Member

Has merge conflicts.

@taylorotwell taylorotwell merged commit 32412ec into laravel:5.3 Sep 9, 2016
@kalfheim
Copy link
Contributor Author

kalfheim commented Sep 9, 2016

Thanks, @taylorotwell! Was just about to try and fix the merge conflict, but you beat me to it. 😄

@hinaloe
Copy link

hinaloe commented Sep 22, 2016

Why can't I use icon_url not icon_emoji ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants