Domain Monitoring Workflow with State Tracking in n8n
Hi all,
I wanted to share a domain monitoring workflow. It started as a simple way to check if services were up or down, but I ended up turning it into a state-based system that only sends alerts when the service status changes.
The goal is to avoid spammy notifications and have something that can be reused for monitoring other systems too.
What It Does
- Checks a list of domains or service URLs using HTTP requests
- Stores the last known state (“up” or “down”) in a Google Sheet with alert context
- Compares the current check to the stored state
- Sends an alert only if the state has changed
- Updates the sheet with the new state
Workflow Overview
- Read the list of domains and states from a Google Sheet
- For each domain, make an HTTP GET request
- If the request fails or returns an error, handle it in a separate branch
- Merge both success and error paths to compare the new result with the stored state
- If the state has changed, send a notification and update the sheet
Challenges and Questions
- Error paths in n8n only pass the error, so I had to use a merge node to bring the error and domain info back together. Is there a cleaner way to do this?
- Would a switch node help simplify the flow, especially when branching based on status codes?
- Are there better node choices for managing this kind of logic?
- I’m doing the state comparison with expressions. Is there a more straightforward method?
Looking for Feedback
I’d really appreciate any feedback on how to make this cleaner, easier to maintain, or more efficient. Especially interested in best practices for branching logic and state comparison in n8n.
Thanks in advance.