{
  "name": "Generate an AI summary of your Notion comments",
  "nodes": [
    {
      "id": "3ea07cde-120c-4e53-a4ab-150bbe9d3f3d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        280,
        -300
      ],
      "parameters": {
        "width": 440,
        "height": 300,
        "content": "## Adapt this template to your needs \n1. Instead of using a cron that runs every hour, use Notion webhooks to retrigger the automation when a new comment is added (and run it only on the pages that re"
      }
    },
    {
      "id": "1669e388-fc92-4290-86a6-af565fd16cc7",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1860,
        -260
      ]
    },
    {
      "id": "26177b80-b908-408d-9adc-be87d60625d0",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        -300
      ],
      "parameters": {
        "width": 200,
        "height": 240,
        "content": "## Step 1\nDefine your variables: \n* ID of the database\n* Name of the property that will contain the AI summary (type text)\n* Name of the property that can store the last execution date (type date)"
      }
    },
    {
      "id": "383071b8-d174-423d-8bfc-eff9c431c551",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        -300
      ],
      "parameters": {
        "width": 180,
        "height": 220,
        "content": "## Step 2\nSet your Notion credentials. \n\nYou'll need a Notion internal integration.\n\nhttps://www.notion.so/profile/integrations"
      }
    },
    {
      "id": "704f0a7e-e9c3-4109-854b-49341f4b218f",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1420,
        -300
      ],
      "parameters": {
        "width": 180,
        "height": null,
        "content": "## Step 3\nSet your Notion credentials. \n\nRe-use the credentials created in Step 2\n"
      }
    },
    {
      "id": "d6c30d1b-eea3-46fd-a96c-0b9f9d0b57e2",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1820,
        -100
      ],
      "parameters": {
        "width": 180,
        "height": 140,
        "content": "## Step 4\nSet your API key. You can use the LLM of your choice (e.g. OpenAI, Claude, etc.)."
      }
    },
    {
      "id": "96749f98-914f-4317-ae47-fb4d7bb12d41",
      "name": "Run every hour",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        800,
        -480
      ]
    },
    {
      "id": "fc95f0f5-80b1-4e36-9004-d188d15eec4a",
      "name": "Define your Notion Database",
      "type": "n8n-nodes-base.set",
      "position": [
        1000,
        -480
      ]
    },
    {
      "id": "45a590dc-ccf0-4497-87e3-e257f5ce9279",
      "name": "List database pages",
      "type": "n8n-nodes-base.notion",
      "position": [
        1220,
        -480
      ]
    },
    {
      "id": "95959678-6a03-454f-beba-ac622f42f293",
      "name": "List comments",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1440,
        -480
      ]
    },
    {
      "id": "25a54b62-0b18-4012-880f-1c6ce05386fb",
      "name": "Only keep pages that received new comments since last execution",
      "type": "n8n-nodes-base.filter",
      "position": [
        1640,
        -480
      ]
    },
    {
      "id": "5b7a56df-590f-4c4b-a912-086ec4cddce6",
      "name": "Summarize conversation",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1880,
        -480
      ]
    },
    {
      "id": "5351ddd9-b900-4646-9fa4-03529a73dba7",
      "name": "Add summary to Notion page and update last execution date",
      "type": "n8n-nodes-base.notion",
      "position": [
        2260,
        -480
      ]
    },
    {
      "id": "04e9194e-adc5-4f3f-9b20-bec0be48304b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        280,
        -620
      ],
      "parameters": {
        "width": 440,
        "height": 300,
        "content": "## Generate an AI summary of your Notion comments\n\nThis automation reads the comments of your Notion pages and ask the AI to provide a summary of the conversation.\n\n![AI Summary of the comments](https"
      }
    },
    {
      "id": "c67a2e06-14ef-414c-b4b6-1d04ee4ed43e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1880,
        -580
      ],
      "parameters": {
        "width": null,
        "height": 80,
        "content": "**Tip**\nAdapt the prompt to your use case for better results."
      }
    }
  ],
  "connections": {
    "List comments": {
      "main": [
        [
          {
            "node": "Only keep pages that received new comments since last execution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run every hour": {
      "main": [
        [
          {
            "node": "Define your Notion Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List database pages": {
      "main": [
        [
          {
            "node": "List comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize conversation": {
      "main": [
        [
          {
            "node": "Add summary to Notion page and update last execution date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Summarize conversation",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Define your Notion Database": {
      "main": [
        [
          {
            "node": "List database pages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only keep pages that received new comments since last execution": {
      "main": [
        [
          {
            "node": "Summarize conversation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}