Skip to content

Conversation

Taragolis
Copy link
Contributor

@Taragolis Taragolis commented Aug 21, 2022

Refactor Slack API hook

  1. Retrieve token and create client outside of __init__ method
  2. Create new connection type. Right now only Slack Webhook connection exists.
  3. Add test method to connection.
  4. Customise Slack API Connection UI.
  5. Show deprecation warning if user provide token in Hook argument. IMHO, there is not a good idea provide directly token better to use Connection.
  6. Keep compatible with generic connection.
  7. Mask token provided as hook argument.

Connection UI and Testing Connection

image

image

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This additional indent required to proper formatted block in documentation and PyCharm

Without additional space
https://airflow.apache.org/docs/apache-airflow-providers-slack/stable/_api/airflow/providers/slack/hooks/slack/index.html#airflow.providers.slack.hooks.slack.SlackHook

With additional space
image

Might be possible avoid this "hack"?

Comment on lines 180 to +186
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also might be better just remove this method.
It not used after changes and it is hardly possible that someone override it

Comment on lines +37 to +43
Copy link
Contributor Author

@Taragolis Taragolis Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I create separate class for use in further steps

  1. Refactor airflow.providers.slack.hooks.slack_webhook.SlackWebhookHook which mostly designed for use with legacy Slack Integrations
  2. Create new hook and connection which will use slack_sdk.webhook.WebhookClient and create integration with Slack Incoming Webhook based on Slack API/App

@Taragolis Taragolis force-pushed the refactor-slack-api-hook branch 4 times, most recently from eb00fb8 to ed8a940 Compare August 27, 2022 16:59
@Taragolis Taragolis force-pushed the refactor-slack-api-hook branch from ed8a940 to 7ae8172 Compare August 27, 2022 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants