{
  "name": "Build a private Llama chatbot with Ollama, Groq, Slack and Google Sheets",
  "nodes": [
    {
      "id": "65ccc159-b599-4990-8de4-bcec058d7f0a",
      "name": "Main Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        0
      ],
      "parameters": {
        "width": 1520,
        "height": 1332,
        "content": "# n8n Llama AI Workflow\n## Build a Private AI Chatbot Automation\n\n---\n\n### Description\nThis workflow builds a fully private, self-hosted AI chatbot using Meta Llama models. Unlike cloud-based AI APIs,"
      }
    },
    {
      "id": "c310d003-caf5-429a-b1c5-b6caabf8f795",
      "name": "Stage AB Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        384
      ],
      "parameters": {
        "width": 400,
        "height": 418,
        "content": "### Stage A+B — Intake & Memory\n\nSession memory is built from a static store keyed by sessionId. Each call appends the new user message and returns the last 10 turns as the context window for Llama. N"
      }
    },
    {
      "id": "fdb8535a-020d-4d9c-ad06-13168bc9a975",
      "name": "Stage CD Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        336
      ],
      "parameters": {
        "width": 384,
        "height": 514,
        "content": "### Stage C+D — Route & Infer\n\nCode node selects the system prompt for the detected intent (support / sales / general / escalate). Single HTTP Request covers Ollama, Groq, and Together AI using the Op"
      }
    },
    {
      "id": "feb698fe-8136-4aa7-813e-234c8c398d13",
      "name": "Stage EF Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1936,
        240
      ],
      "parameters": {
        "width": 848,
        "height": 706,
        "content": "### Stage E+F — Parse, Log & Deliver\n\nParse node updates session memory and checks for escalation signals. Sheets logs every turn for compliance and training data. Slack fires only when escalation is "
      }
    },
    {
      "id": "3c7ef5e1-4e69-426f-967c-a5649ee2f480",
      "name": "Receive Chat Message",
      "type": "n8n-nodes-base.webhook",
      "position": [
        1072,
        632
      ]
    },
    {
      "id": "1dd5c1e5-8f6e-4cf7-8037-5ea638b4ce4b",
      "name": "Set Llama Config",
      "type": "n8n-nodes-base.set",
      "position": [
        1296,
        632
      ]
    },
    {
      "id": "ee18f566-5261-4687-a39f-8fbea8820338",
      "name": "Load Memory and Build Request",
      "type": "n8n-nodes-base.code",
      "position": [
        1520,
        632
      ]
    },
    {
      "id": "b62d5dbc-e835-4a18-b2c5-89fbc27b7f7b",
      "name": "Call Llama Model",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1744,
        632
      ]
    },
    {
      "id": "d633c9b0-fe9f-4d73-b0a7-f9ae089d24b8",
      "name": "Parse Reply and Update Memory",
      "type": "n8n-nodes-base.code",
      "position": [
        1968,
        632
      ]
    },
    {
      "id": "6ac4ebd6-a9bd-4fd9-b900-f4a4ea2991b1",
      "name": "Log Conversation Turn",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2416,
        464
      ]
    },
    {
      "id": "55941710-398b-44d4-976b-0052588192da",
      "name": "Check Escalation Flag",
      "type": "n8n-nodes-base.if",
      "position": [
        2192,
        728
      ]
    },
    {
      "id": "d84345d3-f85e-4732-ab73-b76f704f7fad",
      "name": "Alert Slack Escalation",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2416,
        656
      ]
    },
    {
      "id": "a0b2dadd-71c6-426c-9aa7-2048cc02c7c6",
      "name": "Send Chatbot Reply",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2640,
        656
      ]
    }
  ],
  "connections": {
    "Call Llama Model": {
      "main": [
        [
          {
            "node": "Parse Reply and Update Memory",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Llama Config": {
      "main": [
        [
          {
            "node": "Load Memory and Build Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Chat Message": {
      "main": [
        [
          {
            "node": "Set Llama Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Escalation Flag": {
      "main": [
        [
          {
            "node": "Alert Slack Escalation",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Chatbot Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Conversation Turn": {
      "main": [
        [
          {
            "node": "Send Chatbot Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert Slack Escalation": {
      "main": [
        [
          {
            "node": "Send Chatbot Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load Memory and Build Request": {
      "main": [
        [
          {
            "node": "Call Llama Model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Reply and Update Memory": {
      "main": [
        [
          {
            "node": "Log Conversation Turn",
            "type": "main",
            "index": 0
          },
          {
            "node": "Check Escalation Flag",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}