I found some answers about testing if a workflow is running. But I’m interested in if it is published & OK (like the green bullet next to it in the workflow editor view).
Describe the problem/error/question
Running n8n locally on laptop.
CONTEXT: Created a workflow that is triggered / ~10 minutes. Checks my emails, selects some and summarizes them, then submits to a RocketChat channel.
Unfortunately, many errors happen, which “unpublish” it (e.g.: mail provider error, LLM errors, laptop lid closed → n8n sleeps, etc).
Thus, I’ve created a secondary workflow that restarts the primary:
- on any error (nodes in primary raise errors)
- on n8n start (n8n container starts at boot)
But I still get cases where the primary workflow stops. Wanting to add a 3rd case:
- a trigger every 1h that checks if the workflow is “down” and, if so, restarts it.
When I use the API node to retrieve the primary workflow, I can “workflowPublishHistory” or “active”. Unfortunately, they are both true/activated even if the workflow is in error (red bullet in editor’s view).
Due to my particular setup:
- I cannot just check if my primary workflow is published
- I cannot just check if it is running, like in the posts I found here, since my workflow can just be “sleeping” in-between two 10 min triggers.
So my question: How do I get the same information as is underlying the display of the red/green/yellow bullet next to a workflow in editor mode, using the n8n API node?
Information on your n8n setup
- n8n version: 2.45.7
- Database (default: SQLite): default
- n8n EXECUTIONS_PROCESS setting (default: own, main): own, main
- Running n8n via (Docker, npm, n8n cloud, desktop app): running in home made incus container that starts npx n8n
- Operating system: Debian 14 guest / LMDE 7 Host