{
  "name": "NewsHub \u2014 Chatbot Webhook",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "chatbot",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -600,
        0
      ],
      "id": "webhook-chatbot",
      "name": "Chatbot Webhook"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.body.message }}",
        "messages": {
          "messageValues": [
            {
              "message": "You are NewsBot, an intelligent AI news assistant for NewsHub \u2014 a premium dark-themed news website. You help users understand and explore news across: Cybersecurity, AI, Finance, Stock Markets, Health, and Technology.\n\nThe user is currently browsing the '{{ $json.body.category || 'general' }}' category.\n\nYour role:\n- Summarize and explain news articles in simple, engaging language\n- Provide context and deeper insights on news topics\n- Answer questions about recent events confidently\n- Be concise (2-4 sentences max per response)\n- Use emojis where appropriate to make responses lively\n- If asked about something outside news, gently redirect to news topics\n\nUser message: {{ $json.body.message }}\n\nRespond naturally and helpfully. Return ONLY a JSON object: { \"reply\": \"your response text here\" }"
            }
          ]
        },
        "batching": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.9,
      "position": [
        -240,
        0
      ],
      "id": "chatbot-gemini-chain",
      "name": "NewsBot Chain"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        -170,
        220
      ],
      "id": "chatbot-gemini",
      "name": "Gemini",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json.text }}",
        "options": {
          "responseHeaders": {
            "entries": [
              {
                "name": "Access-Control-Allow-Origin",
                "value": "*"
              },
              {
                "name": "Content-Type",
                "value": "application/json"
              }
            ]
          }
        }
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        120,
        0
      ],
      "id": "respond-chatbot",
      "name": "Respond to Chatbot"
    }
  ],
  "connections": {
    "Chatbot Webhook": {
      "main": [
        [
          {
            "node": "NewsBot Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NewsBot Chain": {
      "main": [
        [
          {
            "node": "Respond to Chatbot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini": {
      "ai_languageModel": [
        [
          {
            "node": "NewsBot Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "timezone": "Asia/Kolkata"
  },
  "tags": [
    "newshub",
    "chatbot",
    "gemini"
  ]
}