Magda Stożek
10/19/2020, 9:11 AMJacob Blanco
10/19/2020, 9:36 AMRobin
10/19/2020, 9:39 AMfrom prefect.utilities.notifications import slack_notifier
# Setup for Slack notifications
handler = slack_notifier(
backend_info=True,
only_states=[prefect.engine.state.Success, prefect.engine.state.Failed],
)
prefect.context.secrets = {
"SLACK_WEBHOOK_URL": "<https://hooks.slack.com/services/>..."
}
with Flow(
name=flow_name,
state_handlers=[handler],
) as flow:
...
https://api.slack.com/messaging/webhooksJacob Blanco
10/19/2020, 9:41 AMMagda Stożek
10/19/2020, 9:41 AMJacob Blanco
10/19/2020, 9:43 AMRobin
10/19/2020, 9:51 AMMagda Stożek
10/19/2020, 9:53 AMSooner rather than later, you will be able to store your slack webhook URL in your secure database of Prefect Secrets under `"SLACK_WEBHOOK_URL"`; until then, you need to include it in theis still accurate? Do I understand correctly that there’s currently no way to securely pass the webhook url to be used by the slack_notifier?section of your prefect configuration file[context.secrets]
Robin
10/19/2020, 9:57 AMMagda Stożek
10/19/2020, 9:58 AMRobin
10/19/2020, 9:59 AMMagda Stożek
10/19/2020, 10:01 AMSLACK_WEBHOOK_URL
prefect secret (using the UI) to the webhook url, and slack_notifier picks it up, so it’s fine security-wise, it’s just that this piece of docs was misleading. Phew 🙂