AutomationFlowsWeb Scraping › Invoice Generation

Invoice Generation

Invoice Generation. Uses httpRequest, emailSend. Webhook trigger; 6 nodes.

Webhook trigger★★☆☆☆ complexity6 nodesHTTP RequestEmail Send
Web Scraping Trigger: Webhook Nodes: 6 Complexity: ★★☆☆☆ Added:

This workflow follows the Emailsend → HTTP Request 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": "Invoice Generation",
  "nodes": [
    {
      "parameters": {
        "path": "finance/invoice-generation",
        "httpMethod": "POST",
        "responseBinary": false,
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "webhook-trigger",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        50,
        200
      ]
    },
    {
      "parameters": {
        "functionCode": "const studentId = $input.first().json.student_id;\nconst studentEmail = $input.first().json.student_email;\nconst studentName = $input.first().json.student_name;\nconst assessmentId = $input.first().json.assessment_id;\nconst amount = $input.first().json.amount;\nconst currency = $input.first().json.currency || 'GBP';\nconst dueDate = $input.first().json.due_date;\nconst invoiceRef = 'INV-' + new Date().getFullYear() + '-' + Math.random().toString(36).substr(2, 9).toUpperCase();\n\nreturn {\n  json: {\n    studentId,\n    studentEmail,\n    studentName,\n    assessmentId,\n    amount,\n    currency,\n    dueDate,\n    invoiceRef,\n    timestamp: new Date().toISOString()\n  }\n};"
      },
      "id": "extract-finance-data",
      "name": "Extract Finance Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        250,
        200
      ]
    },
    {
      "parameters": {
        "url": "={{$env.SJMS_API_URL}}/api/invoices",
        "method": "POST",
        "headers": {},
        "bodyParametersJson": "{\n  \"student_id\": \"={{$node[\\\"extract-finance-data\\\"].json.studentId}}\",\n  \"student_name\": \"={{$node[\\\"extract-finance-data\\\"].json.studentName}}\",\n  \"student_email\": \"={{$node[\\\"extract-finance-data\\\"].json.studentEmail}}\",\n  \"assessment_id\": \"={{$node[\\\"extract-finance-data\\\"].json.assessmentId}}\",\n  \"invoice_reference\": \"={{$node[\\\"extract-finance-data\\\"].json.invoiceRef}}\",\n  \"amount\": \"={{$node[\\\"extract-finance-data\\\"].json.amount}}\",\n  \"currency\": \"={{$node[\\\"extract-finance-data\\\"].json.currency}}\",\n  \"due_date\": \"={{$node[\\\"extract-finance-data\\\"].json.dueDate}}\",\n  \"generation_date\": \"={{$node[\\\"extract-finance-data\\\"].json.timestamp}}\"\n}",
        "headerParametersJson": "{\"X-N8N-API-KEY\": \"={{$env.N8N_API_KEY}}\"}"
      },
      "id": "generate-invoice",
      "name": "Generate Invoice",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        450,
        200
      ]
    },
    {
      "parameters": {
        "fromEmail": "finance@sjms.ac.uk",
        "toEmail": "richard.knapp@futurehorizons.com",
        "subject": "Invoice {{$node[\"extract-finance-data\"].json.invoiceRef}} - Payment Required",
        "textOnly": false,
        "htmlEmail": "<h2>Invoice for Payment</h2>\n<p>Dear {{$node[\"extract-finance-data\"].json.studentName}},</p>\n<p><strong>Invoice Reference:</strong> {{$node[\"extract-finance-data\"].json.invoiceRef}}</p>\n<p><strong>Amount Due:</strong> {{$node[\"extract-finance-data\"].json.currency}} {{$node[\"extract-finance-data\"].json.amount}}</p>\n<p><strong>Due Date:</strong> {{$node[\"extract-finance-data\"].json.dueDate}}</p>\n<p>Please log into your student portal to view the full invoice and make payment.</p>\n<p>If you have any questions about this invoice, please contact our Finance Office at finance@sjms.ac.uk</p>\n<p>Best regards,<br/>Finance Office</p>"
      },
      "id": "send-invoice-email",
      "name": "Send Invoice Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [
        650,
        200
      ]
    },
    {
      "parameters": {
        "url": "={{$env.SJMS_API_URL}}/api/invoices/{{$node[\"extract-finance-data\"].json.invoiceRef}}/publish",
        "method": "PATCH",
        "headers": {},
        "bodyParametersJson": "{\n  \"status\": \"published\",\n  \"publish_date\": \"={{$node[\\\"extract-finance-data\\\"].json.timestamp}}\",\n  \"visibility\": \"student\"\n}",
        "headerParametersJson": "{\"X-N8N-API-KEY\": \"={{$env.N8N_API_KEY}}\"}"
      },
      "id": "publish-to-portal",
      "name": "Publish to Student Portal",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        850,
        200
      ]
    },
    {
      "parameters": {
        "url": "={{$env.SJMS_API_URL}}/api/audit/log",
        "method": "POST",
        "headers": {},
        "bodyParametersJson": "{\n  \"entity\": \"invoice\",\n  \"entityId\": \"={{$node[\\\"extract-finance-data\\\"].json.invoiceRef}}\",\n  \"action\": \"generated\",\n  \"details\": {\n    \"student_id\": \"={{$node[\\\"extract-finance-data\\\"].json.studentId}}\",\n    \"amount\": \"={{$node[\\\"extract-finance-data\\\"].json.amount}}\",\n    \"currency\": \"={{$node[\\\"extract-finance-data\\\"].json.currency}}\",\n    \"due_date\": \"={{$node[\\\"extract-finance-data\\\"].json.dueDate}}\",\n    \"timestamp\": \"={{$node[\\\"extract-finance-data\\\"].json.timestamp}}\"\n  }\n}",
        "headerParametersJson": "{\"X-N8N-API-KEY\": \"={{$env.N8N_API_KEY}}\"}"
      },
      "id": "audit-invoice",
      "name": "Audit Invoice",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        1050,
        200
      ]
    }
  ],
  "connections": {
    "webhook-trigger": {
      "main": [
        [
          {
            "node": "extract-finance-data",
            "branch": 0,
            "index": 0
          }
        ]
      ]
    },
    "extract-finance-data": {
      "main": [
        [
          {
            "node": "generate-invoice",
            "branch": 0,
            "index": 0
          }
        ]
      ]
    },
    "generate-invoice": {
      "main": [
        [
          {
            "node": "send-invoice-email",
            "branch": 0,
            "index": 0
          }
        ]
      ]
    },
    "send-invoice-email": {
      "main": [
        [
          {
            "node": "publish-to-portal",
            "branch": 0,
            "index": 0
          }
        ]
      ]
    },
    "publish-to-portal": {
      "main": [
        [
          {
            "node": "audit-invoice",
            "branch": 0,
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "errorWorkflow": "global-error-workflow",
    "retry": {
      "enabled": true,
      "maxTries": 3,
      "waitBetweenRetries": 1000
    }
  }
}
Pro

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

About this workflow

Invoice Generation. Uses httpRequest, emailSend. Webhook trigger; 6 nodes.

Source: https://github.com/RJK134/sjms-v4-integrated/blob/59aca8a599c74c216f5afadc3195b8039ccb430a/n8n-workflows/invoice-generation.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

&gt; ⚠️ Notice: &gt; Community nodes like @custom-js/n8n-nodes-pdf-toolkit-v2 can be installed on both self-hosted and Cloud instances of n8n. Just search for it via CustomJS.

HTTP Request, @Custom Js/N8N Nodes Pdf Toolkit, Email Send
Web Scraping

Billing Workflow. Uses httpRequest, emailSend. Webhook trigger; 11 nodes.

HTTP Request, Email Send
Web Scraping

HireMind - Application Approval & Auto-Apply Handler. Uses httpRequest, emailSend. Webhook trigger; 10 nodes.

HTTP Request, Email Send
Web Scraping

User Onboarding Workflow. Uses httpRequest, emailSend. Webhook trigger; 7 nodes.

HTTP Request, Email Send
Web Scraping

Golden Sample: webhook → http → transform → respond (+error path). Uses httpRequest, errorTrigger, emailSend. Webhook trigger; 7 nodes.

HTTP Request, Error Trigger, Email Send