{
  "id": "E2w7cqdpabvRwPoD",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Data Table for processing media groups in Telegram",
  "tags": [],
  "nodes": [
    {
      "id": "26aabebc-cec7-4849-a55f-062e1d146040",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -656,
        -112
      ],
      "parameters": {
        "updates": [
          "*"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4038e194-780e-419b-9461-718e166cea2d",
      "name": "Upsert row(s)",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -64,
        -128
      ],
      "parameters": {
        "columns": {
          "value": {
            "status": "new",
            "chat_id": "={{ $json.message.chat.id }}",
            "message": "={{ $json.message.toJsonString() }}",
            "message_id": "={{ $json.message.message_id }}",
            "media_group": "={{ $json.message.media_group_id }}"
          },
          "schema": [
            {
              "id": "chat_id",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "chat_id",
              "defaultMatch": false
            },
            {
              "id": "message_id",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "message_id",
              "defaultMatch": false
            },
            {
              "id": "media_group",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "media_group",
              "defaultMatch": false
            },
            {
              "id": "message",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "message",
              "defaultMatch": false
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "filters": {
          "conditions": [
            {
              "keyName": "chat_id",
              "keyValue": "={{ $json.message.chat.id }}"
            },
            {
              "keyName": "message_id",
              "keyValue": "={{ $json.message.message_id }}"
            }
          ]
        },
        "matchType": "allConditions",
        "operation": "upsert",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "MbWzAb6WjNiw6KFK",
          "cachedResultUrl": "/projects/dI4ucORffuUU6JJc/datatables/MbWzAb6WjNiw6KFK",
          "cachedResultName": "TG_mediagroup"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "23ee86ea-56a8-4966-bb05-88e72dc1f7c6",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -656,
        304
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "seconds",
              "secondsInterval": 5
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1a05fa32-86c9-43cd-8e1c-787bd4b8d190",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -656,
        480
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "fe0964b1-0e5c-4092-88fc-a139705fe438",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        144,
        656
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0d12392e-fb41-40ac-a595-6a414399839a",
              "operator": {
                "type": "dateTime",
                "operation": "before"
              },
              "leftValue": "={{ $json.max_createdAt }}",
              "rightValue": "={{ $now.minus(7,'seconds') }}"
            }
          ]
        }
      },
      "executeOnce": false,
      "typeVersion": 2.2
    },
    {
      "id": "9b3434cc-bbe8-4d3f-8b47-587a2dc53d6a",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        272,
        528
      ],
      "parameters": {
        "mode": "combine",
        "options": {
          "multipleMatches": "all"
        },
        "fieldsToMatchString": "media_group"
      },
      "typeVersion": 3.2
    },
    {
      "id": "f9e92f4d-7fb9-4134-b124-c2ecf59a42f5",
      "name": "Get a file",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1056,
        528
      ],
      "parameters": {
        "fileId": "={{ $json.message.photo[$json.message.photo.length-1].file_id }}",
        "download": false,
        "resource": "file"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cb7ea8cd-35d8-4d41-86d3-2cdc84228989",
      "name": "Is media group with images?",
      "type": "n8n-nodes-base.if",
      "position": [
        -416,
        -112
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "846cfde9-3bbc-4f11-818a-19a07285fa7a",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json?.message?.media_group_id || \"\"}}",
              "rightValue": ""
            },
            {
              "id": "3faea66a-470f-47fd-9bc1-37ff95cb436a",
              "operator": {
                "type": "array",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.message.photo }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "64436107-f59c-453d-830f-61716095bb7c",
      "name": "Summarize",
      "type": "n8n-nodes-base.summarize",
      "position": [
        1536,
        528
      ],
      "parameters": {
        "options": {
          "skipEmptySplitFields": true
        },
        "fieldsToSplitBy": "chat_id, media_group",
        "fieldsToSummarize": {
          "values": [
            {
              "field": "img",
              "aggregation": "append"
            },
            {
              "field": "text",
              "aggregation": "append"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "1318a1ef-8400-4d0e-9257-b95293d994a7",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        2144,
        672
      ],
      "parameters": {
        "options": {},
        "operation": "toBinary",
        "sourceProperty": "image_url"
      },
      "typeVersion": 1.1
    },
    {
      "id": "ed7d983c-6a72-4938-9175-800fab2d3ea4",
      "name": "Merge1",
      "type": "n8n-nodes-base.merge",
      "position": [
        2304,
        416
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2
    },
    {
      "id": "8e3c9750-d8b9-472a-90ca-4d015e2dffab",
      "name": "Merge2",
      "type": "n8n-nodes-base.merge",
      "position": [
        2704,
        320
      ],
      "parameters": {
        "mode": "chooseBranch"
      },
      "typeVersion": 3.2
    },
    {
      "id": "df18f925-bfc2-4653-9c6b-5aaf73b4994b",
      "name": "NOOP",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -192,
        512
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1e390fc5-3996-40c0-988f-57c6d50734f4",
      "name": "Latest message in media_group",
      "type": "n8n-nodes-base.summarize",
      "position": [
        0,
        656
      ],
      "parameters": {
        "options": {},
        "fieldsToSplitBy": "media_group",
        "fieldsToSummarize": {
          "values": [
            {
              "field": "createdAt",
              "aggregation": "max"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "daacc6e1-1a06-427e-a70b-60b094b83230",
      "name": "Sort",
      "type": "n8n-nodes-base.sort",
      "position": [
        656,
        528
      ],
      "parameters": {
        "options": {},
        "sortFieldsUi": {
          "sortField": [
            {
              "fieldName": "media_group"
            },
            {
              "fieldName": "createdAt"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b2e147bb-ecf2-464f-85fd-619a80122508",
      "name": "Call NanoBanana via OpenRouter",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1744,
        672
      ],
      "parameters": {
        "url": "https://openrouter.ai/api/v1/chat/completions",
        "method": "POST",
        "options": {
          "batching": {
            "batch": {
              "batchSize": 1,
              "batchInterval": 300
            }
          }
        },
        "jsonBody": "={\n  \"model\": \"google/gemini-2.5-flash-image-preview\",\n  \"messages\": {{\n  [{\n    \"role\": \"user\",\n    \"content\": \n$json.appended_text.concat($json.appended_img)\n    \n  }].toJsonString()\n}},\n    \"modalities\": [\"image\", \"text\"]\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {}
          ]
        },
        "nodeCredentialType": "openRouterApi"
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "dd75b31e-7246-4b39-9f88-b1f45859868c",
      "name": "Extract Base64",
      "type": "n8n-nodes-base.set",
      "position": [
        1952,
        672
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1afd605f-bccf-4f53-aa29-45c9902c1cff",
              "name": "image_url",
              "type": "string",
              "value": "={{ $json.choices[0].message.images[0].image_url.url.split(',')[1] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "85936461-66d3-45af-a27f-5a805a15097b",
      "name": "Send processing message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1744,
        400
      ],
      "parameters": {
        "text": "Processing your request, please wait...",
        "chatId": "={{ $json.chat_id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7e741bb2-25ab-42f5-8fde-047f4258ca1f",
      "name": "Send result message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2512,
        416
      ],
      "parameters": {
        "chatId": "={{ $json.result.chat.id }}",
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {
          "reply_to_message_id": "={{ $json.result.message_id }}"
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "bdfa830b-593f-4e8e-a70e-cea310431b08",
      "name": "status:processing",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        480,
        528
      ],
      "parameters": {
        "columns": {
          "value": {
            "status": "processing"
          },
          "schema": [
            {
              "id": "chat_id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "chat_id",
              "defaultMatch": false
            },
            {
              "id": "message_id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "message_id",
              "defaultMatch": false
            },
            {
              "id": "media_group",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "media_group",
              "defaultMatch": false
            },
            {
              "id": "message",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "message",
              "defaultMatch": false
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "filters": {
          "conditions": [
            {
              "keyValue": "={{ $json.id }}"
            }
          ]
        },
        "operation": "update",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "MbWzAb6WjNiw6KFK",
          "cachedResultUrl": "/projects/dI4ucORffuUU6JJc/datatables/MbWzAb6WjNiw6KFK",
          "cachedResultName": "TG_mediagroup"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b679d7f2-6f88-4477-b164-73317600454a",
      "name": "status:done",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        2896,
        320
      ],
      "parameters": {
        "columns": {
          "value": {
            "status": "done"
          },
          "schema": [
            {
              "id": "chat_id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "chat_id",
              "defaultMatch": false
            },
            {
              "id": "message_id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "message_id",
              "defaultMatch": false
            },
            {
              "id": "media_group",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "media_group",
              "defaultMatch": false
            },
            {
              "id": "message",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "message",
              "defaultMatch": false
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "filters": {
          "conditions": [
            {
              "keyValue": "={{ $json.id }}"
            }
          ]
        },
        "operation": "update",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "MbWzAb6WjNiw6KFK",
          "cachedResultUrl": "/projects/dI4ucORffuUU6JJc/datatables/MbWzAb6WjNiw6KFK",
          "cachedResultName": "TG_mediagroup"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "53114c9f-89ad-4d7b-885f-0478d783f5fe",
      "name": "Get new requests",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -192,
        304
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "status",
              "keyValue": "new"
            }
          ]
        },
        "operation": "get",
        "returnAll": true,
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "MbWzAb6WjNiw6KFK",
          "cachedResultUrl": "/projects/dI4ucORffuUU6JJc/datatables/MbWzAb6WjNiw6KFK",
          "cachedResultName": "TG_mediagroup"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "abacd752-a665-4fba-94cc-1807a2bfcb2c",
      "name": "prepare user messages",
      "type": "n8n-nodes-base.set",
      "position": [
        1328,
        528
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "3d3c38a5-9dbf-47cb-a87a-d10556ddc408",
              "name": "text",
              "type": "object",
              "value": "={{ $('parse TG messages')?.item?.json?.message?.caption ? {\"type\": \"text\", \"text\": $('parse TG messages')?.item?.json?.message?.caption} : null }}"
            },
            {
              "id": "2cf84a2e-beb0-4fda-a1c0-fa23fd00e040",
              "name": "img",
              "type": "object",
              "value": "={\"type\":\"image_url\",\"image_url\":{\"url\":{{ `https://api.telegram.org/file/bot<TOKEN>/${$json.result.file_path}`.toJsonString() }} } }"
            },
            {
              "id": "452270fc-d92b-4838-bd55-989ecba84991",
              "name": "media_group",
              "type": "string",
              "value": "={{ $('parse TG messages').item.json.media_group }}"
            },
            {
              "id": "8aa85a48-c572-4e08-b757-d91197566423",
              "name": "chat_id",
              "type": "string",
              "value": "={{ $('parse TG messages').item.json.message.chat.id }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "7cf601c0-357d-4e0b-adf7-ef62f3029819",
      "name": "parse TG messages",
      "type": "n8n-nodes-base.set",
      "position": [
        832,
        528
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d1b933fb-b6ba-4c59-9437-5168c67f8d1b",
              "name": "message",
              "type": "object",
              "value": "={{ JSON.parse($json.message) }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "2e167ce8-4bf7-4d57-904e-1c8b697ed574",
      "name": "If any new records",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -416,
        304
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "status",
              "keyValue": "new"
            }
          ]
        },
        "operation": "rowExists",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "MbWzAb6WjNiw6KFK",
          "cachedResultUrl": "/projects/dI4ucORffuUU6JJc/datatables/MbWzAb6WjNiw6KFK",
          "cachedResultName": "TG_mediagroup"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ee73fca8-a430-4074-be65-0adf5e23541e",
      "name": "Send initial notification",
      "type": "n8n-nodes-base.telegram",
      "position": [
        96,
        -256
      ],
      "parameters": {
        "text": "Received your message, processing will begin shortly",
        "chatId": "={{ $json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false,
          "reply_to_message_id": "={{ $json.message.message_id }}"
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "61b4408e-5f34-450e-87f9-caa3b4cf361f",
      "name": "Filter1",
      "type": "n8n-nodes-base.filter",
      "position": [
        -192,
        -256
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d730a632-ba84-4047-aa67-ca62299485e9",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ ($json?.message?.caption || \"\") }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "073ac5b7-ce9a-4ff3-ae41-fb14babec629",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        -368
      ],
      "parameters": {
        "width": 432,
        "height": 256,
        "content": "## Reply to a message with caption\n### Assuming each media group has a single caption, Telegram node informs the user once"
      },
      "typeVersion": 1
    },
    {
      "id": "8450e163-1905-4bda-97db-c5334407edbb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        400
      ],
      "parameters": {
        "width": 432,
        "height": 416,
        "content": "## Check if latest media group message has sufficient delay\n### Protect from slow Internet speed on the user side"
      },
      "typeVersion": 1
    },
    {
      "id": "e66cca00-5bb7-4710-a325-58f36d550c23",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        400
      ],
      "parameters": {
        "width": 464,
        "height": 304,
        "content": "## When getting file URLs directly from Telegram, update the download link\n### `https://api.telegram.org/file/bot<TOKEN>/` \ud83d\udc47"
      },
      "typeVersion": 1
    },
    {
      "id": "128c8e62-7354-4f39-8964-df5ecd30e3c8",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1712,
        560
      ],
      "parameters": {
        "width": 560,
        "height": 240,
        "content": "## Send array with caption text and all images to NanoBanana via OpenRouter\n### Transform LLM output into binary"
      },
      "typeVersion": 1
    },
    {
      "id": "2027d6af-862a-47c9-a878-d4dedd41e0b8",
      "name": "Process other messages as usual",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -192,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "bb6d7a55-6b2f-4fff-9b64-37ea18fccc0d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -848,
        208
      ],
      "parameters": {
        "width": 352,
        "height": 224,
        "content": "## Adjust timer for checking the new records in Data Tables"
      },
      "typeVersion": 1
    },
    {
      "id": "8f70cd56-bc97-4110-a8a6-f4eff030217b",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1024,
        -304
      ],
      "parameters": {
        "width": 528,
        "height": 440,
        "content": "# Prerequisites\n\n## 1\ufe0f\u20e3 Data Table\nCreate new Data Table with the following string variables:\n- `chat_id`\n- `message_id`\n- `media_group`\n- `message`\n- `status`\n\n## 2\ufe0f\u20e3 New Telegram bot\n1. Use `@BotFather` to create a new bot\n2. Copy bot token, create new Telegram Credentials in n8n for this token\n3. Edit `prepare user messages` node and update the URL. This is needed if you are passing direct download links from Telegram."
      },
      "typeVersion": 1
    },
    {
      "id": "90d0915c-5b80-4408-af66-341f60695114",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -368
      ],
      "parameters": {
        "width": 464,
        "height": 696,
        "content": "## [Reach out via LinkedIn](https://www.linkedin.com/in/parsadanyan/)\n[![](https://raw.githubusercontent.com/ed-parsadanyan/public-tests/main/n8n-examples/data-tables-template/current-offer.gif)](https://short.fyi/current-offer)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "executionOrder": "v1",
    "saveDataSuccessExecution": "all"
  },
  "versionId": "516b8782-4200-4b24-84c3-e4addd1e6851",
  "connections": {
    "NOOP": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          },
          {
            "node": "Latest message in media_group",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort": {
      "main": [
        [
          {
            "node": "parse TG messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "status:processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge1": {
      "main": [
        [
          {
            "node": "Send result message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge2": {
      "main": [
        [
          {
            "node": "status:done",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter1": {
      "main": [
        [
          {
            "node": "Send initial notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize": {
      "main": [
        [
          {
            "node": "Send processing message",
            "type": "main",
            "index": 0
          },
          {
            "node": "Call NanoBanana via OpenRouter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a file": {
      "main": [
        [
          {
            "node": "prepare user messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upsert row(s)": {
      "main": [
        []
      ]
    },
    "Extract Base64": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get new requests": {
      "main": [
        [
          {
            "node": "NOOP",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "If any new records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Is media group with images?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "parse TG messages": {
      "main": [
        [
          {
            "node": "Get a file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "status:processing": {
      "main": [
        [
          {
            "node": "Sort",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If any new records": {
      "main": [
        [
          {
            "node": "Get new requests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send result message": {
      "main": [
        [
          {
            "node": "Merge2",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "prepare user messages": {
      "main": [
        [
          {
            "node": "Summarize",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send processing message": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is media group with images?": {
      "main": [
        [
          {
            "node": "Upsert row(s)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Filter1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Process other messages as usual",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Latest message in media_group": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call NanoBanana via OpenRouter": {
      "main": [
        [
          {
            "node": "Extract Base64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "If any new records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}