airflow.providers.slack.notifications.slack

Module Contents

Classes

SlackNotifier

Slack BaseNotifier.

Attributes

ICON_URL

send_slack_notification

airflow.providers.slack.notifications.slack.ICON_URL: str = 'https://raw.githubusercontent.com/apache/airflow/2.5.0/airflow/www/static/pin_100.png'[source]
class airflow.providers.slack.notifications.slack.SlackNotifier(*, slack_conn_id=SlackHook.default_conn_name, text='This is a default message', channel='#general', username='Airflow', icon_url=ICON_URL, attachments=(), blocks=(), base_url=None, proxy=None, timeout=None, retry_handlers=None, unfurl_links=True, unfurl_media=True)[source]

Bases: airflow.notifications.basenotifier.BaseNotifier

Slack BaseNotifier.

Parameters
  • slack_conn_id (str) – Slack API token (https://api.slack.com/web).

  • text (str) – The content of the message

  • channel (str) – The channel to send the message to. Optional

  • username (str) – The username to send the message as. Optional

  • icon_url (str) – The icon to use for the message. Optional

  • blocks (Sequence) – A list of blocks to send with the message. Optional

  • timeout (int | None) – The maximum number of seconds the client will wait to connect and receive a response from Slack. Optional

  • base_url (str | None) – A string representing the Slack API base URL. Optional

  • proxy (str | None) – Proxy to make the Slack API call. Optional

  • retry_handlers (list[slack_sdk.http_retry.RetryHandler] | None) – List of handlers to customize retry logic in slack_sdk.WebClient. Optional

  • attachments (Sequence) – (legacy) A list of attachments to send with the message. Optional

  • unfurl_links (bool) – Option to indicate whether text url should unfurl. Optional

  • unfurl_media (bool) – Option to indicate whether media url should unfurl. Optional

template_fields = ('text', 'channel', 'username', 'attachments', 'blocks')[source]
hook()[source]

Slack Hook.

notify(context)[source]

Send a message to a Slack Channel.

airflow.providers.slack.notifications.slack.send_slack_notification[source]

Was this entry helpful?