Get schedule trigger times for each workflow dynamically

Describe the problem/error/question

With about 80 workflows I am currently exploring ways to document meta data for each workflow in a dynamic way. For this reason I am looking for a method to display the times of all schedule triggers within each workflow as a list (skipping workflows without any schedule triggers). Is this possible?

My current workaround is exporting all workflows to Git and extracting the data from the individual JSON files which obviously isn’t reliable at all.

Information on your n8n setup

  • n8n version: 1.9.3
  • Database (default: SQLite): PostgreSQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu

Hi @studioafraz :wave:

The only way that I could think of here would be to query your Postgres database directly. Something like this:

SELECT
    w.id,
    w.name,
    (i.attr ->> 'triggerAtHour') || ':' || (i.attr ->> 'triggerAtMinute') scheduled
FROM
    workflow_entity w,
    json_array_elements(w.nodes) WITH ORDINALITY n(attr, id),
    json_array_elements(n.attr -> 'parameters' -> 'rule' -> 'interval') WITH ORDINALITY i(attr, id)
WHERE
    n.attr ->> 'type' = 'n8n-nodes-base.scheduleTrigger'
ORDER BY 3;

Will return both the workflow ID and workflow name :+1:

Thanks for the suggestion. Will this work with all kinds of schedules?

Hi @studioafraz :wave: No problem - it should return any workflow on your instance of n8n that starts off with a Schedule trigger, you might need to tweak it for different attributes depending on your needs :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.