{
  "id": "78yYRensL5z0adQK",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Smart Email Marketing Generator via Excel + AI (Sheet to Inbox)",
  "tags": [],
  "nodes": [
    {
      "id": "e7f44537-37ee-4ce8-8d9a-25e1e512bcbe",
      "name": "Generate Marketing Content with AI",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -220,
        80
      ],
      "parameters": {
        "text": "=You are an expert sales copywriter. Based on the provided offer data, generate a persuasive and emotionally engaging promotional message for WhatsApp or Email that motivates immediate customer action.\n\n\ud83c\udfaf **Objective:**\nEncourage purchases by emphasizing value, benefits, urgency, and exclusivity with a detailed, impactful message.\n\n\ud83d\udccc **Format Guidelines:**\n- Keep under 150 words.\n- Use short, readable lines for WhatsApp/email.\n- Include 3\u20135 well-placed emojis for visual appeal.\n- Write in a warm, enthusiastic, benefit-driven tone.\n- Use bold hooks, clear product benefits, urgency, and rewards.\n- Structure with multiple unordered lists (`<ul>`) for impact and readability.\n\n\ud83d\udccb **Offer Data:**\n- Title: {{ $json.title }}\n- Discount: {{ $json.discount }}\n- Validity: {{ $json.validity }}\n- Products Included: {{ $json.products_included }}\n- Original Price: {{ $json.original_price }}\n- Discounted Price: {{ $json.discounted_price }}\n- Bonus Item: {{ $json.bonus }}\n- Call to Action: {{ $json.cta }}\n\n---\n\n\ud83d\udce2 **Message Structure:**\n1. Start with a catchy, energetic title using 1\u20132 emojis and {{ $json.title }}.\n2. Hook with emotional language (e.g., \u201crefresh your style,\u201d \u201cupgrade your look\u201d).\n3. State {{ $json.discounted_price }} vs {{ $json.original_price }} and {{ $json.discount }} as a steal.\n4. List {{ $json.products_included }} in a `<ul>` with specific benefits (e.g., fabric, fit, usage).\n5. Highlight bundle value in a second `<ul>` (e.g., quality, versatility, savings).\n6. Present {{ $json.bonus }} as an exclusive gift with an emoji (e.g., \ud83c\udf81).\n7. Emphasize urgency with {{ $json.validity }} and \u201climited stock\u201d using \u23f3.\n8. End with a motivational line and {{ $json.cta }} to create FOMO.\n\n---\n\n\ud83e\uddfe **Sample Output Format:**\n\n\ud83d\udd25 LAST CHANCE: {{ $json.title }}! \ud83c\udf1e\n\nReady to refresh your style? Grab this **limited-time deal** curated for you!\n\n\ud83d\udcb8 Only {{ $json.discounted_price }} ({{ $json.discount }} OFF {{ $json.original_price }}) \u2014 save big now!\n\n\u2728 **What\u2019s Included:**\n<ul>\n  <li>\ud83d\udc55 Stylish Shirt \u2013 breathable cotton for all-day comfort</li>\n  <li>\ud83d\udc54 Classic T-Shirt \u2013 perfect for any summer vibe</li>\n</ul>\n\n\ud83d\udecd\ufe0f **Why You\u2019ll Love It:**\n<ul>\n  <li>\u2714\ufe0f Premium quality at a steal</li>\n  <li>\u2714\ufe0f Versatile looks for any occasion</li>\n  <li>\u2714\ufe0f Curated bundle, no guesswork</li>\n</ul>\n\n\ud83c\udf81 **Exclusive Bonus:** {{ $json.bonus }} \u2013 yours free!\n\n\u23f3 **Hurry!** Offer ends {{ $json.validity }}. Limited stock!\n\n\ud83d\udc49 Don\u2019t wait \u2013 {{ $json.cta }} now to slay the season in style!\n\n---\n\n\u2705 **Notes:**\n- Make the message personal, warm, and engaging.\n- Avoid robotic or templated language.\n- Use `<ul>` for product details and benefits to enhance readability.\n- Ensure clear formatting with emojis, short lines, and emotional appeal.\n- Do not include notes or explanations in the output.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "ba71be80-b532-40d5-8bdf-c4bbf48c28e0",
      "name": "Format Personalized Email",
      "type": "n8n-nodes-base.code",
      "position": [
        360,
        80
      ],
      "parameters": {
        "jsCode": "const emails = items.map(item => item.json.Emial);\nreturn [\n  {\n    json: {\n      allEmails: emails.join(\", \"),\n      output : $('Generate Marketing Content with AI').first().json.output\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "bf3e161a-be8b-45b5-859d-b5404fe0264b",
      "name": " Send Marketing Email to Client",
      "type": "n8n-nodes-base.gmail",
      "position": [
        580,
        80
      ],
      "parameters": {
        "sendTo": "={{ $json.allEmails }}",
        "message": "={{ $json.output }}",
        "options": {},
        "subject": "Offer",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "57b81093-4e88-497a-a70c-fb3f5923bd06",
      "name": "Llama 3.2 - Promo Content Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "position": [
        -140,
        300
      ],
      "parameters": {
        "model": "llama3.2-16000:latest",
        "options": {}
      },
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f3e90e4d-d8af-4964-b7cd-bf017d2076fe",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -840,
        -300
      ],
      "parameters": {
        "width": 480,
        "height": 200,
        "content": "This workflow auto-generates and sends personalized marketing emails using data from two Google Sheets:\n\nSheet 1: Marketing Offer Details\n\nSheet 2: Client Information\n\nIt uses an AI model to create compelling content, formats it, and sends it to each client via email.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8ed442d2-c771-4619-8935-e64134b7582c",
      "name": "Track Offer Sheet Updates (Sheet 1)",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -440,
        80
      ],
      "parameters": {
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1574728929,
          "cachedResultUrl": "https://docs.google.YOUR_AWS_SECRET_KEY_HERE-KUBcMjhuUw0PydGjLbbEVg/edit#gid=1574728929",
          "cachedResultName": "Sheet2"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1kRRDSoJNzVQAUbunYzAk-KUBcMjhuUw0PydGjLbbEVg",
          "cachedResultUrl": "https://docs.google.YOUR_AWS_SECRET_KEY_HERE-KUBcMjhuUw0PydGjLbbEVg/edit?usp=drivesdk",
          "cachedResultName": "Customer_details"
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "eee33c6c-0513-47ae-b097-70ce2a610243",
      "name": "Fetch Client List (Sheet 2)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        140,
        80
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.YOUR_AWS_SECRET_KEY_HERE-KUBcMjhuUw0PydGjLbbEVg/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1kRRDSoJNzVQAUbunYzAk-KUBcMjhuUw0PydGjLbbEVg",
          "cachedResultUrl": "https://docs.google.YOUR_AWS_SECRET_KEY_HERE-KUBcMjhuUw0PydGjLbbEVg/edit?usp=drivesdk",
          "cachedResultName": "Customer_details"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b95c6aa6-6060-4f25-92d0-f1e6ff06bda9",
  "connections": {
    "Format Personalized Email": {
      "main": [
        [
          {
            "node": " Send Marketing Email to Client",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Client List (Sheet 2)": {
      "main": [
        [
          {
            "node": "Format Personalized Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Llama 3.2 - Promo Content Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Marketing Content with AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Generate Marketing Content with AI": {
      "main": [
        [
          {
            "node": "Fetch Client List (Sheet 2)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Track Offer Sheet Updates (Sheet 1)": {
      "main": [
        [
          {
            "node": "Generate Marketing Content with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}