{
  "name": "AI prompt hub (Notion + ChatGPT): auto-find the right prompt with embeddings",
  "nodes": [
    {
      "id": "31d202b9-3206-4fd4-869a-47b408d8d553",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -880,
        -64
      ]
    },
    {
      "id": "09af7356-eaaa-4677-bc78-c84732b8b850",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -672,
        -64
      ]
    },
    {
      "id": "4bb56284-f730-4775-9df1-814d01ec5cb6",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -720,
        176
      ]
    },
    {
      "id": "5ef42413-4cb1-4d93-961d-06142a1544e2",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -544,
        160
      ]
    },
    {
      "id": "77e12cfa-11ea-43c4-bf1f-9fb38e2ae9b3",
      "name": "Embeddings - Sync All",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -768,
        -528
      ]
    },
    {
      "id": "3cafdcd4-dd94-461b-84ef-6788b274c668",
      "name": "Get All Prompts",
      "type": "n8n-nodes-base.notion",
      "position": [
        -560,
        -528
      ]
    },
    {
      "id": "fa62aebc-4476-46a1-9c7a-4c4d44750b89",
      "name": "Get Embeddings",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        96,
        -544
      ]
    },
    {
      "id": "7f020592-eba0-4107-a27b-8830e3562105",
      "name": "Prepare Update Body",
      "type": "n8n-nodes-base.code",
      "position": [
        304,
        -544
      ]
    },
    {
      "id": "6d775127-8212-4079-be91-60d0d0b6a0f9",
      "name": "On Page Update",
      "type": "n8n-nodes-base.notionTrigger",
      "position": [
        -656,
        -784
      ]
    },
    {
      "id": "7fa97628-2853-4bac-b193-51819c0e97db",
      "name": "On Page Create",
      "type": "n8n-nodes-base.notionTrigger",
      "position": [
        -656,
        -944
      ]
    },
    {
      "id": "9fe7af39-24e0-46e2-8e06-32d6ec765136",
      "name": "Get Question Embeddings",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        -80
      ]
    },
    {
      "id": "e16a874f-99a8-4e5a-b3a9-3b806bfda39e",
      "name": "Get All Prompts for search",
      "type": "n8n-nodes-base.notion",
      "position": [
        432,
        -80
      ]
    },
    {
      "id": "f680bab1-c3d3-42c4-8b9b-8ef29b2d6491",
      "name": "Find a prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        640,
        -80
      ]
    },
    {
      "id": "3b50f4e8-00f7-42d1-a0fd-f76899fbb79f",
      "name": "Search a Prompt",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -336,
        176
      ]
    },
    {
      "id": "c8f713ce-bbfe-44c1-937d-a1651ac46a9d",
      "name": "Generate Checksum",
      "type": "n8n-nodes-base.code",
      "position": [
        -352,
        -528
      ]
    },
    {
      "id": "75f0ccd1-800c-4709-9adf-6e16e02ecf5f",
      "name": "If Embeddings Update Needed",
      "type": "n8n-nodes-base.if",
      "position": [
        -144,
        -528
      ]
    },
    {
      "id": "effc4289-47f9-47b2-b3a3-480d7ca41dc5",
      "name": "Save Embeddings + Checksum",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        512,
        -544
      ]
    },
    {
      "id": "ce3bee4e-de94-474c-a24e-fe667df78df3",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -944,
        -256
      ],
      "parameters": {
        "width": 752,
        "height": 576,
        "content": "## Chat Interface\n\nChatGPT interface that searches for prompts on each message. If found, suggests the prompt; otherwise responds normally."
      }
    },
    {
      "id": "f9287e40-ea76-49ae-a317-d54cf25b2591",
      "name": "Search Entrypoint",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        0,
        -80
      ]
    },
    {
      "id": "41f956b6-0687-4010-ad71-9c63d8f9a2fd",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -240
      ],
      "parameters": {
        "width": 1008,
        "height": 368,
        "content": "## Prompt Finder\n\nSearches Notion prompts using semantic similarity. Compares user message embeddings with saved prompt embeddings."
      }
    },
    {
      "id": "83d02c0f-4100-4412-be5e-ea194554bd3b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1744,
        -1104
      ],
      "parameters": {
        "width": 736,
        "height": 672,
        "content": "# GPT-Integrated Prompt Hub\n\n## How it works\n\nThis workflow automatically searches your saved prompts in Notion when you chat with ChatGPT. When you send any message, the AI agent first searches your "
      }
    },
    {
      "id": "0d39103e-eb6a-4a33-aca6-9c7f6351bd6f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -944,
        -1104
      ],
      "parameters": {
        "width": 1680,
        "height": 752,
        "content": "## Embeddings Generator\n\nGenerates embeddings for new/updated prompts. Triggers: Notion page create/update or manual sync webhook to update all prompts' embeddings."
      }
    }
  ],
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Get Embeddings": {
      "main": [
        [
          {
            "node": "Prepare Update Body",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On Page Create": {
      "main": [
        [
          {
            "node": "Generate Checksum",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On Page Update": {
      "main": [
        [
          {
            "node": "Generate Checksum",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get All Prompts": {
      "main": [
        [
          {
            "node": "Generate Checksum",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search a Prompt": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Generate Checksum": {
      "main": [
        [
          {
            "node": "If Embeddings Update Needed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Search Entrypoint": {
      "main": [
        [
          {
            "node": "Get Question Embeddings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Update Body": {
      "main": [
        [
          {
            "node": "Save Embeddings + Checksum",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings - Sync All": {
      "main": [
        [
          {
            "node": "Get All Prompts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Question Embeddings": {
      "main": [
        [
          {
            "node": "Get All Prompts for search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get All Prompts for search": {
      "main": [
        [
          {
            "node": "Find a prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Embeddings Update Needed": {
      "main": [
        [
          {
            "node": "Get Embeddings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}