class SlackMessage (View source)

Properties

string $level

The "level" of the notification (info, success, warning, error).

string|null $username

The username to send the message from.

string|null $icon

The user emoji icon for the message.

string|null $image

The user image icon for the message.

string|null $channel

The channel to send the message on.

string $content

The text content of the message.

bool $linkNames

Indicates if channel names and usernames should be linked.

$unfurlLinks

Indicates if you want a preview of links inlined in the message.

bool $unfurlMedia

Indicates if you want a preview of links to media inlined in the message.

array $attachments

The message's attachments.

array $http

Additional request options for the Guzzle HTTP client.

Methods

$this
success()

Indicate that the notification gives information about a successful operation.

$this
warning()

Indicate that the notification gives information about a warning.

$this
error()

Indicate that the notification gives information about an error.

$this
from(string $username, string|null $icon = null)

Set a custom username and optional emoji icon for the Slack message.

$this
image(string $image)

Set a custom image icon the message should use.

$this
to(string $channel)

Set the Slack channel the message should be sent to.

$this
content(string $content)

Set the content of the Slack message.

$this
attachment(Closure $callback)

Define an attachment for the message.

string
color()

Get the color for the message.

$this
linkNames()

Find and link channel names and usernames.

$this
unfurlLinks(string $unfurl)

Find and link channel names and usernames.

$this
unfurlMedia(string $unfurl)

Find and link channel names and usernames.

$this
http(array $options)

Set additional request options for the Guzzle HTTP client.

Details

$this success()

Indicate that the notification gives information about a successful operation.

Return Value

$this

$this warning()

Indicate that the notification gives information about a warning.

Return Value

$this

$this error()

Indicate that the notification gives information about an error.

Return Value

$this

$this from(string $username, string|null $icon = null)

Set a custom username and optional emoji icon for the Slack message.

Parameters

string $username
string|null $icon

Return Value

$this

$this image(string $image)

Set a custom image icon the message should use.

Parameters

string $image

Return Value

$this

$this to(string $channel)

Set the Slack channel the message should be sent to.

Parameters

string $channel

Return Value

$this

$this content(string $content)

Set the content of the Slack message.

Parameters

string $content

Return Value

$this

$this attachment(Closure $callback)

Define an attachment for the message.

Parameters

Closure $callback

Return Value

$this

string color()

Get the color for the message.

Return Value

string

$this linkNames()

Find and link channel names and usernames.

Return Value

$this

Find and link channel names and usernames.

Parameters

string $unfurl

Return Value

$this

$this unfurlMedia(string $unfurl)

Find and link channel names and usernames.

Parameters

string $unfurl

Return Value

$this

$this http(array $options)

Set additional request options for the Guzzle HTTP client.

Parameters

array $options

Return Value

$this