AutomationFlowsAI & RAG › AI Text Summarizer with Ollama

AI Text Summarizer with Ollama

Original n8n title: AI Text Summarizer (ollama)

AI Text Summarizer (Ollama). Uses httpRequest. Webhook trigger; 7 nodes.

Webhook trigger★★★★☆ complexity7 nodesHTTP Request
AI & RAG Trigger: Webhook Nodes: 7 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": "AI Text Summarizer (Ollama)",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "summarize",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000001",
      "name": "Webhook - Receive Text",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const input = $input.first().json;\nlet text = '';\n\nif (input.body && input.body.text) {\n  text = input.body.text;\n} else if (input.body) {\n  text = JSON.stringify(input.body);\n}\n\nif (!text || text.length < 10) {\n  return [{ json: { error: 'Please provide text in the request body as { \"text\": \"your text here\" }', text: '', valid: false } }];\n}\n\n// Truncate very long texts to stay within model context\nconst maxLength = 8000;\nconst truncated = text.length > maxLength;\ntext = text.substring(0, maxLength);\n\nreturn [{ json: { text, original_length: input.body.text ? input.body.text.length : 0, truncated, valid: true } }];"
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000002",
      "name": "Validate & Prepare Input",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        480,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false
          },
          "combinator": "and",
          "conditions": [
            {
              "leftValue": "={{ $json.valid }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "equals"
              }
            }
          ]
        }
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000003",
      "name": "Is Valid Input?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        700,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://localhost:11434/api/generate",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ model: 'llama3.1:8b', prompt: 'You are a professional summarizer. Summarize the following text concisely and accurately. Provide:\\n\\n1. **One-Line Summary**: A single sentence capturing the main point.\\n2. **Key Points**: 3-5 bullet points with the most important information.\\n3. **Tone**: The overall tone of the text (formal, casual, technical, etc.).\\n\\nText to summarize:\\n\\n' + $json.text, stream: false, options: { temperature: 0.3, num_predict: 1000 } }) }}",
        "options": {
          "timeout": 120000
        }
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000004",
      "name": "Summarize with Ollama",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        960,
        200
      ]
    },
    {
      "parameters": {
        "jsCode": "const ollamaResponse = $input.first().json;\nlet response;\n\ntry {\n  response = typeof ollamaResponse.data === 'string' ? JSON.parse(ollamaResponse.data) : ollamaResponse;\n} catch (e) {\n  response = ollamaResponse;\n}\n\nconst summary = response.response || response.data?.response || 'Unable to generate summary';\nconst inputMeta = $('Validate & Prepare Input').first().json;\n\nreturn [{\n  json: {\n    summary: summary,\n    metadata: {\n      original_length: inputMeta.original_length,\n      was_truncated: inputMeta.truncated,\n      model: 'llama3.1:8b',\n      processed_at: new Date().toISOString()\n    }\n  }\n}];"
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000005",
      "name": "Format Response",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1200,
        200
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify($json) }}"
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000006",
      "name": "Send Summary Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1440,
        200
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ error: $('Validate & Prepare Input').first().json.error }) }}",
        "options": {
          "responseCode": 400
        }
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000007",
      "name": "Send Error Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        960,
        440
      ]
    }
  ],
  "connections": {
    "Webhook - Receive Text": {
      "main": [
        [
          {
            "node": "Validate & Prepare Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate & Prepare Input": {
      "main": [
        [
          {
            "node": "Is Valid Input?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Valid Input?": {
      "main": [
        [
          {
            "node": "Summarize with Ollama",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize with Ollama": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Response": {
      "main": [
        [
          {
            "node": "Send Summary Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "tags": [
    {
      "name": "AI"
    },
    {
      "name": "Ollama"
    },
    {
      "name": "Summarization"
    },
    {
      "name": "Free Sample"
    }
  ]
}
Pro

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

About this workflow

AI Text Summarizer (Ollama). Uses httpRequest. Webhook trigger; 7 nodes.

Source: https://github.com/bonskari/n8n-ollama-workflows/blob/main/workflows/text-summarizer.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

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

AI & RAG

Who this is for

Gmail Trigger, Google Drive, Gmail +3
AI & RAG

🧠 How it works This workflow lets users generate structured summaries from YouTube videos directly inside Slack using n8n, AssemblyAI, and OpenAI.

HTTP Request, OpenAI
AI & RAG

This n8n template automatically transcribes GoHighLevel (GHL) call recordings and creates an AI-generated summary that is added as a note directly to the related contact in your GHL CRM.

OpenAI, HTTP Request
AI & RAG

A fully automated content engine that researches, writes, scores, and visualizes LinkedIn posts — built with n8n, OpenAI, Perplexity, and Replicate.

OpenAI, HTTP Request, Google Sheets +1
AI & RAG

Google analytics template. Uses scheduleTrigger, manualTrigger, stickyNote, googleAnalytics. Scheduled trigger; 22 nodes.

Google Analytics, HTTP Request, Baserow