Is it possible to listen for workflow failures?

I’m trying to add a slack notification for when workflows fail, but I’m not sure what is the best way to do this without doing it directly from the workflows errors.

I was hoping for away to listen for events as they happen, but I’m not sure if that possible with the API. The only way I know how to figure out if a workflow has failed is if a query the workflows and checked the state, but that hard to do in real time. I would like to have the notification happen as soon as the workflows fails just like how is it on the UI.

Is this possible? Is there a way I could get notification for workflow failures?

You can write an interceptor that will execute an activity on workflow failure.