AutomationFlowsData & Sheets › Wf-31 Query_feed

Wf-31 Query_feed

WF-31 query_feed. Uses executeWorkflowTrigger, postgres. Event-driven trigger; 3 nodes.

Event trigger★★★★☆ complexity3 nodesExecute Workflow TriggerPostgres
Data & Sheets Trigger: Event Nodes: 3 Complexity: ★★★★☆ Added:

This workflow follows the Execute Workflow Trigger → Postgres recipe pattern — see all workflows that pair these two integrations.

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": "WF-31 query_feed",
  "nodes": [
    {
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "since",
              "type": "string"
            },
            {
              "name": "min_relevance",
              "type": "string"
            },
            {
              "name": "tag",
              "type": "string"
            },
            {
              "name": "limit",
              "type": "string"
            },
            {
              "name": "min_score",
              "type": "string"
            },
            {
              "name": "max_age_days",
              "type": "string"
            },
            {
              "name": "group_stories",
              "type": "string"
            }
          ]
        }
      },
      "id": "trigger",
      "name": "WF Input",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "select f.id, f.canonical_url, f.title, f.summary, f.angle, f.relevance, f.specificity, f.angle_strength, f.score, f.tags, f.created_at, f.published_at, f.structured, 1 as articles, case when f.published_at is null then null else greatest(0, extract(day from now() - f.published_at)::int) end as age_days from feed_items f where nullif($7,'') is null and (nullif($1,'') is null or coalesce(f.published_at, f.created_at) >= nullif($1,'')::timestamptz) and (nullif($2,'') is null or f.relevance >= nullif($2,'')::int) and (nullif($3,'') is null or exists (select 1 from unnest(f.tags) tg where tg like '%' || lower(nullif($3,'')) || '%')) and (nullif($5,'') is null or f.score >= nullif($5,'')::int) and (nullif($6,'') is null or coalesce(f.published_at, f.created_at) >= now() - (nullif($6,'')::int * interval '1 day')) union all select null::bigint as id, s.canonical_url, s.title, s.summary, s.angle, null::int as relevance, s.specificity, s.angle_strength, s.score, s.tags, s.created_at, s.last_published as published_at, s.structured, s.articles, case when s.last_published is null then null else greatest(0, extract(day from now() - s.last_published)::int) end as age_days from feed_stories s where nullif($7,'') is not null and (nullif($1,'') is null or coalesce(s.last_published, s.created_at) >= nullif($1,'')::timestamptz) and (nullif($3,'') is null or exists (select 1 from unnest(s.tags) tg where tg like '%' || lower(nullif($3,'')) || '%')) and (nullif($5,'') is null or s.score >= nullif($5,'')::int) and (nullif($6,'') is null or coalesce(s.last_published, s.created_at) >= now() - (nullif($6,'')::int * interval '1 day')) order by score desc nulls last, published_at desc limit coalesce(nullif($4,'')::int, 20)",
        "options": {
          "queryReplacement": "={{ $json.since || '' }},{{ $json.min_relevance || '' }},{{ $json.tag || '' }},{{ $json.limit || '' }},{{ $json.min_score || '' }},{{ $json.max_age_days || '' }},{{ $json.group_stories || '' }}"
        }
      },
      "id": "select",
      "name": "Select feed",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.4,
      "position": [
        220,
        0
      ],
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const rows = $input.all().map(i => i.json).filter(j => j && (j.canonical_url || j.id));\nif (!rows.length) return [{ json: { count: 0, items: [], note: 'no feed items matched the filters' } }];\nconst grouped = rows.some(r => Number(r.articles) > 1);\nreturn [{ json: { count: rows.length, grouped_by_story: Boolean($('WF Input').first().json.group_stories), items: rows, note: grouped ? 'articles > 1 means several outlets covered the same story' : undefined } }];"
      },
      "id": "shape",
      "name": "Shape result",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        0
      ]
    }
  ],
  "connections": {
    "WF Input": {
      "main": [
        [
          {
            "node": "Select feed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select feed": {
      "main": [
        [
          {
            "node": "Shape result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "errorWorkflow": "PNJMA4NbQGmp1xKv"
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

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

About this workflow

WF-31 query_feed. Uses executeWorkflowTrigger, postgres. Event-driven trigger; 3 nodes.

Source: https://github.com/killerwaz/research-overseer/blob/master/workflows/wf31-query-feed.json — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

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

Data & Sheets

Reagendamiento_v2. Uses executeWorkflowTrigger, redis, httpRequest, n8n-nodes-evolution-api. Event-driven trigger; 89 nodes.

Execute Workflow Trigger, Redis, HTTP Request +3
Data & Sheets

Agendamiento_v2. Uses n8n-nodes-evolution-api, redis, httpRequest, executeWorkflowTrigger. Event-driven trigger; 59 nodes.

N8N Nodes Evolution Api, Redis, HTTP Request +3
Data & Sheets

Cancelacion_v2. Uses executeWorkflowTrigger, redis, httpRequest, n8n-nodes-evolution-api. Event-driven trigger; 46 nodes.

Execute Workflow Trigger, Redis, HTTP Request +3
Data & Sheets

Save_Extraction. Uses executeWorkflowTrigger, postgres, httpRequest. Event-driven trigger; 22 nodes.

Execute Workflow Trigger, Postgres, HTTP Request
Data & Sheets

Youtube Searcher. Uses splitInBatches, httpRequest, manualTrigger, executeWorkflowTrigger. Event-driven trigger; 21 nodes.

HTTP Request, Execute Workflow Trigger, Postgres +1