I hear a lot from different people who are uncertain how to know what is happening on their n8n instances when they are not there watching them. And even if you are there watching the workflows, you do not see what is happening on the active workflows triggered behind the scenes without digging into the executions.
I thought I would share with everyone how I have overcome this issue and know what is happening on all of my n8n instances in real-time, even when I'm not at my computer using Discord.
In this article, you will learn how to:
- Configure your Discord server to receive n8n notifications
- Create an error workflow in n8n
- Create an event log workflow
- Integrate these workflows into your other workflows
- Check your n8n alerts in Discord
So, let's get to it!
Logging in Action
If you want to see this whole process in action, check out the presentation that I made to the n8n community on setting this up:
- You already have a Discord server set up
- You are familiar with how Discord works
- You have admin privileges on the Discord server
- You have n8n available, either on-prem or cloud (if not, you can get a one month free trial for n8n)
What is Discord, and Why Are We Using It?
For those unfamiliar with Discord, it is a popular chat platform set up for free online. If you don't know how to set one up, you can check out the How-To Geek article How to Set Up Your Own Discord Chat Server.
There are several reasons for using Discord:
- Easy to set up
- Node exists in n8n
- Mobile app available
- Clients for most computer platforms
Configuring the Discord Server
Before we start working on n8n, we need to do several things on the Discord server.
First, create a new text channel and name it
Next, create a new webhook for the channel:
Name the webhook and give it an icon. Then copy the webhook URL:
Repeat this process to create an
Once you have completed these steps, it is now time to start building the n8n workflows.
Create Event Log Workflow
The first workflow that we are going to create is the event log workflow. This workflow will allow you to test and send information to the Discord event log channel.
The key to this workflow is to set the Discord node webhook URL to the value of the webhook URL created when you made the
text field is the second piece of the puzzle for configuring the node. It is looking for the following inputs:
- Title - the title of the message
- Workflow - name of the workflow sending the alert
- ID - ID number of the workflow sending the alert
- Active - boolean indicating if the workflow is active or not
- RunIndex - run index of the workflow
- Message - message sent by the workflow
Note that the information pushed to Discord is sent in Markdown format to give the alert a bit more punch.
Ensure that the Testing node is disabled before you launch the workflow in production so that you aren't just sent test data each time it is launched.
Create Error Log Workflow
The following workflow that we are going to be creating is the error log workflow. This is a very special workflow because it uses the Error Trigger node, which listens to error events on specified workflows and then responds.
The Error Trigger has no input parameters and requires no configuration other than being connected to another node.
The Discord node is configured similarly to the same node in the event workflow, except its webhook points to the
error-log channel in Discord. The text field formats the data that is automatically generated by the error trigger node to create an error that looks like the following:
You will notice that the error message generates a lot of information pointing to where the error occurred in the workflow and what mistakes and messages it received, and a direct link to the actual workflow execution that created the error. This dramatically reduces the troubleshooting effort for the workflow.
Activating the Error Log Workflow
Because the error log workflow is designed to listen to all errors, it can be used by multiple other workflows for error logging.
To enable this error logging facility, open up the workflow you wish to use to the error log and go to the Settings screen. The first entry on the screen is Error Workflow. Set this value to Error Log.
Create Test Workflow
To make sure that your workflows are working correctly, you can create a test workflow to log an event and then throw an error to log an error event.
You will need to make two changes to this workflow before it works properly. The first is to enter the workflow ID for the event log workflow in the Send To Event Log node. You can determine the workflow ID by opening up the event log workflow and looking at the number at the end of the URL.
The second configuration change that you need to do is set the error workflow in the settings to the Error Log workflow. (See above for more details).
Once you have made the configuration changes, save and activate your workflow. In under a minute, you should see an event and an error entry in each of the Discord channels.
Note that the Event Log Parameters automatically pulls most of the information sent to the event log by using expression variables. The only two things you will want to set yourself will be the Title and Message sent to the event log. This can be done manually or programmatically.
We have learned how to create and send event and error log entries to custom Discord channels to give visibility to these events when not monitoring them actively in n8n.
These events can then be seen on the Discord web, native and mobile apps.
Feel free to reach out to me if you have any questions or suggestions about these workflows, and I hope you find them helpful.