{
  "name": "Simple Website Chatbot. A template by The Gridline Company",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "chatbot",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "webhook-001",
      "name": "Chat Message Received",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1.1,
      "position": [240, 300],
      "webhookId": "gridline-chatbot-webhook"
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "message",
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list"
        },
        "messages": {
          "values": [
            {
              "content": "You are a friendly assistant for [BUSINESS NAME]. Answer customer questions in a warm, conversational tone. If you don't know the answer, say so and offer to take their contact info so a real person can follow up.\n\nKey facts about the business:\n- Location: [CITY, STATE]\n- Hours: [BUSINESS HOURS]\n- Services: [LIST YOUR SERVICES]\n- Contact: [PHONE/EMAIL]\n\nKeep responses short (2-3 sentences max).",
              "role": "system"
            },
            {
              "content": "={{ $json.body.message }}",
              "role": "user"
            }
          ]
        },
        "options": {}
      },
      "id": "openai-002",
      "name": "Generate Response",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [460, 300],
      "credentials": {
        "openAiApi": {
          "id": "REPLACE_WITH_YOUR_OPENAI_CREDENTIAL_ID",
          "name": "OpenAI account"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { reply: $json.message.content, sessionId: $('Chat Message Received').item.json.body.sessionId } }}",
        "options": {}
      },
      "id": "respond-003",
      "name": "Send Reply Back",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [680, 300]
    }
  ],
  "connections": {
    "Chat Message Received": {
      "main": [
        [{ "node": "Generate Response", "type": "main", "index": 0 }]
      ]
    },
    "Generate Response": {
      "main": [
        [{ "node": "Send Reply Back", "type": "main", "index": 0 }]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "gridline-001",
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "gridline-company-templates"
  },
  "tags": [
    { "name": "Gridline Company", "id": "gridline" },
    { "name": "Chatbot", "id": "chatbot" }
  ]
}
