{
  "name": "Generate and manage short links with GPT-4.1 and data storage",
  "nodes": [
    {
      "id": "6c7043d8-e091-4e50-a661-f1047576c565",
      "name": "Insert row",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -16,
        -144
      ]
    },
    {
      "id": "310ecc62-f469-42d8-bb15-8795e0aef955",
      "name": "Generate shorlinkId",
      "type": "n8n-nodes-base.code",
      "position": [
        -240,
        -144
      ]
    },
    {
      "id": "1a615458-ea3c-4336-b9fd-602844b36f5d",
      "name": "Get row(s)",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -464,
        80
      ]
    },
    {
      "id": "2c2ace57-bb37-43b5-a606-122e38928bb2",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -688,
        -576
      ]
    },
    {
      "id": "af6bae57-7f02-4b14-b5a0-f4d852321a62",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -352,
        -576
      ]
    },
    {
      "id": "c10cdd53-ddaa-4701-922c-5788c3f41759",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -480,
        -368
      ]
    },
    {
      "id": "8d9e3709-0fb7-4fbc-9c1d-f3f74878e6bc",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -256,
        -368
      ]
    },
    {
      "id": "1e495a59-c48b-4887-a9c1-19c53072a591",
      "name": "GenerateShortLink",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -688,
        -144
      ]
    },
    {
      "id": "4e019563-fc6f-4ec7-b79e-1817cd35e411",
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "position": [
        -464,
        -144
      ]
    },
    {
      "id": "290c7c96-1cc9-432a-806e-6f2b04fe92a5",
      "name": "Generate ShortLink",
      "type": "n8n-nodes-base.code",
      "position": [
        208,
        -144
      ]
    },
    {
      "id": "1a2213c2-c423-49a0-a2b1-939109d30391",
      "name": "Call 'Create Short Link'",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -48,
        -368
      ]
    },
    {
      "id": "49807a5c-8c1a-4a6d-9e1b-b6d0ea72ff92",
      "name": "Page Redirect",
      "type": "n8n-nodes-base.html",
      "position": [
        -240,
        80
      ]
    },
    {
      "id": "d6732527-8565-4d7d-8bf5-77f02eba0462",
      "name": "Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -16,
        80
      ]
    },
    {
      "id": "866a4e41-ff4f-4eda-8be8-0e584285318b",
      "name": "ShortLink API",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -688,
        80
      ]
    },
    {
      "id": "ad474ea3-02bb-4770-88b0-8bba2c5ad859",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1120,
        -656
      ],
      "parameters": {
        "width": 336,
        "height": 896,
        "content": "## Setup Guide\n1. Add your_webhook_url to the 'Config' Node.\n2. Set up OpenAI account\n3. Create a database table named ShortLink with the following columns:\n- originalLink\n- shortLinkId\n"
      }
    },
    {
      "id": "4903952a-5da7-4bee-b945-550c0a636b7e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        -656
      ],
      "parameters": {
        "width": 1168,
        "height": 448,
        "content": "## Agent "
      }
    },
    {
      "id": "05b8c558-4503-45a9-8c5d-52809d60f0d6",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        -208
      ],
      "parameters": {
        "width": 1168,
        "height": 224,
        "content": "## Create Short Link"
      }
    },
    {
      "id": "5ba8e271-d542-42e9-8cab-fac08171c120",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        16
      ],
      "parameters": {
        "width": 1168,
        "height": 224,
        "content": "## Process Short Link Requests\n"
      }
    }
  ],
  "connections": {
    "Config": {
      "main": [
        [
          {
            "node": "Generate shorlinkId",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s)": {
      "main": [
        [
          {
            "node": "Page Redirect",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert row": {
      "main": [
        [
          {
            "node": "Generate ShortLink",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Page Redirect": {
      "main": [
        [
          {
            "node": "Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ShortLink API": {
      "main": [
        [
          {
            "node": "Get row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "GenerateShortLink": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Generate shorlinkId": {
      "main": [
        [
          {
            "node": "Insert row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call 'Create Short Link'": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}