Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.slack.notify.SlackNotificationService Class Reference
Inheritance diagram for homeassistant.components.slack.notify.SlackNotificationService:
[legend]
Collaboration diagram for homeassistant.components.slack.notify.SlackNotificationService:
[legend]

Public Member Functions

None __init__ (self, HomeAssistant hass, WebClient client, dict[str, str] config)
 
None async_send_message (self, str message, **Any kwargs)
 

Private Member Functions

None _async_send_local_file_message (self, str path, list[str] targets, str message, str|None title, str|None thread_ts)
 
None _async_send_remote_file_message (self, str url, list[str] targets, str message, str|None title, str|None thread_ts, *str|None username=None, str|None password=None)
 
None _async_send_text_only_message (self, list[str] targets, str message, str|None title, str|None thread_ts, *str|None username=None, str|None icon=None, Any|None blocks=None)
 

Private Attributes

 _client
 
 _config
 
 _hass
 

Detailed Description

Define the Slack notification logic.

Definition at line 133 of file notify.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.slack.notify.SlackNotificationService.__init__ (   self,
HomeAssistant  hass,
WebClient  client,
dict[str, str]  config 
)
Initialize.

Definition at line 136 of file notify.py.

Member Function Documentation

◆ _async_send_local_file_message()

None homeassistant.components.slack.notify.SlackNotificationService._async_send_local_file_message (   self,
str  path,
list[str]  targets,
str  message,
str | None  title,
str | None  thread_ts 
)
private
Upload a local file (with message) to Slack.

Definition at line 147 of file notify.py.

◆ _async_send_remote_file_message()

None homeassistant.components.slack.notify.SlackNotificationService._async_send_remote_file_message (   self,
str  url,
list[str]  targets,
str  message,
str | None  title,
str | None  thread_ts,
*str | None   username = None,
str | None   password = None 
)
private
Upload a remote file (with message) to Slack.

Note that we bypass the python-slackclient WebClient and use aiohttp directly,
as the former would require us to download the entire remote file into memory
first before uploading it to Slack.

Definition at line 175 of file notify.py.

◆ _async_send_text_only_message()

None homeassistant.components.slack.notify.SlackNotificationService._async_send_text_only_message (   self,
list[str]  targets,
str  message,
str | None  title,
str | None  thread_ts,
*str | None   username = None,
str | None   icon = None,
Any | None   blocks = None 
)
private
Send a text-only message.

Definition at line 230 of file notify.py.

◆ async_send_message()

None homeassistant.components.slack.notify.SlackNotificationService.async_send_message (   self,
str  message,
**Any  kwargs 
)
Send a message to Slack.

Definition at line 275 of file notify.py.

Member Data Documentation

◆ _client

homeassistant.components.slack.notify.SlackNotificationService._client
private

Definition at line 144 of file notify.py.

◆ _config

homeassistant.components.slack.notify.SlackNotificationService._config
private

Definition at line 145 of file notify.py.

◆ _hass

homeassistant.components.slack.notify.SlackNotificationService._hass
private

Definition at line 143 of file notify.py.


The documentation for this class was generated from the following file: