:mod:`airflow.contrib.hooks.slack_webhook_hook` =============================================== .. py:module:: airflow.contrib.hooks.slack_webhook_hook Module Contents --------------- .. py:class:: SlackWebhookHook(http_conn_id=None, webhook_token=None, message='', attachments=None, channel=None, username=None, icon_emoji=None, link_names=False, proxy=None, *args, **kwargs) Bases::class:`airflow.hooks.http_hook.HttpHook` This hook allows you to post messages to Slack using incoming webhooks. Takes both Slack webhook token directly and connection that has Slack webhook token. If both supplied, Slack webhook token will be used. Each Slack webhook token can be pre-configured to use a specific channel, username and icon. You can override these defaults in this hook. :param http_conn_id: connection that has Slack webhook token in the extra field :type http_conn_id: str :param webhook_token: Slack webhook token :type webhook_token: str :param message: The message you want to send on Slack :type message: str :param attachments: The attachments to send on Slack. Should be a list of dictionaries representing Slack attachments. :type attachments: list :param channel: The channel the message should be posted to :type channel: str :param username: The username to post to slack with :type username: str :param icon_emoji: The emoji to use as icon for the user posting to Slack :type icon_emoji: str :param link_names: Whether or not to find and link channel and usernames in your message :type link_names: bool :param proxy: Proxy to use to make the Slack webhook call :type proxy: str .. method:: _get_token(self, token, http_conn_id) Given either a manually set token or a conn_id, return the webhook_token to use :param token: The manually provided token :type token: str :param http_conn_id: The conn_id provided :type http_conn_id: str :return: webhook_token (str) to use .. method:: _build_slack_message(self) Construct the Slack message. All relevant parameters are combined here to a valid Slack json message :return: Slack message (str) to send .. method:: execute(self) Remote Popen (actually execute the slack webhook call)