{
  "id": 3862,
  "name": "Automate research-based newsletters with Perplexity, GPT-4, and image generation",
  "description": "This n8n workflow automates the process of creating and sending high-quality newsletters with images generated by a GPT image generator. It is triggered on a schedule.\n\n## What is included?\n\n- 1 n8n workflow (json)\n- 1 Setup tutorial doc\n- 1 video guidance on how to connect n8n with all Google products\n- 1 video guidance on how to connect n8n with Google Cloud Storage\n\n## Who is this for?\n\nThis template is ideal for:\n\n- Content creators looking to automate their newsletter process.\n- Marketers seeking to efficiently produce engaging newsletters with AI-generated content and imagery.\n- Anyone wanting to create and send personalized newsletters on a schedule.\n\n## What problem is this workflow solving?\n\nManually creating and sending newsletters can be time-consuming, especially when including relevant and engaging content and imagery. This workflow automates the content generation (using AI and web search), image creation, and sending process, freeing up time and ensuring consistent communication with clients.\n\n## What this workflow does:\n\nThis workflow automates the following steps:\n\n**Scheduled Trigger:** The workflow is triggered automatically on a predefined schedule.\n\n**Get Newsletter Topic:** Retrieves the first unpublished newsletter topic from a Google Sheet titled \"Newsletter Topics\". It then updates the status of this topic and records the publication date to avoid duplication in future runs.\n\n**AI Newsletter & Image Generator:** This is the core content creation step. It uses an AI agent (configured with OpenAI and Perplexity APIs) to generate an engaging newsletter and a detailed, ultra-realistic image prompt based on the selected topic and real-time web research.\n\n**GPT Image Generation:** Uses the OpenAI API to generate an image based on the detailed image prompt created in the previous step.\n\n**Get Client List:** Retrieves client names and email addresses from a Google Sheet titled \"Clients\".\n\n**Send Newsletter:** Sends the personalized newsletter via Gmail to each client on the list, including the AI-generated title, content, and the uploaded image. The email body HTML is customizable.\n\n## Setup:\n\n1.  **Configure the workflow's run frequency** within the \"Schedule Trigger\" node.\n\n2.  **Create a Google Sheet named \"Newsletter Topics\" and \"Clients\"**  in your Google Drive.\n\n3.  **Enter your OpenAI and Perplexity  API key** in the 'Input' node.\n\n4.  **Connect your Gmail account** to the \"SendNewsletter\" node.\n\n## How to customize this workflow:\n\n**Adjust the prompt for your newsletter style** in the \"AI Agent\" node.\n\n**Adjust the Email Body HTML for your newsletter style** in the \"SendNewsletter\" node.\n\nOptionally, enable the \"Tavily WebSearch\" node and configure it if you prefer to use Tavily instead of Perplexity for web search.\n\n## Category:\n\nMarketing, Content Creation, Automation",
  "categories": [
    {
      "id": 33,
      "name": "Social Media"
    },
    {
      "id": 51,
      "name": "Multimodal AI"
    }
  ],
  "totalViews": 899,
  "createdAt": "2025-05-04T15:35:27.620Z",
  "workflow": {
    "id": "P720ebAZOgIrZJgN",
    "meta": {
      "instanceId": "f638a47e4e563f91fde8b98ed9f5fa6a9faa41a207143e9ce05d85200c905524",
      "templateCredsSetupCompleted": true
    },
    "name": "The Ultimate AI Newsletter Automation [Public]",
    "tags": [
      {
        "id": "Hf04AVlu1zr8nTpB",
        "name": "GPT",
        "createdAt": "2025-04-24T18:16:56.636Z",
        "updatedAt": "2025-04-24T18:16:56.636Z"
      },
      {
        "id": "OObaiVGBXNLx59MY",
        "name": "Perplexity",
        "createdAt": "2025-05-04T14:54:47.515Z",
        "updatedAt": "2025-05-04T14:54:47.515Z"
      }
    ],
    "nodes": [
      {
        "id": "e169608e-b2a7-470c-b877-bee45c485471",
        "name": "Input",
        "type": "n8n-nodes-base.set",
        "position": [
          -1380,
          260
        ],
        "parameters": {},
        "typeVersion": 3.4
      },
      {
        "id": "4e5e5e7a-4c92-424f-a157-a31ac2f5b58d",
        "name": "Sticky Note7",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -1720,
          -160
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      },
      {
        "id": "6da73264-2d97-497b-8342-ad1786bd6e93",
        "name": "Sticky Note20",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -3020,
          -960
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      },
      {
        "id": "58edfd76-0e0f-460f-bcf3-6ac5d45aaaff",
        "name": "Schedule Trigger",
        "type": "n8n-nodes-base.scheduleTrigger",
        "position": [
          -2880,
          260
        ],
        "parameters": {},
        "typeVersion": 1.2
      },
      {
        "id": "b607663f-1263-4632-aeaf-8f4575e4e7b9",
        "name": "Sticky Note3",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -3020,
          -160
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      },
      {
        "id": "96cae626-1871-481d-9fa0-88ae708f686e",
        "name": "Structured Output Parser1",
        "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
        "position": [
          -320,
          480
        ],
        "parameters": {},
        "typeVersion": 1.2
      },
      {
        "id": "da19e96b-9a95-4ab2-8a2a-79dcf89d85ff",
        "name": "OpenAI Chat Model",
        "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
        "position": [
          -780,
          500
        ],
        "parameters": {},
        "typeVersion": 1.2
      },
      {
        "id": "7c097fcc-ffcd-482b-9faf-3dbdd1e33ada",
        "name": "Sticky Note10",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -860,
          -160
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      },
      {
        "id": "60fb32cf-7945-40cd-9aee-a2f481bdbdf4",
        "name": "Sticky Note15",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -180,
          -160
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      },
      {
        "id": "46d68eec-7859-4dfb-b08a-2055306c6f9a",
        "name": "Sticky Note19",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          140,
          -160
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      },
      {
        "id": "2531e413-f100-428d-9e0e-ad74ddf08c20",
        "name": "SetImageURL1",
        "type": "n8n-nodes-base.set",
        "position": [
          820,
          -60
        ],
        "parameters": {},
        "typeVersion": 3.4
      },
      {
        "id": "1e98df7b-b93a-487f-99c9-d8606bb10dcd",
        "name": "Google Cloud Storage 2",
        "type": "n8n-nodes-base.googleCloudStorage",
        "maxTries": 2,
        "position": [
          580,
          -60
        ],
        "parameters": {},
        "retryOnFail": true,
        "typeVersion": 1
      },
      {
        "id": "57ff49c1-4ea5-46fb-ac7a-b27d00c296d8",
        "name": "Sticky Note21",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          480,
          -160
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      },
      {
        "id": "652f1157-c2dc-4aaf-96ea-6bf8ceb00afa",
        "name": "GetClientList",
        "type": "n8n-nodes-base.googleSheets",
        "position": [
          720,
          460
        ],
        "parameters": {},
        "typeVersion": 4.5
      },
      {
        "id": "fbd85884-fb7c-4393-aff5-dba4506608f8",
        "name": "Merge",
        "type": "n8n-nodes-base.merge",
        "position": [
          1140,
          200
        ],
        "parameters": {},
        "typeVersion": 3.1
      },
      {
        "id": "01af3ab0-0fac-4157-b387-85d5d98eb10e",
        "name": "GetNewsletterTopic",
        "type": "n8n-nodes-base.googleSheets",
        "position": [
          -2540,
          260
        ],
        "parameters": {},
        "typeVersion": 4.5
      },
      {
        "id": "26cdf01c-59f8-49f2-a945-be9213beac74",
        "name": "UpdateStatus",
        "type": "n8n-nodes-base.googleSheets",
        "position": [
          -2000,
          260
        ],
        "parameters": {},
        "typeVersion": 4.5
      },
      {
        "id": "23218309-46e4-4a0f-a4e3-88c3b58c8af7",
        "name": "Sticky Note",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -2640,
          -160
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      },
      {
        "id": "83f66b82-9e8a-4a61-957e-3acd34b9c1ae",
        "name": "GetFirstTopic",
        "type": "n8n-nodes-base.limit",
        "position": [
          -2260,
          260
        ],
        "parameters": {},
        "typeVersion": 1
      },
      {
        "id": "df4b4eb9-35d5-48f7-96ef-7122349d8d11",
        "name": "Sticky Note6",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          1080,
          -160
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      },
      {
        "id": "1ce76004-fa4d-40d7-b8ef-e87f24e37e39",
        "name": "GPT Image Generation",
        "type": "n8n-nodes-base.httpRequest",
        "position": [
          -80,
          260
        ],
        "parameters": {},
        "typeVersion": 4.2
      },
      {
        "id": "6d3487cc-b429-4b6b-bc9e-11978eefdca8",
        "name": "Convert to Binary File",
        "type": "n8n-nodes-base.convertToFile",
        "position": [
          220,
          260
        ],
        "parameters": {},
        "typeVersion": 1.1
      },
      {
        "id": "72d3360a-e356-4e64-8b23-cdb9339f595b",
        "name": "Sticky Note1",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          480,
          220
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      },
      {
        "id": "fca76fc6-b899-4c5d-9c11-65b3d0a54887",
        "name": "Sticky Note8",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -660,
          440
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      },
      {
        "id": "7b0b3de2-1e8f-47b0-a010-4d11dba2675d",
        "name": "AI Agent",
        "type": "@n8n/n8n-nodes-langchain.agent",
        "position": [
          -660,
          260
        ],
        "parameters": {},
        "typeVersion": 1.9
      },
      {
        "id": "fdfb5bae-c5fc-4361-a4d1-b16432d04db9",
        "name": "SendNewsletter",
        "type": "n8n-nodes-base.gmail",
        "position": [
          1340,
          200
        ],
        "webhookId": "022cecdc-57ff-40f8-b4d7-530b1200b742",
        "parameters": {},
        "typeVersion": 2.1
      },
      {
        "id": "975cebdf-8fa4-4ad9-9269-fe84452b27ed",
        "name": "Perplexity Search",
        "type": "n8n-nodes-base.httpRequestTool",
        "position": [
          -540,
          540
        ],
        "parameters": {},
        "typeVersion": 4.2
      },
      {
        "id": "a40df2aa-dfb9-48b5-bd84-1ecb24e85244",
        "name": "Tavily WebSearch",
        "type": "n8n-nodes-base.httpRequestTool",
        "disabled": true,
        "position": [
          -540,
          900
        ],
        "parameters": {},
        "typeVersion": 4.2
      },
      {
        "id": "dbe7b40e-e291-49e8-b82e-4e770f676c9b",
        "name": "Sticky Note9",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -660,
          720
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      }
    ],
    "active": false,
    "pinData": {},
    "settings": {
      "timezone": "Europe/London",
      "callerPolicy": "workflowsFromSameOwner",
      "errorWorkflow": "DmAbBBIenIBq7D7F",
      "executionOrder": "v1"
    },
    "versionId": "23c4c84f-b713-4280-867f-856c198ec883",
    "connections": {
      "Input": {
        "main": [
          [
            {
              "node": "AI Agent",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Merge": {
        "main": [
          [
            {
              "node": "SendNewsletter",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "AI Agent": {
        "main": [
          [
            {
              "node": "GPT Image Generation",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "SetImageURL1": {
        "main": [
          [
            {
              "node": "Merge",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "UpdateStatus": {
        "main": [
          [
            {
              "node": "Input",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "GetClientList": {
        "main": [
          [
            {
              "node": "Merge",
              "type": "main",
              "index": 1
            }
          ]
        ]
      },
      "GetFirstTopic": {
        "main": [
          [
            {
              "node": "UpdateStatus",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "SendNewsletter": {
        "main": [
          []
        ]
      },
      "Schedule Trigger": {
        "main": [
          [
            {
              "node": "GetNewsletterTopic",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Tavily WebSearch": {
        "ai_tool": [
          []
        ]
      },
      "OpenAI Chat Model": {
        "ai_languageModel": [
          [
            {
              "node": "AI Agent",
              "type": "ai_languageModel",
              "index": 0
            }
          ]
        ]
      },
      "Perplexity Search": {
        "ai_tool": [
          [
            {
              "node": "AI Agent",
              "type": "ai_tool",
              "index": 0
            }
          ]
        ]
      },
      "GetNewsletterTopic": {
        "main": [
          [
            {
              "node": "GetFirstTopic",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "GPT Image Generation": {
        "main": [
          [
            {
              "node": "Convert to Binary File",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Convert to Binary File": {
        "main": [
          [
            {
              "node": "GetClientList",
              "type": "main",
              "index": 0
            },
            {
              "node": "Google Cloud Storage 2",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Google Cloud Storage 2": {
        "main": [
          [
            {
              "node": "SetImageURL1",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Structured Output Parser1": {
        "ai_outputParser": [
          [
            {
              "node": "AI Agent",
              "type": "ai_outputParser",
              "index": 0
            }
          ]
        ]
      }
    }
  },
  "workflowInfo": {
    "nodeCount": 29,
    "nodeTypes": {
      "n8n-nodes-base.set": {
        "count": 2
      },
      "n8n-nodes-base.gmail": {
        "count": 1
      },
      "n8n-nodes-base.limit": {
        "count": 1
      },
      "n8n-nodes-base.merge": {
        "count": 1
      },
      "n8n-nodes-base.stickyNote": {
        "count": 12
      },
      "n8n-nodes-base.httpRequest": {
        "count": 1
      },
      "n8n-nodes-base.googleSheets": {
        "count": 3
      },
      "n8n-nodes-base.convertToFile": {
        "count": 1
      },
      "@n8n/n8n-nodes-langchain.agent": {
        "count": 1
      },
      "n8n-nodes-base.httpRequestTool": {
        "count": 2
      },
      "n8n-nodes-base.scheduleTrigger": {
        "count": 1
      },
      "n8n-nodes-base.googleCloudStorage": {
        "count": 1
      },
      "@n8n/n8n-nodes-langchain.lmChatOpenAi": {
        "count": 1
      },
      "@n8n/n8n-nodes-langchain.outputParserStructured": {
        "count": 1
      }
    }
  },
  "nodes": [
    "Input",
    "Sticky Note7",
    "Sticky Note20",
    "Schedule Trigger",
    "Sticky Note3",
    "Structured Output Parser1",
    "OpenAI Chat Model",
    "Sticky Note10",
    "Sticky Note15",
    "Sticky Note19",
    "SetImageURL1",
    "Google Cloud Storage 2",
    "Sticky Note21",
    "GetClientList",
    "Merge",
    "GetNewsletterTopic",
    "UpdateStatus",
    "Sticky Note",
    "GetFirstTopic",
    "Sticky Note6",
    "GPT Image Generation",
    "Convert to Binary File",
    "Sticky Note1",
    "Sticky Note8",
    "AI Agent",
    "SendNewsletter",
    "Perplexity Search",
    "Tavily WebSearch",
    "Sticky Note9"
  ],
  "nodeTypes": [
    "@n8n/n8n-nodes-langchain.agent",
    "n8n-nodes-base.httpRequest",
    "n8n-nodes-base.httpRequestTool",
    "n8n-nodes-base.limit",
    "@n8n/n8n-nodes-langchain.outputParserStructured",
    "n8n-nodes-base.gmail",
    "n8n-nodes-base.convertToFile",
    "n8n-nodes-base.stickyNote",
    "n8n-nodes-base.merge",
    "n8n-nodes-base.scheduleTrigger",
    "n8n-nodes-base.googleSheets",
    "n8n-nodes-base.googleCloudStorage",
    "n8n-nodes-base.set",
    "@n8n/n8n-nodes-langchain.lmChatOpenAi"
  ]
}