Skip to content

Commit 1a51a91

Browse files
committed
Add ability to send link_names parameter in Slack notification
By default, leave link_names off. Added a method to enable link_names. Signed-off-by: Donnie La Curan <don.lacuran@gmail.com>
1 parent d9d99e1 commit 1a51a91

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/Illuminate/Notifications/Channels/SlackWebhookChannel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ protected function buildJsonPayload(SlackMessage $message)
5959
'icon_emoji' => data_get($message, 'icon'),
6060
'icon_url' => data_get($message, 'image'),
6161
'channel' => data_get($message, 'channel'),
62+
'link_names' => data_get($message, 'linkNames'),
6263
]);
6364

6465
return array_merge([

src/Illuminate/Notifications/Messages/SlackMessage.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ class SlackMessage
4848
*/
4949
public $content;
5050

51+
/**
52+
* Linkify channel names and usernames.
53+
*
54+
* @var bool
55+
*/
56+
public $linkNames = 0;
57+
5158
/**
5259
* The message's attachments.
5360
*
@@ -98,6 +105,18 @@ public function error()
98105
return $this;
99106
}
100107

108+
/**
109+
* Find and link channel names and usernames.
110+
*
111+
* @return $this
112+
*/
113+
public function linkNames()
114+
{
115+
$this->linkNames = 1;
116+
117+
return $this;
118+
}
119+
101120
/**
102121
* Set a custom username and optional emoji icon for the Slack message.
103122
*

0 commit comments

Comments
 (0)