has anybody setup slack messages for prefect from ...
# ask-community
c
has anybody setup slack messages for prefect from within a task, basically I am looping over some SQL table builds, and I wrap them in a try/except for each table. the try/except allows the task to continue running if any one table fails, but besides logging the warning, I don't get a slack notif for any of the individual tables if they fail... i have the slack notifs setup for the flow as a whole, and could always set them up with the native python slack integration, but was curious if anyone had set that up within prefect natively, thanks!
k
Hey @Cory Jez, the easiest way to do this is to use the Prefect Slack Task and then use this task in another task by calling the
.run()
method manually.
❤️ 1
c
thanks @Kevin Kho
k
Copy code
@task
def abc():
    SlackTask(...).run()
of course!
c
Also I'd recommend creating a Prefect Secret with the slack channel url, that way you can use it in the slack task very easily!
1