Is there a recommended way to create custom slack ...
# prefect-community
z
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
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
Yes! I’m creating pipelines for ML models, and I’d like to report performance results to Slack
z
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
P 1
Does that pattern sound like it'd work for you?
success kid 1
z
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
Awesome! Let us know if there's anything else we can help with!