AutomationFlowsWeb Scraping › Analyse Charges Fixes

Analyse Charges Fixes

Analyse Charges Fixes. Uses httpRequest. Webhook trigger; 8 nodes.

Webhook trigger★★★★☆ complexity8 nodesHTTP Request
Web Scraping Trigger: Webhook Nodes: 8 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": "Analyse Charges Fixes",
  "nodes": [
    {
      "parameters": {
        "path": "analyse-compta",
        "method": "POST",
        "responseMode": "lastNode"
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        100,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://app.pennylane.com/api/analytic_tags",
        "method": "GET",
        "authentication": "headerAuth",
        "headerParameters": [
          {
            "name": "Authorization",
            "value": "Bearer VOTRE_TOKEN_API"
          }
        ]
      },
      "name": "get_tags",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        300,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "const tagName = $json[\"body\"][\"category_name\"].toLowerCase();\nconst tags = items[0].json.data;\nconst found = tags.find(tag => tag.attributes.name.toLowerCase() === tagName);\nif (!found) throw new Error(\"Tag non trouv\u00e9 : \" + tagName);\nreturn [{ json: { tag_id: found.id } }];"
      },
      "name": "find_tag_id",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "const year = parseInt($json[\"body\"][\"year\"]);\nconst month = parseInt($json[\"body\"][\"month\"]);\nconst start = new Date(year, month - 1, 1);\nconst end = new Date(year, month, 0);\nconst startPrev = new Date(year, month - 2, 1);\nconst endPrev = new Date(year, month - 1, 0);\nfunction format(d) { return d.toISOString().split('T')[0]; }\nreturn [{ json: { mois_demande_start: format(start), mois_demande_end: format(end), mois_avant_start: format(startPrev), mois_avant_end: format(endPrev), tag_id: $json[\"tag_id\"] } }];"
      },
      "name": "build_dates",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        700,
        300
      ]
    },
    {
      "parameters": {
        "url": "={{`https://app.pennylane.com/api/reports/analytics?start_date=${$json[\"mois_demande_start\"]}&end_date=${$json[\"mois_demande_end\"]}&tag_ids[]=${$json[\"tag_id\"]}`}}",
        "method": "GET",
        "authentication": "headerAuth",
        "headerParameters": [
          {
            "name": "Authorization",
            "value": "Bearer VOTRE_TOKEN_API"
          }
        ]
      },
      "name": "get_montant_1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        900,
        200
      ]
    },
    {
      "parameters": {
        "url": "={{`https://app.pennylane.com/api/reports/analytics?start_date=${$json[\"mois_avant_start\"]}&end_date=${$json[\"mois_avant_end\"]}&tag_ids[]=${$json[\"tag_id\"]}`}}",
        "method": "GET",
        "authentication": "headerAuth",
        "headerParameters": [
          {
            "name": "Authorization",
            "value": "Bearer VOTRE_TOKEN_API"
          }
        ]
      },
      "name": "get_montant_2",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        900,
        400
      ]
    },
    {
      "parameters": {
        "functionCode": "const montant_1 = items[0].json.data[0].attributes.total;\nconst montant_2 = items[1].json.data[0].attributes.total;\nconst variation = montant_2 === 0 ? 0 : ((montant_1 - montant_2) / montant_2) * 100;\nreturn [{ json: { montant: montant_1, variation: variation.toFixed(1), interpretation: `Les charges fixes sont de ${montant_1.toLocaleString()} \u20ac pour ce mois, soit une ${variation >= 0 ? 'hausse' : 'baisse'} de ${Math.abs(variation).toFixed(1)} % par rapport au mois pr\u00e9c\u00e9dent.` } }];"
      },
      "name": "analyse",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1100,
        300
      ]
    },
    {
      "parameters": {
        "responseMode": "lastNode",
        "responseData": "firstEntryJson",
        "options": {}
      },
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1300,
        300
      ]
    }
  ],
  "connections": {
    "Webhook": [
      {
        "node": "get_tags",
        "type": "main",
        "index": 0
      }
    ],
    "get_tags": [
      {
        "node": "find_tag_id",
        "type": "main",
        "index": 0
      }
    ],
    "find_tag_id": [
      {
        "node": "build_dates",
        "type": "main",
        "index": 0
      }
    ],
    "build_dates": [
      {
        "node": "get_montant_1",
        "type": "main",
        "index": 0
      },
      {
        "node": "get_montant_2",
        "type": "main",
        "index": 0
      }
    ],
    "get_montant_1": [
      {
        "node": "analyse",
        "type": "main",
        "index": 0
      }
    ],
    "get_montant_2": [
      {
        "node": "analyse",
        "type": "main",
        "index": 1
      }
    ],
    "analyse": [
      {
        "node": "Respond to Webhook",
        "type": "main",
        "index": 0
      }
    ]
  }
}
Pro

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

About this workflow

Analyse Charges Fixes. Uses httpRequest. Webhook trigger; 8 nodes.

Source: https://gist.github.com/souf7654354689/7a66ab91a994c87b5ed54629d71f0fac — 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

This n8n template provides enterprise-level version control for your workflows using GitHub integration. Stop losing hours to broken workflows and manual exports – get proper commit history, visual di

n8n, Execute Workflow Trigger, HTTP Request +1
Web Scraping

This flow creates dummy files for every item added in your *Arrs (Radarr/Sonarr) with the tag .

HTTP Request, Ssh
Web Scraping

eek-Go v2 (Batch-Then-Review). Uses httpRequest. Webhook trigger; 75 nodes.

HTTP Request
Web Scraping

This workflow receives webhook requests from a content calendar and uses the X API v2 to publish text posts, threads, image/video posts, and polls, as well as delete existing posts and run a credentia

HTTP Request
Web Scraping

This workflow acts as a central API gateway for all technical indicator agents in the Binance Spot Market Quant AI system. It listens for incoming webhook requests and dynamically routes them to the c

HTTP Request