AutomationFlowsWeb Scraping › Fetch and Merge Funding Plans Data

Fetch and Merge Funding Plans Data

Original n8n title: Fts

FTS. Uses httpRequest, itemLists, functionItem, start. Manual trigger; 16 nodes.

Manual trigger★★★★☆ complexity16 nodesHTTP RequestItem ListsFunction ItemStart
Web Scraping Trigger: Manual Nodes: 16 Complexity: ★★★★☆ Added:

This workflow follows the HTTP Request → Itemlists 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": "FTS",
  "nodes": [
    {
      "parameters": {
        "url": "=https://api.hpc.tools/v1/public/plan/year/{{$json[\"year\"]}}",
        "options": {}
      },
      "id": "619af71c-7340-4fac-ab17-7e7c8064f223",
      "name": "Get plans by year",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        1640,
        -180
      ]
    },
    {
      "parameters": {
        "fieldToSplitOut": "data",
        "options": {}
      },
      "id": "d603f9fa-69b1-4a40-beb9-7056d6eb5226",
      "name": "Extract data",
      "type": "n8n-nodes-base.itemLists",
      "typeVersion": 1,
      "position": [
        1800,
        0
      ]
    },
    {
      "parameters": {
        "functionCode": "let record = {};\n\nrecord.Id = item.id;\nrecord.plan_id = item.id;\nrecord.updated = item.updatedAt.replace('T', ' ').replace('Z', '').substr(0, item.updatedAt.indexOf('.'));\nrecord.name = item.planVersion.name;\nrecord.year = item.years[0].year;\nrecord.code = item.planVersion.code;\nrecord.original_requirements = item.origRequirements;\nrecord.revised_requirements = item.revisedRequirements;\nrecord.iso3 = item.locations[0].iso3;\nrecord.country = item.locations[0].name;\n\nreturn record;"
      },
      "id": "67f1c3d1-c811-4eb1-bac2-1ec503b60cc6",
      "name": "Build base record",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        2460,
        0
      ]
    },
    {
      "parameters": {
        "url": "=https://api.hpc.tools/v1/public/plan/id/{{$json[\"plan_id\"]}}",
        "options": {}
      },
      "id": "68f0b7b4-ab5f-4b8d-810c-bb9d2e628cbc",
      "name": "Get plan details",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        2880,
        -80
      ]
    },
    {
      "parameters": {
        "functionCode": "// Code here will run once per input item.\n// More info and help: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.functionitem/\n// Tip: You can use luxon for dates and $jmespath for querying JSON structures\n\nlet record = {};\nconsole.log($node[\"Build base record\"].data.plan_id);\n\nrecord.plan_id = $node[\"Build base record\"].data.plan_id;\nrecord.total_requirements = item.data.revisedRequirements;\n\nreturn record;"
      },
      "id": "583f44b3-87c4-4040-91af-682cba94e9cf",
      "name": "Extract revised requirements",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        3060,
        -80
      ]
    },
    {
      "parameters": {
        "url": "=https://api.hpc.tools/v1/public/fts/flow?planId={{$json[\"plan_id\"]}}",
        "options": {}
      },
      "id": "a0bf8516-1801-4a4b-82ab-777b7d27a4c2",
      "name": "Get flow info",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        2760,
        80
      ]
    },
    {
      "parameters": {
        "functionCode": "// Code here will run once per input item.\n// More info and help: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.functionitem/\n// Tip: You can use luxon for dates and $jmespath for querying JSON structures\n\nlet record = {};\n\nrecord.plan_id = $node[\"Build base record\"].data.plan_id;\nrecord.funding_total = item.data.incoming.fundingTotal;\n\nreturn record;"
      },
      "id": "a1e3f5fb-373b-47bc-82dd-2e998eb51954",
      "name": "Extract funding total",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        3000,
        80
      ]
    },
    {
      "parameters": {
        "mode": "combine",
        "mergeByFields": {
          "values": [
            {
              "field1": "plan_id",
              "field2": "plan_id"
            }
          ]
        },
        "options": {}
      },
      "id": "a9e75154-8683-438d-bbea-42db3a5854a1",
      "name": "Merge 1",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 2,
      "position": [
        3200,
        -320
      ]
    },
    {
      "parameters": {
        "mode": "combine",
        "mergeByFields": {
          "values": [
            {
              "field1": "plan_id",
              "field2": "plan_id"
            }
          ]
        },
        "options": {}
      },
      "id": "9e7fff42-b655-42b2-bbdd-ac949222e198",
      "name": "Merge 2",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 2,
      "position": [
        3360,
        20
      ]
    },
    {
      "parameters": {
        "functionCode": "let output = [];\n\nfor (item of items) {\n  console.log(item.json.locations[0]);\n  if (item.json.locations[0] && item.json.locations[0].iso3 && item.json.locations[0].iso3.length > 0) {\n    output.push(item);\n  }\n}\n\nreturn output;"
      },
      "id": "8b6ea276-1b8d-44e4-905a-4e00f63705b9",
      "name": "We need ISO3",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        2020,
        0
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "14943492-0553-4982-84eb-065f9a0d642c",
      "name": "SplitInBatches",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        2240,
        0
      ]
    },
    {
      "parameters": {
        "functionCode": "let output = [];\n\nfor (item of items) {\n  // Skip hxl row.\n  if (item.json.iso3.substr(0, 1) == '#') {\n    continue;\n  }\n\n  // Skip empty iso3.\n  if (item.json.iso3 == '') {\n    continue;\n  }\n\n  if (item.json['original_requirements'] != '') {\n    output.push({\n      id: 'fts_' + item.json.iso3 + '_' + item.json.year + '_original_requirements',\n      country: item.json.country,\n      iso3: item.json.iso3,\n      year: item.json.year,\n      name: 'Original requirements',\n      value: item.json['original_requirements'],\n      source: 'FTS',\n      url: 'https://fts.unocha.org/appeals/' + item.json.plan_id + '/summary',\n      description: item.json.name + ' [' + item.json.code + ']',\n      updated: item.json.updated,\n      provider: 'fts',\n    });\n  }\n\n  if (item.json['revised_requirements'] != '') {\n    output.push({\n      id: 'fts_' + item.json.iso3 + '_' + item.json.year + '_revised_requirements',\n      country: item.json.country,\n      iso3: item.json.iso3,\n      year: item.json.year,\n      name: 'Revised requirements',\n      value: item.json['revised_requirements'],\n      source: 'FTS',\n      url: 'https://fts.unocha.org/appeals/' + item.json.plan_id + '/summary',\n      description: item.json.name + ' [' + item.json.code + ']',\n      updated: item.json.updated,\n      provider: 'fts',\n    });\n  }\n \n  if (item.json['total_requirements'] != '') {\n    output.push({\n      id: 'fts_' + item.json.iso3 + '_' + item.json.year + '_total_requirements',\n      country: item.json.country,\n      iso3: item.json.iso3,\n      year: item.json.year,\n      name: 'Total requirements',\n      value: item.json['total_requirements'],\n      source: 'FTS',\n      url: 'https://fts.unocha.org/appeals/' + item.json.plan_id + '/summary',\n      description: item.json.name + ' [' + item.json.code + ']',\n      updated: item.json.updated,\n      provider: 'fts',\n    });\n  }\n\n  if (item.json['funding_total'] != '') {\n    output.push({\n      id: 'fts_' + item.json.iso3 + '_' + item.json.year + '_funding_total',\n      country: item.json.country,\n      iso3: item.json.iso3,\n      year: item.json.year,\n      name: 'Funding total',\n      value: item.json['funding_total'],\n      source: 'FTS',\n      url: 'https://fts.unocha.org/appeals/' + item.json.plan_id + '/summary',\n      description: item.json.name + ' [' + item.json.code + ']',\n      updated: item.json.updated,\n      provider: 'fts',\n    });\n  }\n \n}\n\nreturn output;"
      },
      "id": "18abb6eb-d008-4801-8745-86765e92b612",
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        3520,
        20
      ]
    },
    {
      "parameters": {
        "jsCode": "let record = {};\n\nrecord.year = $env.FTS_YEAR || new Date().getFullYear();\n\nreturn record;\n"
      },
      "id": "451d6986-c7bc-41fc-904d-9f467a4cc740",
      "name": "Set year",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        1440,
        -180
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $env.OCHA_API_URL }}/fts/batch",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "API-KEY",
              "value": "82797b265d1b576df2be0bb6a789fef5"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={{$json}}",
        "options": {}
      },
      "id": "213ac819-e7f4-4095-abc7-daa9d8eeda1d",
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        3900,
        140
      ]
    },
    {
      "parameters": {
        "operation": "aggregateItems",
        "aggregate": "aggregateAllItemData"
      },
      "id": "f24d68bd-3e05-4f5d-ab12-3092a3a38e48",
      "name": "Item Lists1",
      "type": "n8n-nodes-base.itemLists",
      "typeVersion": 1,
      "position": [
        3680,
        20
      ]
    },
    {
      "parameters": {},
      "id": "6f9fc067-ed54-4606-8c4e-b9bfdf75bdbd",
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        1240,
        -180
      ]
    }
  ],
  "connections": {
    "Get plans by year": {
      "main": [
        [
          {
            "node": "Extract data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract data": {
      "main": [
        [
          {
            "node": "We need ISO3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build base record": {
      "main": [
        [
          {
            "node": "Get plan details",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get flow info",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get plan details": {
      "main": [
        [
          {
            "node": "Extract revised requirements",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract revised requirements": {
      "main": [
        [
          {
            "node": "Merge 1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get flow info": {
      "main": [
        [
          {
            "node": "Extract funding total",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract funding total": {
      "main": [
        [
          {
            "node": "Merge 2",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge 1": {
      "main": [
        [
          {
            "node": "Merge 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge 2": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "We need ISO3": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches": {
      "main": [
        [
          {
            "node": "Build base record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Item Lists1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set year": {
      "main": [
        [
          {
            "node": "Get plans by year",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Item Lists1": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start": {
      "main": [
        [
          {
            "node": "Set year",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "saveExecutionProgress": true,
    "saveManualExecutions": true,
    "callerPolicy": "any",
    "executionTimeout": 900
  },
  "hash": "a3b97cbbf522aaebf3911f2b398e419e",
  "id": 6,
  "tags": []
}
Pro

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

About this workflow

FTS. Uses httpRequest, itemLists, functionItem, start. Manual trigger; 16 nodes.

Source: https://github.com/UN-OCHA/ocha-api-site/blob/e90fe1739c7b5a2429cc0e8318abf40306dac29b/n8n/FTS.json — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

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

Web Scraping

CBPF. Uses start, httpRequest, itemLists. Manual trigger; 13 nodes.

Start, HTTP Request, Item Lists
Web Scraping

Gist:Ed Parsadanyan. Uses start, httpRequest, htmlExtract, itemLists. Manual trigger; 7 nodes.

Start, HTTP Request, Html Extract +1
Web Scraping

This workflow syncs Zendesk tickets to Pipedrive contact owners.

Function Item, HTTP Request, Zendesk +2
Web Scraping

Create An Rss Feed Based On A Website S Content. Uses manualTrigger, itemLists, htmlExtract, httpRequest. Event-driven trigger; 12 nodes.

Item Lists, Html Extract, HTTP Request +1
Web Scraping

This workflow combines customers' details with their payment data and passes the input to Pipedrive as a note to the organization. Stripe account and Stripe credentials Pipedrive account and Pipedrive

Stripe, Pipedrive, Function Item +2