{
  "id": "DSxmKG8H861zKUw8",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI Generated Email Newsletter",
  "tags": [],
  "nodes": [
    {
      "id": "a915b64b-1052-4cd1-aca9-0325c1b2c29d",
      "name": "Workflow Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -120,
        -140
      ],
      "parameters": {
        "color": 6,
        "width": 450,
        "height": 420,
        "content": "## Daily AI News Summary Workflow\n\nThis workflow runs every day at 8 AM to:\n\n1. **Fetch Latest AI News**: Uses Perplexity to find recent AI developments\n2. **Categorize Content and draft summary for newsletter...'"
      },
      "typeVersion": 1
    },
    {
      "id": "3c6ef52a-3c4b-4d0e-be08-d496c407fa66",
      "name": "Setup Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        0
      ],
      "parameters": {
        "color": 3,
        "width": 580,
        "height": 280,
        "content": "\u2699\ufe0f **Configuration Needed:**\n\n1. **AI Agent**: Add your Chat Model API key to the \"AI Agent\"\n\n2. **Email Settings**: \n   - Add your Gmail Credentials\n   - Add subject a[...]"
      },
      "typeVersion": 1
    },
    {
      "id": "2f165ff5-7666-4f7b-93e0-73556ad9ed7a",
      "name": "Set Dates1",
      "type": "n8n-nodes-base.set",
      "position": [
        60,
        360
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "current-date",
              "name": "currentDate",
              "type": "string",
              "value": "={{ $now.format('yyyy-MM-dd') }}"
            },
            {
              "id": "yesterday-date",
              "name": "lastweekDate",
              "type": "string",
              "value": "={{ $now.minus({days: 7}).format('yyyy-MM-dd') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "419a0eac-33f1-4349-ba54-a0a428ef8c1b",
      "name": "Gmail1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        880,
        360
      ],
      "parameters": {
        "sendTo": "jyothi.swarup@techdome.net.in",
        "message": "={{ $json.html }}",
        "options": {},
        "subject": "={{ $json.subject }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "57cb8666-b3ff-489b-a6a5-be329ad82ab5",
      "name": "Format Email Content",
      "type": "n8n-nodes-base.code",
      "position": [
        660,
        360
      ],
      "parameters": {
        "jsCode": "// n8n Code Node - Email Formatter for AI Newsletter\n// This code formats the AI agent output for email sending\n\n// Get the AI agent output from the previous node\nconst aiOutput[...]"
      },
      "typeVersion": 2
    },
    {
      "id": "9a9676bb-d645-49fc-84ab-5a5c0cd92645",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        280,
        360
      ],
      "parameters": {
        "text": "=Newsletter Structure\n1. Title\nEngaging and punchy (under 10 words).\n\nIncludes a relevant keyword (e.g., \"AI\", \"Claude\", \"Machine Learning\").\n\n2. Editor's Note (Op[...]",
        "options": {
          "systemMessage": "You are an AI writing assistant tasked with creating a weekly newsletter about artificial intelligence (AI). The goal is to inform, engage, and educate readers ranging from[...]"
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "4e5e19a9-b05f-4ef0-a432-a0e72c479095",
      "name": "Openrouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        260,
        520
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "credentials": {
        "openrouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e7dbd62a-6580-4a28-ab85-5fdf885dacf0",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -140,
        360
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e0cf8d41-3776-4aab-a5ec-fd16b8bc7457",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Format Email Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Dates1": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Set Dates1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Email Content": {
      "main": [
        [
          {
            "node": "Gmail1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Openrouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}