commented Mar 6, 2020

Hi @ddelange, where i can find the method extract_domain?

commented Mar 6, 2020

@StefanoGITA here you go

commented Mar 6, 2020

Not getting Slack Notifications when dags fail, tried SlackWebhookOperator and SlackAPIPostOperator. Data engineer here, and a bit stuck! This is my code using SlackWebhookOperator, I used the same formatting when trying to use SlackAPIPostOperator except I had 'token' not webhooktoken'. Module Contents¶ class airflow.providers.slack.operators.slack.SlackAPIOperator (., slackconnid: Optional = None, token: Optional = None, method: Optional = None, apiparams: Optional Dict = None,. kwargs) source ¶. Bases: airflow.models.BaseOperator Base Slack Operator The SlackAPIPostOperator is derived from this operator. In the future additional Slack API Operators will. Note: This article covers information about legacy methods for adding integrations to your Slack workspace. Visit Slack API for the latest on platform features. API tokens can be created for both members and bot users. For added security, it’s a good idea to rotate these tokens periodically. In addition to these basic building blocks, there are many more specific operators: DockerOperator, HiveOperator, S3FileTransformOperator, PrestoToMySqlTransfer, SlackAPIOperator, etc. Using the Slack Web API The Slack Web API is an interface for querying information from and enacting change in a Slack workspace. Use it on the fly for ad-hoc queries, or as part of a more complex tapestry of platform features in a Slack app. What can you do with the Web API?

ThanksIl giorno ven 6 mar 2020 alle ore 13:42 david <[email protected]> hascritto:
@StefanoGITA <> here you go — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <>, or unsubscribe <> .
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Module Contents¶

class airflow.providers.slack.operators.slack.SlackAPIOperator(*, slack_conn_id:Optional[str]=None, token:Optional[str]=None, method:Optional[str]=None, api_params:Optional[Dict]=None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Base Slack OperatorThe SlackAPIPostOperator is derived from this operator.In the future additional Slack API Operators will be derived from this class as wellOnly one of slack_conn_id and token is required.

  • slack_conn_id (str) – Slack connection ID which its password is Slack API token. Optional

  • token (str) – Slack API token ( Optional

  • method (str) – The Slack API Method to Call ( Optional

  • api_params (dict) – API Method call parameters ( Optional

  • client_args – Slack Hook parameters. Optional. Check airflow.providers.slack.hooks.SlackHook


Used by the execute function. Allows templating on the source fieldsof the api_call_params dict before construction

Override in child classes.Each SlackAPIOperator child class is responsible forhaving a construct_api_call_params functionwhich sets self.api_call_params with a dict ofAPI call parameters (

execute(self, **kwargs)[source]

SlackAPIOperator calls will not fail even if the call is not unsuccessful.It should not prevent a DAG from completing in success

class airflow.providers.slack.operators.slack.SlackAPIPostOperator(channel:str='#general', username:str='Airflow', text:str='No message has been set.nHere is a cat video insteadn', icon_url:str='', attachments:Optional[List]=None, blocks:Optional[List]=None, **kwargs)[source]


Bases: airflow.providers.slack.operators.slack.SlackAPIOperator

Posts messages to a slack channelExamples:

  • channel (str) – channel in which to post message on slack name (#general) orID (C12318391). (templated)

  • username (str) – Username that airflow will be posting to Slack as. (templated)

  • text (str) – message to send to slack. (templated)

  • icon_url (str) – url to icon used for this message

  • attachments (list of hashes) – extra formatting details. (templated)- see

  • blocks (list of hashes) – extra block layouts. (templated)- see

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

Slackapipostoperator Example

ui_color = #FFBA40[source]
class airflow.providers.slack.operators.slack.SlackAPIFileOperator(channel:str='#general', initial_comment:str='No message has been set!', filename:str='default_name.csv', filetype:str='csv', content:str='default,content,csv,file', **kwargs)[source]

Bases: airflow.providers.slack.operators.slack.SlackAPIOperator

Send a file to a slack channelExamples:

Slackapipostoperator Airflow

  • channel (str) – channel in which to sent file on slack name (templated)

  • initial_comment (str) – message to send to slack. (templated)

  • filename (str) – name of the file (templated)

  • filetype (str) – slack filetype. (templated)- see

  • content (str) – file content. (templated)

template_fields = ['channel', 'initial_comment', 'filename', 'filetype', 'content'][source]
ui_color = #44BEDF[source]