{
  "name": "Gmail Newsletter to Notion using n8n",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyHour"
            }
          ]
        },
        "simple": false,
        "filters": {
          "labelIds": [
            "INBOX"
          ],
          "readStatus": "unread"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.3,
      "position": [
        -1040,
        -400
      ],
      "id": "0400ee5f-3420-429c-a222-1d3557cc50c8",
      "name": "Gmail Trigger",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "markAsRead",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}"
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        480,
        -400
      ],
      "id": "bc6ceb0a-1f76-4707-9b37-c32713eed825",
      "name": "Mark a message as read",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "typeVersion": 1.1,
      "position": [
        -384,
        -176
      ],
      "id": "82a507e7-c476-441f-9823-7a432576e108",
      "name": "Think"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.id }}",
        "contextWindowLength": 20
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -512,
        -176
      ],
      "id": "8c60578e-c51c-4f48-94f1-cd9d2fbd0ec4",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "jsonSchemaExample": "[\n  {\n    \"title\": \"3-Step Gmail Filter That Sorts Client Emails Automatically\",\n    \"status\": \"Ready\",\n    \"type\": \"Article\",\n    \"content\": \"Step-by-step guide to setting up Gmail filters that auto-label and prioritize client emails. Eliminates morning inbox triage. Takes 10 minutes to set up.\",\n    \"platform\": [\"Blog\", \"LinkedIn\"],\n    \"relevance_score\": 8\n  },\n  {\n    \"title\": \"The 5-Minute Daily Review That Stops Leads From Slipping\",\n    \"status\": \"Ready\",\n    \"type\": \"Social\",\n    \"content\": \"A simple end-of-day checklist to ensure no lead goes unfollowed. Works with any CRM or even a spreadsheet. Includes template.\",\n    \"platform\": [\"LinkedIn\", \"Twitter\"],\n    \"relevance_score\": 9\n  },\n  {\n    \"title\": \"Why Your Content Calendar Fails (And What to Use Instead)\",\n    \"status\": \"Ready\",\n    \"type\": \"Newsletter\",\n    \"content\": \"Most content calendars become guilt lists. This piece shows a simpler batch-and-ship approach that actually gets content published consistently.\",\n    \"platform\": [\"Newsletter\", \"Blog\"],\n    \"relevance_score\": 7\n  }\n]",
        "autoFix": true
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        -208,
        -176
      ],
      "id": "01835690-1bdf-4a6b-aab1-5023d3b824fa",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        -128,
        32
      ],
      "id": "5be25d77-b850-404a-afa6-347bd46e671f",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Here is the input newsletter content:\n\n///\n{{ $json.text }}\n/// ",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "=## Role\n\nYou are a content ideator for GenAI Unplugged. Your job is to analyze incoming newsletters and generate content ideas that align with your brand's mission and resonate with your target audience.\n\n\n## Brand Context\n\n**Who you serve:** solopreneurs, small business owners\n\n**Core problem you solve:** \"Manual Chaos\" - endless busywork that blocks real growth\n\n**What makes you different:** simple AI automation explained in plain English\n\n**Your mission:** helping people build AI systems so they stop being the system\n\n\n## Task\n\n1. Read the newsletter and identify its main topic and angle.\n\n2. Generate 5 content ideas inspired by the newsletter. Each idea should:\n   - Solve ONE specific, narrow problem (not broad topics)\n   - Offer a tangible outcome the reader can achieve\n   - Connect to your audience's real pain points\n\n3. Evaluate each idea against:\n   - **Specificity:** Is the problem narrow enough to solve in one piece of content?\n   - **Audience fit:** Does this match what your readers actually struggle with?\n   - **Brand alignment:** Does this reinforce your mission and positioning?\n\n4. Return the top 2 ideas formatted for your content database.\n\n\n## Output Format\n\nReturn valid JSON array only. No preamble or explanation.\nIf the newsletter lacks substance, return empty array: []\n\nEach idea must include these fields:\n- title: Short headline under 80 characters\n- status: Always \"Ready\" for new ideas\n- type: One of \"Article\", \"Newsletter\", \"Social\"\n- content: 2-3 sentence description of what this piece covers\n- platform: Array of platforms, choose from \"Blog\", \"LinkedIn\", \"Twitter\", \"Newsletter\"\n- relevance_score: 0-10 rating of audience fit"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [
        -480,
        -400
      ],
      "id": "e0666f93-7c23-45c5-a19d-31116ccc63ce",
      "name": "Generate Content Idea"
    },
    {
      "parameters": {
        "fieldToSplitOut": "output",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        32,
        -400
      ],
      "id": "e1619721-3522-423c-9ab2-85ff455ba140",
      "name": "Split Out"
    },
    {
      "parameters": {
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "value": "2f39bf06-b501-802d-a7ae-ca89afd3ed51",
          "mode": "list",
          "cachedResultName": "Example Content System",
          "cachedResultUrl": "https://www.notion.so/2f39bf06b501802da7aeca89afd3ed51"
        },
        "title": "={{ $json.title }}",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "=Title|title",
              "title": "={{ $json.title }}"
            },
            {
              "key": "=Status|select",
              "selectValue": "={{ $json.status }}"
            },
            {
              "key": "=Type|select",
              "selectValue": "={{ $json.type }}"
            },
            {
              "key": "=Content|rich_text",
              "textContent": "={{ $json.content }}"
            },
            {
              "key": "=Platform|multi_select",
              "multiSelectValue": "={{ $json.platform}}"
            },
            {
              "key": "=Created|date",
              "includeTime": false,
              "date": "={{ $now.format('MMMM dd, yyyy') }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2.2,
      "position": [
        256,
        -400
      ],
      "id": "2ca16115-2c3c-4e3e-9e31-f6d906918b9b",
      "name": "Create a database page",
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        -816,
        -400
      ],
      "id": "2901e3ad-8408-46ed-a33d-7f9739f853c9",
      "name": "Limit"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "builtInTools": {},
        "options": {
          "timeout": 600000
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        -688,
        -176
      ],
      "id": "a2b2229a-011b-465d-8f8b-b38273f826eb",
      "name": "OpenAI Chat Model2",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        -1024,
        592
      ],
      "id": "57a833ff-7bb5-4a42-8a79-0f45ff003f62",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "resource": "databasePage",
        "operation": "getAll",
        "databaseId": {
          "__rl": true,
          "value": "2f39bf06-b501-802d-a7ae-ca89afd3ed51",
          "mode": "list",
          "cachedResultName": "Example Content System",
          "cachedResultUrl": "https://www.notion.so/2f39bf06b501802da7aeca89afd3ed51"
        },
        "limit": 1,
        "simple": false,
        "filterType": "manual",
        "matchType": "allFilters",
        "filters": {
          "conditions": [
            {
              "key": "=Status|select",
              "condition": "=equals",
              "selectValue": "=Ready"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2.2,
      "position": [
        -784,
        592
      ],
      "id": "026ed01d-a4c3-4347-83c8-33428ac3b8da",
      "name": "Get approved post",
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.properties.Platform.multi_select[0].name }}",
                    "rightValue": "Blog",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "f08f0bf9-048a-4555-909f-f8b841d3b8cc"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Wordpress Blog"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "7eb459d4-a637-47d9-a048-abf3105319fd",
                    "leftValue": "={{ $json.properties.Platform.multi_select[0].name }}",
                    "rightValue": "LinkedIn",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "LinkedIn"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "a57fde00-1479-4404-99c4-98876ce1431b",
                    "leftValue": "={{ $json.properties.Platform.multi_select[0].name }}",
                    "rightValue": "Twitter",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Twitter"
            }
          ]
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.4,
      "position": [
        -544,
        576
      ],
      "id": "65707d9a-d5ee-4a5f-bc11-06d2bdf4fe23",
      "name": "Switch"
    },
    {
      "parameters": {
        "title": "={{ $('Get approved post').item.json.name }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.wordpress",
      "typeVersion": 1,
      "position": [
        -128,
        400
      ],
      "id": "b02ed5f4-549b-492f-8839-ddda1e3e4ed3",
      "name": "Create a post",
      "credentials": {
        "wordpressApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "person": "D8ZaQK8mia",
        "text": "={{ $json.properties.Content.rich_text[0].text.content }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.linkedIn",
      "typeVersion": 1,
      "position": [
        -128,
        592
      ],
      "id": "8b5f5e08-09d6-46c1-9f87-2408a9ca48d4",
      "name": "Create LinkedIn Post",
      "credentials": {
        "linkedInOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "text": "={{ $json.message.content.thread[0] }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.twitter",
      "typeVersion": 2,
      "position": [
        -128,
        784
      ],
      "id": "4e01576e-b621-4252-9b06-433c2368d18a",
      "name": "Create tweet",
      "credentials": {
        "twitterOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "databasePage",
        "operation": "update",
        "pageId": {
          "__rl": true,
          "value": "={{ $('Get approved post').item.json.id }}",
          "mode": "id"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "=Status|select",
              "selectValue": "=Published"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2.2,
      "position": [
        224,
        592
      ],
      "id": "ffc16bd6-f329-44bf-8080-2ad213c0235c",
      "name": "Mark post published in Notion",
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "# Example Workflow 1 - Find topic ideas from Newsletters and save them to your content DB in Notion",
        "height": 720,
        "width": 1840,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1136,
        -528
      ],
      "id": "e6db1ee7-ad45-44d4-aca9-a1be8aa36afe",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "# Example Workflow 2 - Distribute finalized posts/content to social media, newsletter and wordpress blog",
        "height": 656,
        "width": 1840,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1136,
        304
      ],
      "id": "2bb9b270-cb05-4c5e-b489-6a395fb87972",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "# About the Author\n![Dheeraj Sharma](https://gravatar.com/avatar/cacd1b764dd931fdb50c20ba2587e44a9f691860d020750cccf09cfdccede558?r=pg&size=100&d=retro)\n## Dheeraj Sharma\n\ud83d\udcf0 [Subscribe to my newsletter on Substack](https://genaiunplugged.substack.com/)\n\nI teach solopreneurs to build AI systems that grow revenue without growing workload. Plain English tutorials on n8n, AI agents, and automation. No jargon. No fluff. Just what works.\n\n\u25b6\ufe0f [Check my **FREE** Zero to Hero n8n AI Automation Course](https://www.youtube.com/@genaiunplugged)\n\ud83d\udcde [Connect with me over LinkedIn](https://www.linkedin.com/in/dheerajsharma14/)\n\n",
        "height": 416,
        "width": 580,
        "color": 2
      },
      "id": "1c366fca-d4a1-405a-8846-4c5804f5c758",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1792,
        80
      ],
      "typeVersion": 1
    }
  ],
  "connections": {
    "Think": {
      "ai_tool": [
        [
          {
            "node": "Generate Content Idea",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Generate Content Idea",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Content Idea",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Generate Content Idea": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Create a database page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a database page": {
      "main": [
        [
          {
            "node": "Mark a message as read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Generate Content Idea",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Content Idea",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get approved post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get approved post": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Create a post",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create LinkedIn Post",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create tweet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a post": {
      "main": [
        [
          {
            "node": "Mark post published in Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create LinkedIn Post": {
      "main": [
        [
          {
            "node": "Mark post published in Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create tweet": {
      "main": [
        [
          {
            "node": "Mark post published in Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "versionId": "6ab0fa21-2324-4177-abdd-0a2e0da373df",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "4ZU6mOwHQ_K3RPCBAB3y_",
  "tags": []
}