https://prefect.io logo
m

Matthew Scanlon

01/11/2023, 3:33 PM
What is the recommended means by which one can send a slack notification from inside of a task? It looks like the prefect-slack task does not work if called as a function?
m

Mark NS

01/11/2023, 3:54 PM
I've been using the
SlackWebhook
block to do this...
Copy code
from prefect.blocks.notifications import SlackWebhook

slack_webhook_block = SlackWebhook.load("BLOCK_NAME")
slack_webhook_block.notify("Hello from Prefect!")
There is a note in the `notifications.py` code about moving this to
prefect-slack
though.
upvote 2
🙏 1
m

Matthew Scanlon

01/11/2023, 7:20 PM
Thanks Mark. Really appreciate it
I've created an issue here as i am not to sure why this would not work. Given there is nothing "prefect-critical" going on inside of
send_chat_message
I do not see a reason as to why .fn() should fail silently
3 Views