{
  "name": "Convert LLM output into rich Telegram messages — Auto-Media & smart chunking",
  "nodes": [
    {
      "id": "a25428d1-d34c-42f4-9a1a-713bef6dc1e9",
      "name": "Send back an image",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -480,
        720
      ]
    },
    {
      "id": "052643fa-6319-43f3-a052-40ed0e255238",
      "name": "Send back an audio",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -260,
        720
      ]
    },
    {
      "id": "73dfb105-5ffe-4f8a-b96e-b0b556d73956",
      "name": "Send back a video",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -60,
        720
      ]
    },
    {
      "id": "e715f898-1bca-4e4e-a463-f30815664766",
      "name": "Send Text",
      "type": "n8n-nodes-base.telegram",
      "position": [
        140,
        220
      ]
    },
    {
      "id": "38f15fa8-f9a2-469b-9f30-fed46296bf1f",
      "name": "If text too long",
      "type": "n8n-nodes-base.if",
      "position": [
        -140,
        60
      ]
    },
    {
      "id": "286d11cb-f94a-4143-8a27-34b5f4e14192",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -960,
        -100
      ]
    },
    {
      "id": "dab1fb0c-970e-43f7-a335-c48639edaabe",
      "name": "Loop Over Links",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -580,
        220
      ]
    },
    {
      "id": "a1f73d92-b61e-41fa-a0c7-50e72078e096",
      "name": "If no links",
      "type": "n8n-nodes-base.if",
      "position": [
        -520,
        -100
      ]
    },
    {
      "id": "bd57fe5e-940b-46f9-a76f-ba4d6bae5c7c",
      "name": "Split Out the Links",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -800,
        220
      ]
    },
    {
      "id": "8e14c1e6-ece0-4310-97c2-829a37074706",
      "name": "Split large text by chunks",
      "type": "n8n-nodes-base.code",
      "position": [
        140,
        -120
      ]
    },
    {
      "id": "b08e8087-f155-4747-a5d8-8c9bb5511777",
      "name": "Split Out the Chunks",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        360,
        -120
      ]
    },
    {
      "id": "94b015d0-a1b7-4e13-973a-5a25fe88c209",
      "name": "Loop Over Text Chunks",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        560,
        -120
      ]
    },
    {
      "id": "51f2598e-4958-4139-ab00-3836b7a52ed5",
      "name": "Send Text Chunk",
      "type": "n8n-nodes-base.telegram",
      "position": [
        800,
        -120
      ]
    },
    {
      "id": "d7baaaff-a918-487d-970a-d2ef498504b3",
      "name": "Limit",
      "type": "n8n-nodes-base.limit",
      "position": [
        -380,
        220
      ]
    },
    {
      "id": "5f724698-027f-4e88-8329-1abd00f8e6c7",
      "name": "Extract Links",
      "type": "n8n-nodes-base.code",
      "position": [
        -740,
        -100
      ]
    },
    {
      "id": "45e41a01-68a2-4b64-8830-e05916170a97",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        420
      ],
      "parameters": {
        "width": 660,
        "height": 480,
        "content": "## Send links\nSend links to chat as separate messages \nwith appropriate type (image, audio, video)"
      }
    },
    {
      "id": "bbeb6619-4a48-40f5-be75-e99e0c53462e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -220
      ],
      "parameters": {
        "width": 900,
        "height": 300,
        "content": "## Send a long message\nSeparate long message by chunks and send them one by one"
      }
    },
    {
      "id": "4dbf96c8-fb30-4c22-8fc9-c551cb9893c6",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        120
      ],
      "parameters": {
        "width": 300,
        "height": 260,
        "content": "## Send a short message\nDeliver a short message (default flow)"
      }
    },
    {
      "id": "e13e63e9-331e-458b-8933-4ec608eab00a",
      "name": "Check Link Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        -60,
        480
      ]
    }
  ],
  "connections": {
    "Limit": {
      "main": [
        [
          {
            "node": "If text too long",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If no links": {
      "main": [
        [
          {
            "node": "If text too long",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Split Out the Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Links": {
      "main": [
        [
          {
            "node": "If no links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Link Type": {
      "main": [
        [
          {
            "node": "Send back an image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send back an audio",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send back a video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Links": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check Link Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Text Chunk": {
      "main": [
        [
          {
            "node": "Loop Over Text Chunks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If text too long": {
      "main": [
        [
          {
            "node": "Split large text by chunks",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send back a video": {
      "main": [
        [
          {
            "node": "Loop Over Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send back an audio": {
      "main": [
        [
          {
            "node": "Loop Over Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send back an image": {
      "main": [
        [
          {
            "node": "Loop Over Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out the Links": {
      "main": [
        [
          {
            "node": "Loop Over Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out the Chunks": {
      "main": [
        [
          {
            "node": "Loop Over Text Chunks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Text Chunks": {
      "main": [
        [],
        [
          {
            "node": "Send Text Chunk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split large text by chunks": {
      "main": [
        [
          {
            "node": "Split Out the Chunks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Extract Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}