mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Adding link_names to post.message call (#3167)
If you do not turn link_names on, Slack will not highlight @channel and @username messages.
This commit is contained in:
parent
269e97c6de
commit
09b53a0d55
@ -58,14 +58,12 @@ class SlackNotificationService(BaseNotificationService):
|
|||||||
|
|
||||||
channel = kwargs.get('target') or self._default_channel
|
channel = kwargs.get('target') or self._default_channel
|
||||||
data = kwargs.get('data')
|
data = kwargs.get('data')
|
||||||
if data:
|
attachments = data.get('attachments') if data else None
|
||||||
attachments = data.get('attachments')
|
|
||||||
else:
|
|
||||||
attachments = None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.slack.chat.post_message(channel, message,
|
self.slack.chat.post_message(channel, message,
|
||||||
as_user=True,
|
as_user=True,
|
||||||
attachments=attachments)
|
attachments=attachments,
|
||||||
|
link_names=True)
|
||||||
except slacker.Error as err:
|
except slacker.Error as err:
|
||||||
_LOGGER.error("Could not send slack notification. Error: %s", err)
|
_LOGGER.error("Could not send slack notification. Error: %s", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user