{
  "id": "d669a47dd798b6be",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "name": "Summarize web pages from a URL to Notion using OpenAI",
  "tags": [
    {
      "name": "notion"
    },
    {
      "name": "summarization"
    },
    {
      "name": "research"
    },
    {
      "name": "web-scraping"
    },
    {
      "name": "productivity"
    },
    {
      "name": "openai"
    },
    {
      "name": "automation"
    },
    {
      "name": "ai"
    }
  ],
  "nodes": [
    {
      "id": "2b22e6e6-54bf-4954-ae37-c4367a0846ea",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -160
      ],
      "parameters": {
        "width": 480,
        "height": 624,
        "content": "## Summarize web pages from a URL to Notion using OpenAI\n\n## How it works\n\n1. Listens for a URL submission through a form.\n2. Fetches the web page content from the provided URL.\n3. Extracts the article text from the fetched web page.\n4. Uses OpenAI to summarize and tag the extracted text.\n5. Saves the summarized result to Notion.\n\n## Setup steps\n\n- [ ] Set up a form or interface to submit URLs.\n- [ ] Configure HTTP Request node to access the URL.\n- [ ] Set up OpenAI credentials for the LLM Chain node.\n- [ ] Connect Notion account and configure database for storage.\n\n## Customization\n\nThe summarization and tagging process can be adjusted by modifying the OpenAI model parameters and output schema."
      },
      "typeVersion": 1
    },
    {
      "id": "3523e295-a9e4-491e-8c1b-fa86c8136c6d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 304,
        "content": "## URL submission and fetch\n\nHandles submission of URL and fetching of web page content."
      },
      "typeVersion": 1
    },
    {
      "id": "0ae0f0b7-499b-45b0-ae17-759d8edb75f4",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 496,
        "content": "## Extract and process content\n\nExtracts article text and processes it using OpenAI for summarization and tagging."
      },
      "typeVersion": 1
    },
    {
      "id": "cb952890-e6d8-4dcd-bf3a-201bd05e2712",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 320,
        "content": "## Store results in Notion\n\nSaves the summarized and tagged result to a Notion database."
      },
      "typeVersion": 1
    },
    {
      "id": "69cdca18-914d-452f-accb-035021619588",
      "name": "When URL Submitted",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -40,
        0
      ],
      "parameters": {
        "options": {},
        "formTitle": "Save & Summarize a Page",
        "formFields": {
          "values": [
            {
              "fieldLabel": "URL",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3d55ec4d-1590-4be8-bbce-35e33dec6784",
      "name": "Fetch Web Page Content",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        200,
        0
      ],
      "parameters": {
        "url": "={{ $json.URL }}",
        "options": {
          "response": {
            "response": {
              "neverError": true
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "032c3158-983b-4264-92cd-29ae89afde94",
      "name": "Extract Text from HTML",
      "type": "n8n-nodes-base.html",
      "position": [
        440,
        0
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "title",
              "cssSelector": "title"
            },
            {
              "key": "body",
              "cssSelector": "article, main, body",
              "returnValue": "text"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "fca7ccf8-80ed-4447-b9f5-8c01b168ad03",
      "name": "Generate Summary with Tags",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        680,
        0
      ],
      "parameters": {
        "text": "=Summarize this web page in 5 bullets, then suggest 3 topic tags.\n\nTitle: {{ $json.title }}\nContent:\n{{ ($json.body || '').slice(0, 6000) }}",
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.5
    },
    {
      "id": "d6042b6c-de53-41c1-a780-12a489834d7f",
      "name": "Use OpenAI Model GPT-4",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        680,
        220
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {
          "temperature": 0.4
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7b38a35e-2acd-4e24-8d37-44d1b4cae066",
      "name": "Define Summary Structure",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        900,
        220
      ],
      "parameters": {
        "schemaType": "fromJson",
        "jsonSchemaExample": "{\n  \"summary\": [\n    \"bullet 1\",\n    \"bullet 2\"\n  ],\n  \"tags\": [\n    \"ai\",\n    \"automation\",\n    \"n8n\"\n  ]\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "399c7a2b-61ad-46c9-a356-0f013b812ac0",
      "name": "Add Summary to Notion",
      "type": "n8n-nodes-base.notion",
      "position": [
        1120,
        0
      ],
      "parameters": {
        "title": "={{ $('Extract Text from HTML').item.json.title }}",
        "resource": "databasePage",
        "operation": "create",
        "databaseId": {
          "__rl": true,
          "mode": "url",
          "value": "https://www.notion.so/REPLACE_DB"
        },
        "propertiesUi": {
          "propertyValues": []
        }
      },
      "typeVersion": 2.2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "When URL Submitted": {
      "main": [
        [
          {
            "node": "Fetch Web Page Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text from HTML": {
      "main": [
        [
          {
            "node": "Generate Summary with Tags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Web Page Content": {
      "main": [
        [
          {
            "node": "Extract Text from HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Use OpenAI Model GPT-4": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Summary with Tags",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Define Summary Structure": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Summary with Tags",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Generate Summary with Tags": {
      "main": [
        [
          {
            "node": "Add Summary to Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}