{
  "nodes": [
    {
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "position": [
        500,
        510
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "id",
              "value": "={{$node[\"GetVideosYT\"].json[\"id\"][\"videoId\"]}}"
            },
            {
              "name": "url",
              "value": "=https://youtu.be/{{$node[\"GetVideosYT\"].json[\"id\"][\"videoId\"]}}"
            },
            {
              "name": "title",
              "value": "={{$node[\"GetVideosYT\"].json[\"snippet\"][\"title\"]}}"
            }
          ],
          "boolean": []
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1
    },
    {
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "position": [
        640,
        510
      ],
      "parameters": {
        "functionCode": "const new_items = [];\nconst data = this.getWorkflowStaticData('node');\n\ndata.ids = data.ids || [];\n\nfor (var i=0; i<items.length; i++) {\n  if (data.ids.includes(items[i].json.id)) {\n    break;\n  } else {\n    new_items.push({json: {id: items[i].json.id, url: items[i].json.url, title: items[i].json.title}});\n  }\n}\n\ndata.ids = items.map(item => item.json.id)\nreturn new_items;\n"
      },
      "typeVersion": 1
    },
    {
      "name": "CheckTime",
      "type": "n8n-nodes-base.interval",
      "position": [
        210,
        510
      ],
      "parameters": {
        "unit": "minutes",
        "interval": 30
      },
      "typeVersion": 1
    },
    {
      "name": "GetVideosYT",
      "type": "n8n-nodes-base.youTube",
      "position": [
        370,
        510
      ],
      "parameters": {
        "limit": 4,
        "filters": {
          "channelId": "REPLACE_WITH_CHANNELID"
        },
        "options": {
          "order": "date"
        },
        "resource": "video"
      },
      "typeVersion": 1
    },
    {
      "name": "SendVideo",
      "type": "n8n-nodes-base.telegram",
      "position": [
        790,
        510
      ],
      "parameters": {
        "text": "=Nuovo video di almi su YouTube!\n<b>{{$node[\"Function\"].json[\"title\"]}}</b>\n\n{{$node[\"Function\"].json[\"url\"]}}",
        "chatId": "REPLACE_WITH_CHATID",
        "additionalFields": {
          "parse_mode": "HTML"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "49219d80-099a-5757-aaef-8a0745aae57f",
      "name": "Publication · Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -800,
        0
      ],
      "parameters": {
        "content": "# interval and you tube and telegram\n\n## Purpose and structure\nThis folder contains the **interval and you tube and telegram** workflow. Its executable nodes use `function`, `interval`, `set`, `telegram`, `youTube`. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.\n\n## Setup\nImport inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.\n\n## Entry points\nInspect connections; no recognized trigger.\n\n## Verification\nSanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.\n\n## Attribution\nhttps://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Youtube/0197_Youtube_Telegram_Send_Scheduled.json\nMIT; preserve source notices.",
        "width": 700,
        "height": 800,
        "color": 1
      }
    }
  ],
  "connections": {
    "Set": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "SendVideo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CheckTime": {
      "main": [
        [
          {
            "node": "GetVideosYT",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GetVideosYT": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false
}
