{
  "name": "Create curated newsletters from Reddit discussions with GPT-4o Mini and Gmail",
  "nodes": [
    {
      "id": "4429a652-06ca-4abd-a864-06bdab7b4a51",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        1296,
        32
      ]
    },
    {
      "id": "325fd52f-9aff-4951-983a-302da65080c5",
      "name": "Get many posts",
      "type": "n8n-nodes-base.reddit",
      "position": [
        1696,
        32
      ]
    },
    {
      "id": "2e5d3135-709c-4000-9d23-5dee01bacb51",
      "name": "Set topic of interest",
      "type": "n8n-nodes-base.set",
      "position": [
        2496,
        32
      ]
    },
    {
      "id": "e2cf004a-d447-4750-a5ad-909646cb488c",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        4080,
        16
      ]
    },
    {
      "id": "201fb370-eddd-42f8-b2c9-af4d73b794ef",
      "name": "post",
      "type": "n8n-nodes-base.set",
      "position": [
        4448,
        112
      ]
    },
    {
      "id": "891b6023-fc8e-4a72-8e0a-0e3d196f0799",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        6096,
        128
      ]
    },
    {
      "id": "b9ee93d4-6b58-4108-a58f-0ca35e18c6f9",
      "name": "clean comments",
      "type": "n8n-nodes-base.code",
      "position": [
        5264,
        240
      ]
    },
    {
      "id": "abbd45d2-0911-4fed-9e3d-effbabe2a228",
      "name": "merge comments",
      "type": "n8n-nodes-base.code",
      "position": [
        5696,
        240
      ]
    },
    {
      "id": "8052a433-8cbb-4e0e-9aa4-8158e36e7537",
      "name": "merge summaries",
      "type": "n8n-nodes-base.code",
      "position": [
        6992,
        0
      ]
    },
    {
      "id": "8c27e26c-9220-4af9-8415-7d23c5c37f9d",
      "name": "create newsletter",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        7328,
        0
      ]
    },
    {
      "id": "9dead837-9957-4eb8-aad2-39b76e04016b",
      "name": "Summarize post + comments",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        6496,
        256
      ]
    },
    {
      "id": "3e9186aa-be58-4ae8-adcc-10dfd56768e0",
      "name": "filter topic of interest",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2880,
        32
      ]
    },
    {
      "id": "72a3527f-30a1-40ff-8d74-5bd67c5881ce",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        7872,
        0
      ]
    },
    {
      "id": "6ca358ee-21b5-4d86-a53e-9c3f4c8e920e",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        -80
      ],
      "parameters": {
        "width": 600,
        "height": 1020,
        "content": "## 📰 Reddit to Newsletter Workflow\n\n### Goal:\nThis workflow automates the process of curating content from Reddit based on your interests and synthesizing it into a newsletter format. By fetching post"
      }
    },
    {
      "id": "b9529a12-26a7-48f2-baf5-c8efa810fece",
      "name": "Sticky Note - Summarize post + comments",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6448,
        528
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 📝 Summarize post + comments\n\n### 🎯 Purpose  \nThis node is essential for extracting and condensing insights from Reddit discussions within the workflow. It analyzes the original post and its comment"
      }
    },
    {
      "id": "ea88a619-c219-489a-9803-e7de41963e48",
      "name": "Sticky Note - Merge",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6064,
        528
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 📌 Merge\n\nThis node combines multiple incoming data streams based on their position. Its role is crucial in this workflow to ensure that disparate data elements are effectively merged, allowing for "
      }
    },
    {
      "id": "7f061ea9-bfb5-4730-aec1-efdf74ee0694",
      "name": "Sticky Note - merge comments",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5648,
        528
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 📌 merge comments\n\n### 🎯 Purpose  \nThis node combines multiple comments into a single array, streamlining data for further processing within the workflow. It consolidates the information, making it "
      }
    },
    {
      "id": "6609a462-5464-48bc-822f-0f98195edc7a",
      "name": "Sticky Note - Send a message",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7712,
        528
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 📩 Send a message\n\n### 🎯 Purpose  \nThis node is responsible for sending an email with the content obtained from the workflow. It is essential for disseminating information, in this case, a summary o"
      }
    },
    {
      "id": "66063384-e4a3-4ca6-9d57-5bca91285c5f",
      "name": "Sticky Note - clean comments",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5232,
        528
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 🧹 Clean Comments\n\n### 🎯 Purpose  \nThis node is essential for processing and flattening comments from Reddit posts. It simplifies the data structure by extracting key details such as post ID, subred"
      }
    },
    {
      "id": "440d3b9e-7da0-464c-8f6b-7cf2bd5691a5",
      "name": "Sticky Note - Get many comments in a post",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4832,
        528
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 📌 Get post comments\n\n### 🎯 Purpose  \nThis node retrieves multiple comments from a specific Reddit post. It plays a crucial role within the workflow by aggregating user feedback and discussions rela"
      }
    },
    {
      "id": "4c8dbf2a-f141-4222-b31b-25b1ee9d3d13",
      "name": "Sticky Note - create newsletter",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7280,
        528
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 📧 Create Newsletter\n\n### 🎯 Purpose  \nThis node is designed to generate an engaging HTML newsletter from community discussions, specifically curated from Reddit. Within the workflow, it takes in a J"
      }
    },
    {
      "id": "3ae68406-b830-4888-9f8e-2c93d1a588cd",
      "name": "Sticky Note - post",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4416,
        528
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 📌 Post\n\n### 🎯 Purpose  \nThis node is responsible for capturing and saving the entire JSON object that is being passed in the workflow. By doing this, it plays a crucial role in ensuring that the da"
      }
    },
    {
      "id": "827709bf-69df-43f3-a866-abab6f2e69bc",
      "name": "Sticky Note - merge summaries",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6864,
        528
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 📌 Merge Summaries\n\n### 🎯 Purpose  \nThis node combines multiple summary items into a single structured record, which is essential for consolidating data in workflows that process lists of informatio"
      }
    },
    {
      "id": "57b1c2cf-970a-4704-82e4-1c10a1100fec",
      "name": "Sticky Note - Loop Over Items",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4032,
        512
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 🔄 Loop Over Items\n\n### 🎯 Purpose  \nThis node is responsible for iterating through a collection of items in the workflow. It allows the subsequent nodes to process each item individually, enabling b"
      }
    },
    {
      "id": "0c45a0a4-f762-48b3-b535-94a543fb4184",
      "name": "Sticky Note - If",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3632,
        512
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## ⚖️ If topic of interest\n\n### 🎯 Purpose  \nThe \"If\" node acts as a conditional checkpoint within the workflow. It evaluates whether the specified condition is true based on the input data, specifical"
      }
    },
    {
      "id": "0161818b-96e1-4233-9b19-db9366682e6a",
      "name": "Sticky Note - Code1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3248,
        512
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 🧑‍💻 String to Json\n\n### 🎯 Purpose  \nThis node processes the content from the OpenAI node, transforming various JSON-like string formats into robust JSON objects. It ensures that any incoming data, "
      }
    },
    {
      "id": "55f6cdd0-de23-468f-ad57-319af6c92401",
      "name": "Sticky Note - filter topic of interest",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2848,
        512
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 🗂️ Filter Topic of Interest\n\n### 🎯 Purpose  \nThis node serves as a filtering mechanism within the workflow, assessing Reddit posts to determine if they pertain to a specified topic of interest. It "
      }
    },
    {
      "id": "5b6c1775-9b8f-4424-864b-1c21b0e8e306",
      "name": "Sticky Note - Set topic of interest",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2448,
        512
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 📌 Set topic of interest\n\n### 🎯 Purpose  \nThis node sets a specific topic of interest for the workflow, in this case, focusing on \"Strategies and tactics to get new customers.\" It helps define the c"
      }
    },
    {
      "id": "44145633-1107-4f76-9912-237aa053e26c",
      "name": "Sticky Note - Code",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2048,
        512
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 📝 Select Top 10 Post\n\n### 🎯 Purpose  \nThis Code node processes and sorts incoming data, specifically a list of posts, to identify the top 10 based on their popularity (measured by 'ups' and 'commen"
      }
    },
    {
      "id": "ede3a99f-b74a-450c-83d0-7d74cabde7fe",
      "name": "Sticky Note - Get many posts",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1664,
        512
      ],
      "parameters": {
        "width": 380,
        "height": 1020,
        "content": "## 📌 Get many posts\n\n### 🎯 Purpose  \nThis node retrieves multiple posts from the \"microsaas\" subreddit, specifically filtering for new posts. It plays a crucial role in the workflow by providing the l"
      }
    },
    {
      "id": "e0157069-7bd7-4dee-88f8-13a68ec0f5b6",
      "name": "Select Top 10 Post",
      "type": "n8n-nodes-base.code",
      "position": [
        2096,
        32
      ]
    },
    {
      "id": "87bc320e-220a-4cc3-a4fa-40aa4484540a",
      "name": "String to Json",
      "type": "n8n-nodes-base.code",
      "position": [
        3280,
        32
      ]
    },
    {
      "id": "5f83b205-a863-4b2b-8083-4ba27ca698b5",
      "name": "If topic of interest",
      "type": "n8n-nodes-base.if",
      "position": [
        3680,
        32
      ]
    },
    {
      "id": "12fcb916-f819-48f7-b144-eb7c40176215",
      "name": "Get post comments",
      "type": "n8n-nodes-base.reddit",
      "position": [
        4880,
        240
      ]
    },
    {
      "id": "341526a0-1ba3-4473-ba05-e442dc9f73c2",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        1008
      ],
      "parameters": {
        "width": 592,
        "height": 720,
        "content": "## 🛠 Set Up fields\n\nBefore running this workflow, update the following fields inside the indicated nodes:\n\n### 🔑 Credentials\n- **Reddit OAuth2** → in node **Get many posts** and **Get post comments** "
      }
    }
  ],
  "connections": {
    "post": {
      "main": [
        [
          {
            "node": "Get post comments",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Summarize post + comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many posts": {
      "main": [
        [
          {
            "node": "Select Top 10 Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "String to Json": {
      "main": [
        [
          {
            "node": "If topic of interest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "clean comments": {
      "main": [
        [
          {
            "node": "merge comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "merge comments": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "merge summaries",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "merge summaries": {
      "main": [
        [
          {
            "node": "create newsletter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get post comments": {
      "main": [
        [
          {
            "node": "clean comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "create newsletter": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select Top 10 Post": {
      "main": [
        [
          {
            "node": "Set topic of interest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If topic of interest": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set topic of interest": {
      "main": [
        [
          {
            "node": "filter topic of interest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "filter topic of interest": {
      "main": [
        [
          {
            "node": "String to Json",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize post + comments": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get many posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}