{
  "openruna_format": "flow-graph-v1",
  "title": "Telegram ChatBot with multiple sessions",
  "slug": "telegram-chatbot-with-multiple-sessions",
  "source_filename": "1244_Telegram_GoogleSheets_Automate_Triggered.json",
  "nodes": [
    {
      "id": "OpenAI Chat Model",
      "name": "OpenAI Chat Model",
      "integration": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "kind": "action"
    },
    {
      "id": "Simple Memory",
      "name": "Simple Memory",
      "integration": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "kind": "action"
    },
    {
      "id": "Get message",
      "name": "Get message",
      "integration": "telegram",
      "kind": "trigger"
    },
    {
      "id": "Command or text?",
      "name": "Command or text?",
      "integration": "switch",
      "kind": "logic"
    },
    {
      "id": "Get session",
      "name": "Get session",
      "integration": "googleSheets",
      "kind": "action"
    },
    {
      "id": "Disable previous session",
      "name": "Disable previous session",
      "integration": "googleSheets",
      "kind": "action"
    },
    {
      "id": "Set new session",
      "name": "Set new session",
      "integration": "googleSheets",
      "kind": "action"
    },
    {
      "id": "Session activated",
      "name": "Session activated",
      "integration": "telegram",
      "kind": "action"
    },
    {
      "id": "Send response",
      "name": "Send response",
      "integration": "telegram",
      "kind": "action"
    },
    {
      "id": "Update database",
      "name": "Update database",
      "integration": "googleSheets",
      "kind": "action"
    },
    {
      "id": "Summarization Chain",
      "name": "Summarization Chain",
      "integration": "@n8n/n8n-nodes-langchain.chainSummarization",
      "kind": "action"
    },
    {
      "id": "OpenAI Chat Model1",
      "name": "OpenAI Chat Model1",
      "integration": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "kind": "action"
    },
    {
      "id": "OpenAI Chat Model2",
      "name": "OpenAI Chat Model2",
      "integration": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "kind": "action"
    },
    {
      "id": "Basic LLM Chain",
      "name": "Basic LLM Chain",
      "integration": "@n8n/n8n-nodes-langchain.chainLlm",
      "kind": "action"
    },
    {
      "id": "Get message1",
      "name": "Get message1",
      "integration": "set",
      "kind": "logic"
    },
    {
      "id": "Set to expire",
      "name": "Set to expire",
      "integration": "googleSheets",
      "kind": "action"
    },
    {
      "id": "Exist?",
      "name": "Exist?",
      "integration": "if",
      "kind": "logic"
    },
    {
      "id": "OK",
      "name": "OK",
      "integration": "telegram",
      "kind": "action"
    },
    {
      "id": "KO",
      "name": "KO",
      "integration": "telegram",
      "kind": "action"
    },
    {
      "id": "Trim resume",
      "name": "Trim resume",
      "integration": "code",
      "kind": "logic"
    },
    {
      "id": "Get session1",
      "name": "Get session1",
      "integration": "googleSheets",
      "kind": "action"
    },
    {
      "id": "Prompt + Resume",
      "name": "Prompt + Resume",
      "integration": "code",
      "kind": "logic"
    },
    {
      "id": "Send summary",
      "name": "Send summary",
      "integration": "telegram",
      "kind": "action"
    },
    {
      "id": "Get message2",
      "name": "Get message2",
      "integration": "set",
      "kind": "logic"
    },
    {
      "id": "Trim question",
      "name": "Trim question",
      "integration": "code",
      "kind": "logic"
    },
    {
      "id": "Set new current session",
      "name": "Set new current session",
      "integration": "googleSheets",
      "kind": "action"
    },
    {
      "id": "Response + Text",
      "name": "Response + Text",
      "integration": "googleSheets",
      "kind": "action"
    },
    {
      "id": "fullText",
      "name": "fullText",
      "integration": "code",
      "kind": "logic"
    },
    {
      "id": "Send answer",
      "name": "Send answer",
      "integration": "telegram",
      "kind": "action"
    },
    {
      "id": "Send current session",
      "name": "Send current session",
      "integration": "telegram",
      "kind": "action"
    },
    {
      "id": "Telegram Chatbot",
      "name": "Telegram Chatbot",
      "integration": "@n8n/n8n-nodes-langchain.agent",
      "kind": "action"
    }
  ],
  "edges": [
    {
      "from": "Exist?",
      "to": "KO"
    },
    {
      "from": "Exist?",
      "to": "OK"
    },
    {
      "from": "fullText",
      "to": "Basic LLM Chain"
    },
    {
      "from": "Get message",
      "to": "Get session"
    },
    {
      "from": "Get session",
      "to": "Command or text?"
    },
    {
      "from": "Trim resume",
      "to": "Set to expire"
    },
    {
      "from": "Get message1",
      "to": "Trim resume"
    },
    {
      "from": "Get message2",
      "to": "Trim question"
    },
    {
      "from": "Get session1",
      "to": "Prompt + Resume"
    },
    {
      "from": "Send response",
      "to": "Update database"
    },
    {
      "from": "Set to expire",
      "to": "Set new current session"
    },
    {
      "from": "Trim question",
      "to": "Response + Text"
    },
    {
      "from": "Basic LLM Chain",
      "to": "Send answer"
    },
    {
      "from": "Prompt + Resume",
      "to": "Summarization Chain"
    },
    {
      "from": "Response + Text",
      "to": "fullText"
    },
    {
      "from": "Set new session",
      "to": "Session activated"
    },
    {
      "from": "Command or text?",
      "to": "Disable previous session"
    },
    {
      "from": "Command or text?",
      "to": "Send current session"
    },
    {
      "from": "Command or text?",
      "to": "Get message1"
    },
    {
      "from": "Command or text?",
      "to": "Get session1"
    },
    {
      "from": "Command or text?",
      "to": "Get message2"
    },
    {
      "from": "Command or text?",
      "to": "Telegram Chatbot"
    },
    {
      "from": "Telegram Chatbot",
      "to": "Send response"
    },
    {
      "from": "Summarization Chain",
      "to": "Send summary"
    },
    {
      "from": "Set new current session",
      "to": "Exist?"
    },
    {
      "from": "Disable previous session",
      "to": "Set new session"
    }
  ]
}