{
  "name": "Publish LinkedIn & X posts with Telegram Bot, Gemini AI & Vector Memory",
  "nodes": [
    {
      "id": "92461be1-8166-4e3c-b40a-beb2ceb4924a",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -112,
        32
      ]
    },
    {
      "id": "bbe5809f-e74f-4c15-8628-92a35d9bb189",
      "name": "Set input context",
      "type": "n8n-nodes-base.set",
      "position": [
        160,
        32
      ]
    },
    {
      "id": "9281e1e8-c019-4479-bedb-37e3e6d72a39",
      "name": "Text prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        1440,
        -256
      ]
    },
    {
      "id": "3f470d9f-755a-4aaf-9573-f14162517de6",
      "name": "Document prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        1440,
        -64
      ]
    },
    {
      "id": "86552b5d-5ff6-4cb8-afbc-8765a4bd6c17",
      "name": "Describe audio",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        128
      ]
    },
    {
      "id": "7f1ff2b5-1117-46aa-846b-f2971fe4dd1d",
      "name": "Audio prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        1440,
        128
      ]
    },
    {
      "id": "36e799c4-84ce-48e8-85ba-50f69d6f7062",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2144,
        -64
      ]
    },
    {
      "id": "833e1b25-b348-4cca-b4b7-c8661e97cf57",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1664,
        160
      ]
    },
    {
      "id": "3b96b10d-ce34-454f-b6fb-6a0e41724a79",
      "name": "Embeddings Google Gemini",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        1904,
        416
      ]
    },
    {
      "id": "fa334f34-fa5f-45f4-bb08-69db605d4d40",
      "name": "Send response",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3280,
        -64
      ]
    },
    {
      "id": "53e4a542-3608-416e-8703-1344f1485d5d",
      "name": "Create X (Twitter) post",
      "type": "n8n-nodes-base.twitterTool",
      "position": [
        2512,
        448
      ]
    },
    {
      "id": "4226e081-af3f-42ea-ba06-caef96e9448a",
      "name": "Chat Memory Manager",
      "type": "@n8n/n8n-nodes-langchain.memoryManager",
      "position": [
        832,
        320
      ]
    },
    {
      "id": "6b7a925f-c111-4b4f-b1d5-2fcd3d9ae3ac",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        608,
        416
      ]
    },
    {
      "id": "3b056078-970e-4907-87df-9d3c6f5b5cbf",
      "name": "Error",
      "type": "n8n-nodes-base.telegram",
      "position": [
        928,
        512
      ]
    },
    {
      "id": "d58fd416-cfb1-48b9-86cf-de6e5ca9c571",
      "name": "Success",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1232,
        320
      ]
    },
    {
      "id": "9b86684f-9018-4c48-b09f-4d9d6895731b",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1792,
        160
      ]
    },
    {
      "id": "a92792e9-a558-47a9-977d-16d57f47e160",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        3056,
        -64
      ]
    },
    {
      "id": "2c253f28-1cc6-49f9-85b2-4b4f80979670",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -176,
        -192
      ],
      "parameters": {
        "width": 224,
        "height": 416,
        "content": "## Bot entrance\n\nSet your Telegram bot credentials here.\n\nOptional: add \"Restrict to chat IDs\" with your chat ID so that only you can use your bot"
      }
    },
    {
      "id": "6b879d47-c143-41cf-91d1-f7fb86cb4253",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        -192
      ],
      "parameters": {
        "width": 224,
        "height": 416,
        "content": "## Request preprocessing\n\nSetting fields from the request to a more convinient format"
      }
    },
    {
      "id": "3aea91ae-f5b7-4107-baa4-cab71e530ea5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        -288
      ],
      "parameters": {
        "width": 624,
        "height": 576,
        "content": "## Extracting data from non-text input\n\nSet up \"Describe PDF\" and \"Describe audio\" nodes with Google's AI Studio API key\n\nSet up \"Download document\" and \"Download audio\" with Telegram Bot API key"
      }
    },
    {
      "id": "dd2efbf5-9ba0-4f45-b3ae-8d38ce112d5c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        -400
      ],
      "parameters": {
        "width": 384,
        "height": 496,
        "content": "## AI Agent Node\n\n**Needs setup**\n\nAdd your Google's AI Studio API key to the \"Model\" node\n\nHere the agent receives the user's input and decides what to do it response:\n- Ask for clarification\n- Prepa"
      }
    },
    {
      "id": "ce006594-4ad4-4bda-86d3-e2ffb6bc919b",
      "name": "Split agent's response",
      "type": "n8n-nodes-base.code",
      "position": [
        2832,
        -64
      ]
    },
    {
      "id": "5243247e-0d99-49f0-95b9-9b338b839053",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2768,
        -208
      ],
      "parameters": {
        "width": 720,
        "height": 320,
        "content": "## Response to the user\nHere we optionally split the agent's response into multiple messages not to get \"Message too long\" error from Telegram"
      }
    },
    {
      "id": "a41942b8-88d9-4fb9-a70a-2b9b23ba1619",
      "name": "Input type switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        384,
        -16
      ]
    },
    {
      "id": "9a790d0b-62fb-47c0-8670-2d33433140f9",
      "name": "Encode document",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        928,
        -64
      ]
    },
    {
      "id": "51e25ea9-1463-44f3-a2ce-8b1a89ada8b2",
      "name": "Encode audio",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        928,
        128
      ]
    },
    {
      "id": "a2fee96e-5619-44ed-afd6-a0cd84c86bcb",
      "name": "Describe document",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        -64
      ]
    },
    {
      "id": "117dda5b-cad8-4f5e-8694-12d21719528d",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2688,
        208
      ],
      "parameters": {
        "width": 368,
        "height": 400,
        "content": "## LinkedIn Tools\n\n- Input your organisation URN in the \"Create post in LinkedIn as a company\" node\n- Select your user name in LinkedIn in the \"Create a post in LinkedIn as a person\" "
      }
    },
    {
      "id": "4f0ea1ad-15c5-4693-9afa-03dab4044aae",
      "name": "Create post in LinkedIn as a company",
      "type": "n8n-nodes-base.linkedInTool",
      "position": [
        2912,
        448
      ]
    },
    {
      "id": "3ccbae0c-ff7a-4ec5-8dbe-6dc23560412e",
      "name": "Create post in LinkedIn as a person",
      "type": "n8n-nodes-base.linkedInTool",
      "position": [
        2752,
        448
      ]
    },
    {
      "id": "fde65067-e098-4645-9c4a-d91cc3b6c669",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        -416
      ],
      "parameters": {
        "width": 624,
        "height": 896,
        "content": "## Your personal AI SMM manager inside Telegram bot \n\nThis is a Telegram Bot capable of receiving info from the user in the format of text messages, voice messages or documents (i.e. presentations) an"
      }
    },
    {
      "id": "97d54d2a-c724-4c2e-b332-e04adce6fb27",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        496
      ],
      "parameters": {
        "width": 624,
        "height": 80,
        "content": "**Notes of this color describe information that need's to be set before launching the template - please take a look!**"
      }
    },
    {
      "id": "abe22327-c5b1-40f8-8933-f850f9673b8c",
      "name": "Retrieve knowledge",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        1920,
        160
      ]
    },
    {
      "id": "390ea20a-8097-4bfe-97fc-adf1b4fdb5c9",
      "name": "Save knowledge",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        2240,
        160
      ]
    },
    {
      "id": "8372b8b0-c751-4623-8952-552019461fe0",
      "name": "Download audio",
      "type": "n8n-nodes-base.telegram",
      "position": [
        720,
        128
      ]
    },
    {
      "id": "78db4c04-44d5-4f21-860d-2dc7d556b553",
      "name": "Download document",
      "type": "n8n-nodes-base.telegram",
      "position": [
        720,
        -64
      ]
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Chat Memory Manager",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Split agent's response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Send response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text prompt": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audio prompt": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Encode audio": {
      "main": [
        [
          {
            "node": "Describe audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          },
          {
            "node": "Chat Memory Manager",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Describe audio": {
      "main": [
        [
          {
            "node": "Audio prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download audio": {
      "main": [
        [
          {
            "node": "Encode audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save knowledge": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Document prompt": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Encode document": {
      "main": [
        [
          {
            "node": "Describe document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Set input context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Describe document": {
      "main": [
        [
          {
            "node": "Document prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download document": {
      "main": [
        [
          {
            "node": "Encode document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Input type switch": {
      "main": [
        [
          {
            "node": "Text prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download document",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download audio",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set input context": {
      "main": [
        [
          {
            "node": "Input type switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve knowledge": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Chat Memory Manager": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split agent's response": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create X (Twitter) post": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini": {
      "ai_embedding": [
        [
          {
            "node": "Retrieve knowledge",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create post in LinkedIn as a person": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create post in LinkedIn as a company": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}