Hi there, I wanted to check my understanding of fe...
# prefect-community
b
Hi there, I wanted to check my understanding of feature availability in Prefect Cloud 2.0. Is it possible to send, for specific flow state changes, custom Slack notifications? Ideally using the Slack block kit rather than plain text. Thanks!
1
k
Hi @Billy McMonagle yes you can use the Slack block kit to create custom messages to send to slack by using the prefect-slack integration directly in your flow code.
b
oh cool, thanks! I was looking in the notifications section, not the integrations section. I assume I could just put something like
if task_result_state == FAIL: send_notification()
in my flow?
k
yes exactly, so you could use either the
send_chat_message()
or the
send_incoming_webhook_message()
from the integration directly in your flow code
b
perfect. Changing my 1.0 code is hard but this is much more intuitive and will let me delete some old code, hooray 🙂
marvin 3
a
There’s also prefect-alert integration as a decorator
🙌 1
k
Oh yes!! you could use the
@alert_on_failure
decorator with the
prefect-slack
integration https://khuyentran1401.github.io/prefect-alert/