Skip to content

Commit

Permalink
Add ability to send link_names parameter in Slack notification
Browse files Browse the repository at this point in the history
By default, leave link_names off. Added a method to enable link_names.

Signed-off-by: Donnie La Curan <don.lacuran@gmail.com>
  • Loading branch information
sevenpixels committed Apr 11, 2017
1 parent d9d99e1 commit 1a51a91
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ protected function buildJsonPayload(SlackMessage $message)
'icon_emoji' => data_get($message, 'icon'),
'icon_url' => data_get($message, 'image'),
'channel' => data_get($message, 'channel'),
'link_names' => data_get($message, 'linkNames'),
]);

return array_merge([
Expand Down
19 changes: 19 additions & 0 deletions src/Illuminate/Notifications/Messages/SlackMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ class SlackMessage
*/
public $content;

/**
* Linkify channel names and usernames.
*
* @var bool
*/
public $linkNames = 0;

/**
* The message's attachments.
*
Expand Down Expand Up @@ -98,6 +105,18 @@ public function error()
return $this;
}

/**
* Find and link channel names and usernames.
*
* @return $this
*/
public function linkNames()
{
$this->linkNames = 1;

return $this;
}

/**
* Set a custom username and optional emoji icon for the Slack message.
*
Expand Down

0 comments on commit 1a51a91

Please sign in to comment.