Skip to content
NEWMarketplace and the trig8n Agent: sell what you build, and get plans and changes that are tested before you see them. See what is new

Library / Reports, Analytics & Dashboards

Reports, Analytics & Dashboards

Compile n8n Workflow Statistics

When run or called, it queries the n8n API and assembles statistics on nodes, workflows, tags and globals into one JSON object.

What it does

## Create the main JSON object with the workflow statistics * globals - general information (# of workflows, active workflows, total trigger count) * wf_stats - summary per workflow (number or nodes, unique nodes, list of nodes and tags) * nodes-section - summary per node (number of workflows that use a node and their URLs) * tags-section - summary per tag (number of workflows that use a node and their URLs) * webhook-section - lists all webhook endpoints of the instance and shows the workflow URLs ### You can use this JSON in BI tools to create a custom dashboard ## Learn JS tips & tricks ### Instead of just using one Code node, the workflow contains several nodes with useful advanced tricks. ### JMESPath * Make a simple array of strings out of a complex array: $jmespath($json,'nodes[*].type') * Extract values based on condition: $jmespath($input.all(),'[?json.wf_stats.wf_active == true]') ### Map and arrow functions * Perform operation on each array element: .map(item => (item.split('.').pop().toUpperCase() )) * Calculate sum of values from an array: .reduce((accumulator, currentValue) => accumulator + currentValue, 0) ### Create an array with only unique values * [...new Set($json.nodes_array)] ### Date-time conversions with the Luxon library: * DateTime.fromISO($json.createdAt).toFormat('yyyy-MM-dd HH:mm:ss') ### Template literals (Template strings) for creating strings in JS * wf-${$json.id}

The steps

  1. When clicking "Test workflow"
  2. nodes-section
  3. workflows-section
  4. tags-section
  5. globals-section
  6. Execute Workflow Trigger
  7. Convert to XML
  8. Create HTML
  9. Move Binary Data
  10. Respond to Webhook
  11. Respond to Webhook2
  12. Final template
  13. Template elements
  14. Sort-workflows

28 steps in total.

Similar automations