n8n Logging to Discord
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:
Assumptions
- 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:
- Free
- 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 event-log
:

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 error-log
channel.
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 event-log
channel.

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.

Workflow Code
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"webhookUri": "<Enter Your Webhook URL Here>",
"text": "={{$json[\"Title\"]}}\n**Workflow Information**\n> **Name**: {{$json[\"Workflow\"]}}\n> **ID**: {{$json[\"ID\"]}}\n> **Active**: {{$json[\"Active\"]}}\n> **Run Index**: {{$json[\"RunIndex\"]}}\n> **Timestamp**: {{new Date().toUTCString()}}\n\n**__Message__**\n> {{$json[\"Message\"]}}"
},
"name": "Send Alert to Discord",
"type": "n8n-nodes-base.discord",
"typeVersion": 1,
"position": [
670,
300
]
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "Title",
"value": "Title"
},
{
"name": "Workflow",
"value": "Workflow"
},
{
"name": "Message",
"value": "Message"
}
],
"number": [
{
"name": "ID",
"value": 34527
},
{
"name": "RunIndex",
"value": 12
}
],
"boolean": [
{
"name": "Active",
"value": true
}
]
},
"options": {}
},
"name": "Testing",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
450,
300
]
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Testing",
"type": "main",
"index": 0
}
]
]
},
"Testing": {
"main": [
[
{
"node": "Send Alert to Discord",
"type": "main",
"index": 0
}
]
]
}
}
}
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.

Workflow Code
{
"nodes": [
{
"parameters": {},
"name": "Error Trigger",
"type": "n8n-nodes-base.errorTrigger",
"typeVersion": 1,
"position": [
-1280,
-160
]
},
{
"parameters": {
"webhookUri": "<Enter Your Webhook URL Here>",
"text": "=Error in workflow **{{$json[\"workflow\"][\"name\"]}} ({{$json[\"workflow\"][\"id\"]}})**, node *{{$json[\"execution\"][\"error\"][\"node\"][\"name\"]}}*\n**__Node Info__**\n> **Node Type**: {{$json[\"execution\"][\"error\"][\"node\"][\"type\"]}}\n> \n> **Node Parameters**: \n> **Keys**: `{{Object.keys($json[\"execution\"][\"error\"][\"node\"][\"parameters\"]).join(', ')}}`\n> **Values**: `{{Object.values($json[\"execution\"][\"error\"][\"node\"][\"parameters\"]).join(', ')}}`\n\n**__Error Info__**\n> **Name**: {{$json[\"execution\"][\"error\"][\"name\"]}}\n> **Timestamp**: {{new Date($json[\"execution\"][\"error\"][\"timestamp\"]).toLocaleDateString('en-US',{month:'long', day: 'numeric', year:'numeric', hour:'numeric', minute:'numeric', second:'numeric'})}}\n> **Message**: {{$json[\"execution\"][\"error\"][\"message\"]}}\n> **Stack**: {{$json[\"execution\"][\"error\"][\"stack\"]}}\n\nFor more information, please see {{$json[\"execution\"][\"url\"]}}"
},
"name": "Discord",
"type": "n8n-nodes-base.discord",
"typeVersion": 1,
"position": [
-1100,
-160
]
}
],
"connections": {
"Error Trigger": {
"main": [
[
{
"node": "Discord",
"type": "main",
"index": 0
}
]
]
}
}
}
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.
Workflow Code
{
"nodes": [
{
"parameters": {
"triggerTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"name": "Cron",
"type": "n8n-nodes-base.cron",
"typeVersion": 1,
"position": [
350,
480
]
},
{
"parameters": {
"functionCode": "items[1] = \"dog\";\n\nreturn items;"
},
"name": "Error Generator",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
930,
480
]
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "Title",
"value": "Event Log Example"
},
{
"name": "Workflow",
"value": "={{$workflow.name}}"
},
{
"name": "Message",
"value": "This message will be shown in the event log."
}
],
"number": [
{
"name": "ID",
"value": "={{$workflow.id}}"
},
{
"name": "RunIndex",
"value": "={{$runIndex}}"
}
],
"boolean": [
{
"name": "Active",
"value": "={{$workflow.active}}"
}
]
},
"options": {}
},
"name": "Event Log Parameters",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
530,
480
]
},
{
"parameters": {
"workflowId": "<Enter Your Event Log Workflow ID>"
},
"name": "Send To Event Log",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
730,
480
]
}
],
"connections": {
"Cron": {
"main": [
[
{
"node": "Event Log Parameters",
"type": "main",
"index": 0
}
]
]
},
"Event Log Parameters": {
"main": [
[
{
"node": "Send To Event Log",
"type": "main",
"index": 0
}
]
]
},
"Send To Event Log": {
"main": [
[
{
"node": "Error Generator",
"type": "main",
"index": 0
}
]
]
}
}
}
Conclusion
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.