{
  "name": "Build a Telegram AI assistant with MemMachine, OpenAI, and voice support",
  "nodes": [
    {
      "id": "3b741f12-c482-4cad-add1-d982b4bae2d9",
      "name": "📌 START HERE",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1264,
        1024
      ],
      "parameters": {
        "width": 516,
        "height": 664,
        "content": "## 🤖 Telegram assistant with memory\n\n**Author:** **David Olusola (@DaexAI)**\n\nAI assistant that remembers conversations across sessions using MemMachine.\n\n**Features:**\n✅ Persistent cross-session memo"
      }
    },
    {
      "id": "9b2a7af6-54ea-42bb-8eab-8022659b293b",
      "name": "Voice Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        1440
      ],
      "parameters": {
        "width": 540,
        "height": 180,
        "content": "**Voice path:** Download → Transcribe (Whisper) → Extract data"
      }
    },
    {
      "id": "dd33c807-8d40-4e4d-a895-79e78c7d6cc4",
      "name": "Text Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -176,
        1680
      ],
      "parameters": {
        "width": null,
        "height": 140,
        "content": "**Text path:** Extract message data"
      }
    },
    {
      "id": "5cfcad20-0260-43e2-b2c0-14a5869f1138",
      "name": "MemMachine Memory",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        1536
      ],
      "parameters": {
        "width": 560,
        "height": 200,
        "content": "**Memory system:** Store message → Search history (30 memories) → Sort chronologically"
      }
    },
    {
      "id": "673d48ec-9108-4fe1-8cb1-1ba4ff9114db",
      "name": "AI Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        1488
      ],
      "parameters": {
        "width": 280,
        "height": 388,
        "content": "**AI + Tools:** Process with context, access Gmail/Sheets/Calendar via MCP"
      }
    },
    {
      "id": "ffd7e526-7280-412e-81e5-540b820613a7",
      "name": "Response Flow",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1232,
        1536
      ],
      "parameters": {
        "width": 716,
        "height": 232,
        "content": "**Response:** Extract → Prepare → Store in memory → Send to Telegram"
      }
    },
    {
      "id": "4f2d4409-42ac-43b9-a18f-8560e5e808d3",
      "name": "MCP Architecture",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1120,
        992
      ],
      "parameters": {
        "width": 480,
        "height": 392,
        "content": "**MCP Server:** Exposes Gmail, Sheets, Calendar. **MCP Client:** Connects AI to tools"
      }
    },
    {
      "id": "e162b482-4c08-4f7e-a804-c6266e846218",
      "name": "Memory Example",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        1024
      ],
      "parameters": {
        "width": 420,
        "height": 400,
        "content": "## 🎯 Memory Example\n\n**Day 1:** \"Email john@co.com about Q1\"\n**Day 3:** \"What did I ask about John?\"\n**AI:** \"You asked me to email John about Q1 on Jan 5th\"\n\n**Day 7 (voice):** \"Follow up with John\"\n"
      }
    },
    {
      "id": "d20a1ce4-8ff8-4602-add3-f4349d7199e4",
      "name": "Quick Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        1024
      ],
      "parameters": {
        "width": 564,
        "height": 480,
        "content": "## 🚀 Quick Setup\n\n**1. Install MemMachine**\n```bash\ngit clone [https://github.com/MemMachine/MemMachine](https://github.com/MemMachine/MemMachine)\ncd MemMachine\ndocker-compose up -d\n```\n\n**2. Import &"
      }
    },
    {
      "id": "4394aac4-e55c-4d13-be11-975ce5573825",
      "name": "Customization",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        1024
      ],
      "parameters": {
        "width": 360,
        "height": 320,
        "content": "## 💡 Customization\n\n**Memory:** Increase top_k (node 5)\n**Tools:** Add Notion, Slack, Trello\n**Multi-channel:** WhatsApp, SMS, Web\n**AI:** Edit system prompt (node 7)\n**Advanced:** User preferences, a"
      }
    },
    {
      "id": "5cfd7a21-60e3-49de-8a27-cd2ca26cdb58",
      "name": "1. Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1040,
        1616
      ]
    },
    {
      "id": "d97b3cb4-9a24-4020-9019-91fc19616ce9",
      "name": "2. Message Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        -816,
        1616
      ]
    },
    {
      "id": "1eb5a7b4-92e9-41e1-951d-0f6cf2ffb053",
      "name": "3a. Download Voice",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -592,
        1520
      ]
    },
    {
      "id": "371ce3d2-18c8-481b-a9be-f92b789a4743",
      "name": "3b. Transcribe Voice",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -368,
        1520
      ]
    },
    {
      "id": "29e37fd3-95fc-4339-8d06-3dba2f8b924c",
      "name": "3c. Extract Voice Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -144,
        1520
      ]
    },
    {
      "id": "b86ed0d2-be45-432f-a22a-740bf3a67fd7",
      "name": "3d. Extract Text Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -144,
        1712
      ]
    },
    {
      "id": "8485263c-d446-479e-8d74-480574dea53b",
      "name": "Unifier",
      "type": "n8n-nodes-base.code",
      "position": [
        64,
        1616
      ]
    },
    {
      "id": "c189a91d-c337-4fe4-a3eb-d9c776b67f21",
      "name": "4. Store User Query",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        240,
        1616
      ]
    },
    {
      "id": "bd92e6bb-8794-49d9-8a76-076ebe2e68ee",
      "name": "5. Search Memory",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        432,
        1616
      ]
    },
    {
      "id": "8a7166f2-82c4-437e-aaed-0bf9a77955c7",
      "name": "6. Format Memory",
      "type": "n8n-nodes-base.code",
      "position": [
        608,
        1616
      ]
    },
    {
      "id": "96f443ba-e716-4d52-bc2b-b0b4b62a57b1",
      "name": "7. AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        800,
        1616
      ]
    },
    {
      "id": "a26d6d5b-9ecc-46a2-8bc4-8ca3944dba03",
      "name": "8. Extract Response",
      "type": "n8n-nodes-base.set",
      "position": [
        1056,
        1616
      ]
    },
    {
      "id": "774e5725-9817-4589-827d-133e3549eaec",
      "name": "8b. Prepare for Storage",
      "type": "n8n-nodes-base.code",
      "position": [
        1200,
        1616
      ]
    },
    {
      "id": "09cd456b-dcbb-41fd-b45d-96314e467397",
      "name": "9. Store AI Response",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1376,
        1616
      ]
    },
    {
      "id": "f2f482d5-e89b-4cae-a095-fc5d1db8fdcc",
      "name": "10. Send Response",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1568,
        1616
      ]
    },
    {
      "id": "23bddf97-05b1-4db7-89f8-afa93f7c6d0b",
      "name": "MCP Server Trigger",
      "type": "@n8n/n8n-nodes-langchain.mcpTrigger",
      "position": [
        1264,
        1040
      ]
    },
    {
      "id": "5489706c-c1a5-4320-b045-2f57bb6fde4e",
      "name": "Gmail Tool",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        1200,
        1248
      ]
    },
    {
      "id": "4cf74443-3727-4b9c-8ac8-94c2f3d4f4f3",
      "name": "Google Sheets Tool",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        1328,
        1248
      ]
    },
    {
      "id": "f4c07b00-1243-4dbe-a54b-e052edbdb9d5",
      "name": "Google Calendar Tool",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        1456,
        1232
      ]
    },
    {
      "id": "346e67fa-e6c0-4cd0-9ecc-cdf7df73d56f",
      "name": "MCP Client",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        896,
        1792
      ]
    },
    {
      "id": "a537219d-c0bb-4dda-949b-27987e8ae5d6",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        768,
        1792
      ]
    }
  ],
  "connections": {
    "Unifier": {
      "main": [
        [
          {
            "node": "4. Store User Query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Tool": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "MCP Client": {
      "ai_tool": [
        [
          {
            "node": "7. AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "7. AI Agent": {
      "main": [
        [
          {
            "node": "8. Extract Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2. Message Type": {
      "main": [
        [
          {
            "node": "3a. Download Voice",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "3d. Extract Text Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5. Search Memory": {
      "main": [
        [
          {
            "node": "6. Format Memory",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6. Format Memory": {
      "main": [
        [
          {
            "node": "7. AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "7. AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "3a. Download Voice": {
      "main": [
        [
          {
            "node": "3b. Transcribe Voice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Tool": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "1. Telegram Trigger": {
      "main": [
        [
          {
            "node": "2. Message Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4. Store User Query": {
      "main": [
        [
          {
            "node": "5. Search Memory",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8. Extract Response": {
      "main": [
        [
          {
            "node": "8b. Prepare for Storage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3b. Transcribe Voice": {
      "main": [
        [
          {
            "node": "3c. Extract Voice Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9. Store AI Response": {
      "main": [
        [
          {
            "node": "10. Send Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar Tool": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "3d. Extract Text Data": {
      "main": [
        [
          {
            "node": "Unifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3c. Extract Voice Data": {
      "main": [
        [
          {
            "node": "Unifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8b. Prepare for Storage": {
      "main": [
        [
          {
            "node": "9. Store AI Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}