Hi folks, I’m playing with Slack notifier and I’m ...
# prefect-community
a
Hi folks, I’m playing with Slack notifier and I’m wondering if: • is possible to “disable” notifications (i.e: setting something at Prefect Server startup to completely disable notifications, could be super useful for local testing/development) • is possible to send notifications on multiple channels • is possible to set the Slack webhook URL from an AWS Secret • is possible to customize the notification message for each task
👀 1
d
Hi @ale!
is possible to “disable” notifications (i.e: setting something at Prefect Server startup to completely disable notifications, could be super useful for local testing/development)
Another way to send the same notifications would be with Cloud Hooks, which don’t run during local testing with
flow.run()
. They’re also very easy to switch on and off via the UI. If you’re looking for specific logic in your state handlers, you can also comment them out during local testing or set a different webhook url so you don’t clutter your notifications.
is possible to send notifications on multiple channels
I believe you’d want to set one State Hook / Cloud Hook per Slack Channel, which you can totally do!
is possible to set the Slack webhook URL from an AWS Secret
I believe state handers have access to the Flow context (
prefect.context
), so if you use a
PrefectSecret
I believe it will be available there.
is possible to customize the notification message for each task
Since you should have access to the name of the task either through the state object passed to the state handler or the
prefect.context
you should be able to
if/else
messages from there
a
Thanks @Dylan
d
Anytime!