AutomationFlowsGeneral › Query: Current Status

Query: Current Status

Query: Current Status. Webhook trigger; 6 nodes.

Webhook trigger★★★★☆ complexity6 nodes
General Trigger: Webhook Nodes: 6 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Query: Current Status",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "GET",
        "path": "current",
        "options": {}
      },
      "id": "webhook-current",
      "name": "Webhook Get Current",
      "type": "n8n-nodes-base.webhook",
      "position": [
        250,
        300
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "jsCode": "const Database = require('better-sqlite3');\nconst db = new Database('e:/repos/golearn/data/curriculum.db');\n\nconst row = db.prepare('SELECT * FROM cycles WHERE status=? ORDER BY id DESC LIMIT 1').get('active');\ndb.close();\n\nreturn {\n  json: row || {}\n};",
        "mode": "runOnceForAllItems"
      },
      "id": "get-active-cycle",
      "name": "Get Active Cycle",
      "type": "n8n-nodes-base.code",
      "position": [
        450,
        300
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "jsCode": "const Database = require('better-sqlite3');\nconst db = new Database('e:/repos/golearn/data/curriculum.db');\n\nconst rows = db.prepare('SELECT * FROM assessments ORDER BY id DESC LIMIT 5').all();\ndb.close();\n\nreturn {\n  json: rows\n};",
        "mode": "runOnceForAllItems"
      },
      "id": "get-recent-assessments",
      "name": "Get Recent Assessments",
      "type": "n8n-nodes-base.code",
      "position": [
        650,
        300
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "jsCode": "const Database = require('better-sqlite3');\nconst db = new Database('e:/repos/golearn/data/curriculum.db');\n\nconst rows = db.prepare('SELECT concept_name, current_score, times_seen FROM concept_mastery ORDER BY concept_name').all();\ndb.close();\n\nreturn {\n  json: rows\n};",
        "mode": "runOnceForAllItems"
      },
      "id": "get-concept-mastery",
      "name": "Get Concept Mastery",
      "type": "n8n-nodes-base.code",
      "position": [
        650,
        450
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "jsCode": "// Build comprehensive status response\nconst activeCycle = $input.first().json;\nconst assessments = $input.all()[1].json;\nconst concepts = $input.all()[2].json;\n\nconst currentCurriculum = activeCycle.curriculum_json ? \n  JSON.parse(activeCycle.curriculum_json) : null;\n\nconst recentAssessments = Array.isArray(assessments) ? \n  assessments.map(a => ({\n    id: a.id,\n    cycle_id: a.cycle_id,\n    submitted_at: a.submitted_at,\n    assessment: a.assessment_json ? JSON.parse(a.assessment_json) : null\n  })) : [];\n\n// Group concepts by mastery level\nconst conceptsByLevel = {\n  untaught: concepts.filter(c => c.current_score === 0),\n  learning: concepts.filter(c => c.current_score > 0 && c.current_score < 3),\n  developing: concepts.filter(c => c.current_score === 3),\n  proficient: concepts.filter(c => c.current_score >= 4),\n  plateau: concepts.filter(c => c.times_seen >= 3 && c.current_score < 3)\n};\n\nreturn {\n  json: {\n    success: true,\n    current_curriculum: currentCurriculum,\n    current_cycle: activeCycle.cycle_num || 1,\n    cycle_status: activeCycle.status,\n    recent_assessments: recentAssessments,\n    concept_mastery: {\n      total: concepts.length,\n      by_level: {\n        untaught: conceptsByLevel.untaught.length,\n        learning: conceptsByLevel.learning.length,\n        developing: conceptsByLevel.developing.length,\n        proficient: conceptsByLevel.proficient.length,\n        plateau: conceptsByLevel.plateau.length\n      },\n      concepts: concepts\n    }\n  }\n};"
      },
      "id": "build-status",
      "name": "Build Status Response",
      "type": "n8n-nodes-base.code",
      "position": [
        850,
        300
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json }}",
        "options": {}
      },
      "id": "respond-status",
      "name": "Respond Status",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1050,
        300
      ],
      "typeVersion": 1
    }
  ],
  "connections": {
    "Webhook Get Current": {
      "main": [
        [
          {
            "node": "Get Active Cycle",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Active Cycle": {
      "main": [
        [
          {
            "node": "Get Recent Assessments",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Concept Mastery",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Recent Assessments": {
      "main": [
        [
          {
            "node": "Build Status Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Concept Mastery": {
      "main": [
        [
          {
            "node": "Build Status Response",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Build Status Response": {
      "main": [
        [
          {
            "node": "Respond Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionTimeout": 30
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Query: Current Status. Webhook trigger; 6 nodes.

Source: https://github.com/bananacryevil/golearn/blob/c19402ea75c7774b66e202e976e0972b7b4b7b9a/n8n-workflows/3-query-status.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

A production-ready authentication workflow implementing secure user registration, login, token verification, and refresh token mechanisms. Perfect for adding authentication to any application without

Crypto, Data Table, Execute Workflow Trigger
General

Portfolio Orchestrator. Uses httpRequest. Webhook trigger; 59 nodes.

HTTP Request
General

This n8n template demonstrates how a simple Multi-Layer Perceptron (MLP) neural network can predict housing prices. The prediction is based on four key features, processed through a three-layer model.

General

github code Try yourself

Google Calendar
General

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

N8N Nodes 1Shot