https://prefect.io logo
Title
z

Zach Angell

06/30/2020, 8:50 PM
Is there a recommended way to create custom slack notifications? (For example - craft a message using data from a task) I have slack notifications working for task states, just wondering how best to customize
z

Zachary Hughes

06/30/2020, 9:04 PM
Hi @Zach Angell! Do you have a specific use case in mind? There are a couple of different ways to manage this, but I'm not sure there's an official one-approach-to-rule-them-all recommendation for interacting with Slack.
z

Zach Angell

06/30/2020, 9:22 PM
Yes! I’m creating pipelines for ML models, and I’d like to report performance results to Slack
z

Zachary Hughes

06/30/2020, 9:24 PM
Awesome! For something like that, I think I'd recommend a
SlackTask
. And if you want to notify on state changes, you can do so either using a state handler or a cloud hook. https://docs.prefect.io/api/latest/tasks/notifications.html#slacktask
:prefect: 1
Does that pattern sound like it'd work for you?
:success-kid: 1
z

Zach Angell

06/30/2020, 9:31 PM
Got it. Yep that looks like it would work! I’m currently using the state handler and its working nicely Looks like the Slack task will be simple enough to implement using the env var
z

Zachary Hughes

06/30/2020, 9:38 PM
Awesome! Let us know if there's anything else we can help with!