> For the complete documentation index, see [llms.txt](https://docs.ilert.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ilert.com/integrations/inbound-integrations/n8n.md).

# n8n Integration

Create alerts in ilert when an n8n workflow fails — with ilert's n8n inbound integration.

[n8n](https://n8n.io/) is a workflow automation platform. n8n has no alerting of its own, but it can run an **error workflow** whenever another workflow fails. With this integration, the error workflow sends the failure to ilert, and ilert creates an alert for it. Optionally, the monitored workflow resolves the alert again as soon as it runs successfully.

Alerts are grouped per workflow: repeated failures of the same workflow update one open alert instead of creating a new one each time.

## In ilert: Create an n8n alert source <a href="#create-alert-source" id="create-alert-source"></a>

1. Go to **Alerting** → **Alert sources** and click **Create new alert source**.
2. Search for **n8n**, click its tile, and click **Next**.
3. Give your alert source a name, optionally assign teams, and click **Next**.
4. Choose who gets notified: select **Use existing escalation policy** and pick a policy, or **Generate new escalation policy** to start with a basic one that notifies you first. Click **Next**.

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-8a281bf3931f5a1a531951ce97984d50989dd875%2Falert-source-escalation-step.png?alt=media" alt="The escalation step of the ilert alert source wizard, headed Who should be notified about alerts, with an escalation policy selected and a preview of its escalation rules below."><figcaption><p>Pick an existing escalation policy, or generate a basic one without leaving the wizard.</p></figcaption></figure>
5. Select **Default grouping** and click **Continue setup**. It groups events by the alert key the integration sets, which is the n8n workflow; the other [grouping options](https://docs.ilert.com/alerting/configure-alerting/alert-sources.md#event-grouping) are easier to judge once events are arriving.
6. The next page shows more settings, such as notification priority and alert templates. Click **Finish setup** for now; you can change them later.
7. On the final page, ilert generates a webhook URL for your alert source. Copy it — you will need it in the next sections.

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-2483f80617165ea19e4a0b2d63544b1e55e2aa9b%2Falert-source-n8n.png?alt=media" alt="The Settings tab of an n8n alert source in ilert, showing the integration type, the masked integration key, and the n8n URL, with the list of integration features on the right."><figcaption></figcaption></figure>

## In n8n: Create an error workflow <a href="#create-error-workflow" id="create-error-workflow"></a>

The error workflow runs whenever a workflow linked to it fails, and sends the failure to ilert. You need only one error workflow for all your workflows.

1. In n8n, go to **Overview**, open the **Workflows** tab, and click **Create workflow**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-fe62b4503ac9bd10355f327a43a4d2520fda28b9%2Fn8n-1.png?alt=media" alt="The n8n Overview page with the Workflows tab selected and the Create workflow button in the top right."><figcaption></figcaption></figure>

2. Click the workflow name **My workflow** at the top and rename it, for example to **Error workflow**.
3. Click **Add first step...**, search for **error trigger**, and select **Error Trigger**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-14636ae909c913794991386e3dfde0463ed4cb95%2Fn8n-2.png?alt=media" alt="An empty n8n workflow named Error workflow, with the trigger search panel open and Error Trigger selected in the results for error trigger."><figcaption></figcaption></figure>

4. Click the **+** button next to the **Error Trigger** node, search for **http request**, and select **HTTP Request**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-6418fe5a241d88b00fa6898c41a59046adc0e918%2Fn8n-3.png?alt=media" alt="The Error Trigger node on the n8n canvas, with the What happens next panel open and HTTP Request selected in the results for http request."><figcaption></figcaption></figure>

5. Configure the **HTTP Request** node:

   * **Method:** `POST`
   * **URL:** the webhook URL of your ilert alert source
   * **Send Body:** on
   * **Body Content Type:** `JSON`
   * **Specify Body:** `Using JSON`
   * **JSON:** switch the field to **Expression** and enter `{{ $json }}`

   This forwards the details of the failed execution to ilert unchanged.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-2f6b70c2cafbb7ebe489d6892d6c25fd6d80f445%2Fn8n-4.png?alt=media" alt="The HTTP Request node parameters, with Method set to POST, the ilert webhook URL in the URL field, Send Body turned on, Body Content Type set to JSON, Specify Body set to Using JSON, and the expression {{ $json }} in the JSON field."><figcaption></figcaption></figure>

6. Go back to your workflow list, click **⋯** next to the error workflow, and click **Publish**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-0305f4d2a34a91146bfa44f7243903c13f428074%2Fn8n-5.png?alt=media" alt="The n8n workflow list with the menu of the Error workflow opened and Publish highlighted."><figcaption></figcaption></figure>

## In n8n: Link your workflows to the error workflow <a href="#link-workflows" id="link-workflows"></a>

Repeat these steps for every workflow that ilert should monitor.

1. Open the workflow, click **⋯** next to its name, and click **Settings**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-dee9a25ac53a9daf4a1c76e6340055b264a6d4f8%2Fn8n-6.png?alt=media" alt="A monitored n8n workflow with the menu next to its name opened and Settings highlighted."><figcaption></figcaption></figure>

2. In **Error Workflow (to notify when this one errors)**, select your error workflow, for example **Error workflow**, and click **Save**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-862d13703c1b584fea99a9f7cf8eae125f34afec%2Fn8n-7.png?alt=media" alt="The workflow settings dialog, with Error workflow selected in the Error Workflow (to notify when this one errors) field and the Save button highlighted."><figcaption></figcaption></figure>

3. Make sure the workflow is published. n8n runs error workflows only for production executions, not when you run a workflow manually in the editor.

## In n8n: Resolve alerts automatically (optional) <a href="#resolve-alerts" id="resolve-alerts"></a>

n8n does not report when a workflow works again. To resolve the alert in ilert automatically, let the monitored workflow send a resolve event at its end. The node only runs if every node before it succeeded.

1. Open the monitored workflow and add an **HTTP Request** node as its last node.
2. Configure it like the one in the error workflow, with the same webhook URL, but enter this expression in the **JSON** field:

   ```
   {{ JSON.stringify({ eventType: 'RESOLVE', workflow: { id: $workflow.id } }) }}
   ```

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-aa21e2c7779985ce51fd4ec77ada3c76ff505148%2Fn8n-8.png?alt=media" alt="An HTTP Request node at the end of a monitored workflow, configured with Method POST, the ilert webhook URL, a JSON body, and the resolve expression in the JSON field."><figcaption></figcaption></figure>

3. Publish the workflow again.

If a workflow branches into several endings, add the resolve node at the end of each branch that means "everything worked".

## FAQ <a href="#faq" id="faq"></a>

**Will alerts in ilert be resolved automatically?**

Only if you add the resolve node described in [Resolve alerts automatically](#resolve-alerts). Without it, resolve the alert in ilert manually once the workflow works again.

**A workflow failed several times. Why is there only one alert?**

ilert groups events by workflow. As long as the alert is open, further failures of the same workflow are added to it instead of creating new alerts. Once the alert is resolved, the next failure creates a new alert.

**A workflow failed, but no alert appeared in ilert. What should I check?**

Check that the workflow is published and that its **Error Workflow** setting points to your error workflow — n8n does not run error workflows for manual executions. Then open the **Executions** of the error workflow: if the **HTTP Request** node failed, check that its **URL** contains the full webhook URL from your ilert alert source.

**Can I use one error workflow for several workflows?**

Yes. Link all workflows to the same error workflow. ilert creates a separate alert for each workflow that fails.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ilert.com/integrations/inbound-integrations/n8n.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
