# How to set up an error workflow in n8n

## Метаданные

- **Канал:** n8n
- **YouTube:** https://www.youtube.com/watch?v=c1sIl4_wCVQ
- **Дата:** 03.05.2022
- **Длительность:** 3:59
- **Просмотры:** 7,734

## Описание

In this video, Head of Design Max Tkacz walks you through setting up an error workflow in n8n.

----------------------------------------------------------------
About n8n
n8n is the leading low-code automation tool, and with over 250 integrations, n8n enables you to connect anything to everything. With n8n you can move beyond simple integrations to build multi-step workflows that combine both 3rd party APIs and your own internal tools to create easy-to-use automation. Thanks to its fair-code distribution model, n8n will always have visible source code, be available to self-host, is completely free for personal or internal use, and allows you to add your own custom functions, logic, and apps.

Download: https://n8n.io/#get-started
Deploy: https://docs.n8n.io/getting-started/installation/
n8n Cloud: https://n8n.io/cloud

## Содержание

### [0:00](https://www.youtube.com/watch?v=c1sIl4_wCVQ) <Untitled Chapter 1>

in this video we're going to show you

### [0:01](https://www.youtube.com/watch?v=c1sIl4_wCVQ&t=1s) Set Up an Error Workflow

how to set up an error workflow um for your nadn workflow and what this will allow you to do is get notifications um when something goes wrong with your flow um so let's imagine that we finished this workflow it's activated we tested it and we basically just want to get an alert now if something goes wrong because it should be working automatically um in that case what we'll

### [0:24](https://www.youtube.com/watch?v=c1sIl4_wCVQ&t=24s) Create an Error Workflow

do is we'll first create an error workflow so that'll be the workflow that get fires when there's a problem with this one so we'll create a new workflow we'll call it my error flow and the first thing we'll do is We'll add an error trigger to the canvas and the error trigger what this does is when another workflow causes workflow um because there was an error this workflow will know that we should start on this trigger not some other trigger here um so in the error trigger when I

### [0:51](https://www.youtube.com/watch?v=c1sIl4_wCVQ&t=51s) Error Trigger

execute it manually what we get is we get an example of the type of data it would output um so that we can reference this data to for example send a slack message or something like that um so while this is sort of data from this flow um this would get replaced when it's activated um by the data from the actual workflow that failed here um so in a very simple case

### [1:15](https://www.youtube.com/watch?v=c1sIl4_wCVQ&t=75s) Send a Slack Message

we could do something like send a slack message so we'll add the slack node in this case I have an O2 credential I'll hook that up we want to post a message to a channel let's say we have a support Channel and then for the text itself you know we could just write that a workflow failed right now this won't be particularly helpful you won't know which workflow failed so this could be fine if you have a simple instance and just anytime there's a problem you want to just know that there was some sort of a problem but we can um add an expression and instead send some of the dynamic data from the error trigger so we could say that a work for failed and then we could if we drill down to here and the data that's accessible there's data on the execution various data and on the workflow itself so we could say um know workflow name and we could paste in the workflow name here we'll see the snippet of uh that gets pasted in here and we see the rendered result down here we could also perhaps have a URL of the execution so you can open this up directly take a look what the problem is um and then perhaps the error message itself could be useful as well um this could be use ful because maybe sometimes workflows fail due to some sort of rate limiting issue maybe it's an autom Mission critical workflow so you see that it's that type of error and you maybe give it a set to see if it resolved itself either way we have our Dynamic message here now so when we send this to slack we can see um we just posted this there's the data um so from here really the

### [2:54](https://www.youtube.com/watch?v=c1sIl4_wCVQ&t=174s) Complexity of Your Error Workflow

complexity of your error workflow just depends on what you want to do with it could be a simple flow like this and we see a lot of users who have a simple fallback flow that they'll set by default for most of their workflows and then when they have something Mission critical they might have a specific error flow just for that workflow for a series of workflows could do things like checking if it's the weekend and um uh doing something different if it is to support an SLA or really any kind of complexity that you can Implement in Ed end you can do in an error workflow um so we'll save this error workflow it's called My error flow I'll then open up the other flow we had in the beginning of this video and to make sure that whenever this one fails it's activated that it trigger the error flow all we have to do is go into the settings of this workflow here and then for the error flow I had one previously set I can search and I can find this new one that we created my error flow save this and now every time this workflow fails when it runs in production it will trigger that error flow and we'll get a slack message

---
*Источник: https://ekstraktznaniy.ru/video/15710*