{
  "id": "MfXaARhvmHON0d6z",
  "name": "Create Telegram podcast digests from Apple Podcasts using BrowserAct & Gemini",
  "tags": [],
  "nodes": [
    {
      "id": "463fae5f-aba1-4acf-90a2-895976bc44a8",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1296,
        528
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-pro"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a00daa5d-259c-4416-b864-257e44ef5573",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1440,
        528
      ],
      "parameters": {
        "autoFix": true,
        "jsonSchemaExample": "{\n\"Telegram\" : [\n  \"\ud83c\udfa7 <b><a href=\\\"https://...\\\">Podcast Title 1</a></b>\\n\ud83c\udf99 <i>Show Name</i>\\n\\nSummary text here...\\n\\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\\n\\n\ud83c\udfa7 <b><a href=\\\"https://...\\\">Podcast Title 2</a></b>... [Message content up to 3500 chars] ... \\n\\n<i>(To be continued...)</i>\",\n  \"<i>(...Continued)</i>\\n\\n\ud83c\udfa7 <b><a href=\\\"https://...\\\">Podcast Title 5</a></b>\\n\ud83c\udf99 <i>Show Name</i>\\n\\nSummary text...\"\n]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "8a2fbb6e-d808-484d-8830-fbdd9fe633ba",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2064,
        320
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "30c1481e-453a-4ba1-94b8-3e227ae87ff9",
      "name": "Schedule Daily",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        656,
        320
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "e404aef6-0642-425e-88ec-0b96f14d8cb5",
      "name": "Run Top Chart Podcast workflow",
      "type": "n8n-nodes-browseract.browserAct",
      "position": [
        864,
        320
      ],
      "parameters": {
        "type": "WORKFLOW",
        "workflowId": "72057695044160531",
        "workflowConfig": {
          "value": {},
          "schema": [
            {
              "id": "input-Apple_Podcast",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "description": "If left blank, the default value defined in BrowserAct will be used.",
              "displayName": "Apple_Podcast",
              "defaultMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "input-Apple_Podcast"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "open_incognito_mode": false
      },
      "credentials": {
        "browserActApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ccaabf97-84a1-4fef-9ebb-5767ec7ee0a4",
      "name": "Split Generated Items",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1856,
        320
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "output.Telegram"
      },
      "typeVersion": 1
    },
    {
      "id": "5f451ebc-a5db-4e2c-b398-4e00b3338ebf",
      "name": "Avoid Rate Limits",
      "type": "n8n-nodes-base.wait",
      "position": [
        2304,
        336
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "0771a2c0-c6fa-425c-b896-0d516ea9b01b",
      "name": "Send Podcast List to User",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2512,
        336
      ],
      "parameters": {
        "text": "={{ $('Loop Over Items').item.json[\"output.Telegram\"] }}",
        "chatId": "parameters.chatId==@Channel_ID (Use Channel ID or Chat ID )",
        "additionalFields": {
          "parse_mode": "HTML"
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "791c1603-2c0a-49e9-a910-f63f66e77d56",
      "name": "Analyze Podcast & Generate Post",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1296,
        320
      ],
      "parameters": {
        "text": "={{ $json.output.string }}",
        "options": {
          "systemMessage": "You are a Telegram Content Formatter and Publisher. Your task is to take a raw JSON input containing podcast or news items and convert it into a structured JSON array of strings, formatted specifically for Telegram's HTML parsing mode.\n\n\nProcessing Rules:\n\nContent Formatting (Per Item): For each item in the input list, generate a text block using the following HTML tags supported by Telegram (<b>, <i>, <a>):\n\nHeadline: Use an engaging emoji (like \ud83c\udfa7, \ud83d\uddde, or \ud83d\udd25) followed by the Title in bold (<b>). Embed the Link directly into the Title using the <a href=\"...\"> tag.\n\nShow Name: Display the \"Show\" field in italics (<i>) with a microphone emoji (\ud83c\udf99).\n\nSummary: Place the summary on a new line.\n\nSeparator: Add a visual separator between items (e.g., \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500).\n\nTemplate:\n\nHTML\n\n\ud83c\udfa7 <b><a href=\"{Link}\">{Title}</a></b>\n\ud83c\udf99 <i>{Show}</i>\n\n{Summary}\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nPagination & Character Limits:\n\nTelegram has a hard limit of 4096 characters. You must enforce a safety limit of 3500 characters per message to account for encoding and metadata.\n\nIterate through the items and concatenate them into a single message string.\n\nCheck Length: Before adding a new item to the current message, check if adding it would exceed the 3500-character limit.\n\nIf it fits: Add the item to the current message.\n\nIf it does NOT fit:\n\nAppend the footer <i>(To be continued...)</i> to the end of the current message.\n\nClose the current message and add it to your output array.\n\nStart a new message string.\n\n(Optional) You may start the new message with <i>(...Continued)</i> for continuity.\n\nAdd the current item to this new message.\n\nTone:\n\nKeep the content engaging.\n\nEnsure the HTML is valid (all tags must be closed).\n\nFinal Output:\n\nReturn only the final JSON array containing the message strings. Do not output markdown code blocks (like ```json) unless explicitly asked, just the raw array.\n\nOutput Example (do not add any more key):\n\n{\n\"Telegram\" : [\n  \"\ud83c\udfa7 <b><a href=\\\"https://...\\\">Podcast Title 1</a></b>\\n\ud83c\udf99 <i>Show Name</i>\\n\\nSummary text here...\\n\\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\\n\\n\ud83c\udfa7 <b><a href=\\\"https://...\\\">Podcast Title 2</a></b>... [Message content up to 3500 chars] ... \\n\\n<i>(To be continued...)</i>\",\n  \"<i>(...Continued)</i>\\n\\n\ud83c\udfa7 <b><a href=\\\"https://...\\\">Podcast Title 5</a></b>\\n\ud83c\udf99 <i>Show Name</i>\\n\\nSummary text...\"\n]\n}"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "d3a46e30-88fa-43f5-aadc-b910df0f9bcd",
      "name": "Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -176
      ],
      "parameters": {
        "width": 380,
        "height": 456,
        "content": "## \u26a1 Workflow Overview & Setup\n\n**Summary:** This automation daily scrapes top podcast charts from Apple Podcasts using BrowserAct and utilizes AI to generate beautifully formatted, multi-part digests for Telegram.\n\n### Requirements\n* **Credentials:** BrowserAct, Google Gemini (PaLM), Telegram.\n* **Mandatory:** BrowserAct API (Template: **Top Charts Podcast**)\n\n### How to Use\n1. **Credentials:** Set up your BrowserAct, Google Gemini, and Telegram Bot API keys in n8n.\n2. **BrowserAct Template:** Ensure you have the **Top Charts Podcast** template saved in your BrowserAct account.\n3. **Configuration:** Update the Telegram node with your target Channel or Group ID.\n\n### Need Help?\n[How to Find Your BrowserAct API Key & Workflow ID](https://docs.browseract.com)\n[How to Connect n8n to BrowserAct](https://docs.browseract.com)\n[How to Use & Customize BrowserAct Templates](https://docs.browseract.com)"
      },
      "typeVersion": 1
    },
    {
      "id": "06b18e9f-fa22-4afa-9bc5-9f9faae75914",
      "name": "Step 1 Explanation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        160
      ],
      "parameters": {
        "color": 7,
        "width": 508,
        "height": 124,
        "content": "### \ud83d\udcfb Step 1: Chart Extraction\n\nThe workflow triggers daily to execute a BrowserAct automation that scrapes the latest trending episodes and shows from the Apple Podcasts top charts."
      },
      "typeVersion": 1
    },
    {
      "id": "18d5d326-ed5c-469a-8b15-8bd1e8aeb31b",
      "name": "Step 2 Explanation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1152,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 588,
        "height": 140,
        "content": "### \ud83e\udde0 Step 2: AI Curation & Formatting\n\nAn AI agent analyzes the scraped podcast data to create engaging HTML-formatted summaries. It automatically calculates character counts to ensure each message stays within Telegram's limits, creating a multi-part series if needed."
      },
      "typeVersion": 1
    },
    {
      "id": "f395e4d4-c5fd-4d1d-83db-3df41ebebec1",
      "name": "Step 3 Explanation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1856,
        176
      ],
      "parameters": {
        "color": 7,
        "width": 796,
        "height": 108,
        "content": "### \ud83d\ude80 Step 3: Sequential Delivery\n\nThe generated digest parts are split into individual messages and sent to Telegram. A short wait period is implemented between messages to avoid rate limits and maintain a clean posting order."
      },
      "typeVersion": 1
    },
    {
      "id": "b2207d56-60c6-42be-91e1-51e5c5a9bcc4",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        -176
      ],
      "parameters": {
        "color": 6,
        "width": 512,
        "height": 304,
        "content": "@[youtube](jR_EjiLTIgg)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b62e9f93-f2a6-4120-bb1c-e5f5ef5fd18c",
  "connections": {
    "Schedule Daily": {
      "main": [
        [
          {
            "node": "Run Top Chart Podcast workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Avoid Rate Limits",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Avoid Rate Limits": {
      "main": [
        [
          {
            "node": "Send Podcast List to User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Generated Items": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze Podcast & Generate Post",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Analyze Podcast & Generate Post",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Send Podcast List to User": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Top Chart Podcast workflow": {
      "main": [
        [
          {
            "node": "Analyze Podcast & Generate Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Podcast & Generate Post": {
      "main": [
        [
          {
            "node": "Split Generated Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}