{
  "id": "iVU3Gnx97JrivXeE",
  "meta": {
    "builderVariant": "mcp",
    "aiBuilderAssisted": true
  },
  "name": "Learn n8n basics by sending AI-personalized quotes to your inbox with OpenAI and Gmail",
  "tags": [],
  "nodes": [
    {
      "id": "895e9148-7c12-4e61-89c1-93c7d06c290d",
      "name": "1. Click 'Execute workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        368,
        -176
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "85fc57ee-2006-45e3-8428-187a232ee129",
      "name": "2. Get an inspirational quote",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        592,
        -176
      ],
      "parameters": {
        "url": "https://zenquotes.io/api/random",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "64da0d7a-ebb3-42fc-89c8-f101337f7e27",
      "name": "3. See the results",
      "type": "n8n-nodes-base.set",
      "position": [
        800,
        -176
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "s1-quote",
              "name": "quote",
              "type": "string",
              "value": "={{ $json.q }}"
            },
            {
              "id": "s1-author",
              "name": "author",
              "type": "string",
              "value": "={{ $json.a }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9570557b-a9ca-44bd-80a2-ec7698335a07",
      "name": "Every morning at 7am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        352,
        288
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 7
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "fd76dc8d-dce0-42c8-9aef-2242ab3bd432",
      "name": "Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        608,
        288
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cfg-send-to",
              "name": "send_to",
              "type": "string",
              "value": ""
            },
            {
              "id": "cfg-language",
              "name": "output_language",
              "type": "string",
              "value": "English"
            },
            {
              "id": "cfg-model",
              "name": "ai_model",
              "type": "string",
              "value": "gpt-4o-mini"
            },
            {
              "id": "cfg-subject",
              "name": "email_subject",
              "type": "string",
              "value": "Your daily dose of motivation"
            },
            {
              "id": "cfg-style",
              "name": "coaching_style",
              "type": "string",
              "value": "warm, practical morning coach"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "44a68fdb-5122-4e2b-9f94-52bcbcb7832b",
      "name": "Get a fresh quote",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        832,
        288
      ],
      "parameters": {
        "url": "https://zenquotes.io/api/random",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "7292655e-f8e5-4e5f-9da8-2b4b1ec8b003",
      "name": "Clean up the data",
      "type": "n8n-nodes-base.set",
      "position": [
        1072,
        288
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "s2-quote",
              "name": "quote",
              "type": "string",
              "value": "={{ $json.q }}"
            },
            {
              "id": "s2-author",
              "name": "author",
              "type": "string",
              "value": "={{ $json.a }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "6e69f7b2-ada3-47d4-9dc3-b84c276f91e6",
      "name": "Personalize the quote with AI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1296,
        288
      ],
      "parameters": {
        "images": {
          "values": [
            {}
          ]
        },
        "modelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Configuration').item.json.ai_model }}"
        },
        "options": {
          "maxTokens": 300
        },
        "responses": {
          "values": [
            {
              "role": "system",
              "content": "=You are a {{ $('Configuration').item.json.coaching_style }}. Always reply in {{ $('Configuration').item.json.output_language }}, in plain text only (no markdown)."
            },
            {
              "content": "=Here is today's inspirational quote:\n\n\"{{ $json.quote }}\" by {{ $json.author }}\n\nWrite a short, uplifting note (3-4 sentences) that explains how to apply this quote today. Do not repeat the quote itself."
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "a1129bd7-b273-4bfd-bf72-8fb372c39c58",
      "name": "Extract the AI message",
      "type": "n8n-nodes-base.set",
      "position": [
        1552,
        288
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "s3-ai",
              "name": "ai_message",
              "type": "string",
              "value": "={{ $json.message?.content ?? $json.output?.[0]?.content?.[0]?.text ?? $json.text ?? '' }}"
            },
            {
              "id": "s3-quote",
              "name": "quote",
              "type": "string",
              "value": "={{ $('Clean up the data').item.json.quote }}"
            },
            {
              "id": "s3-author",
              "name": "author",
              "type": "string",
              "value": "={{ $('Clean up the data').item.json.author }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fa2c2416-086a-44a0-be38-36036d7b0b69",
      "name": "Send it to your inbox",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1744,
        288
      ],
      "parameters": {
        "sendTo": "={{ $('Configuration').item.json.send_to }}",
        "message": "=Good morning\n\n\"{{ $json.quote }}\"\nby {{ $json.author }}\n\n{{ $json.ai_message }}\n\nHave a great day!",
        "options": {},
        "subject": "={{ $('Configuration').item.json.email_subject }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "da6dbd25-2d57-4da6-ab64-ef74804eb7f0",
      "name": "Run the challenge",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        464,
        960
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "faf96fbb-1ee9-4918-9274-32a610caf3f9",
      "name": "Get a quote",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        704,
        960
      ],
      "parameters": {
        "url": "https://zenquotes.io/api/random",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "34cdc0d6-d71d-4f63-bbf4-1b5921aa153b",
      "name": "Get a programming joke",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        944,
        960
      ],
      "parameters": {
        "url": "https://v2.jokeapi.dev/joke/Programming?blacklistFlags=nsfw,religious,political,racist,sexist,explicit&type=single",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "614f06f9-9009-4dd8-9508-e4ff82a678d4",
      "name": "Your turn: map the fields",
      "type": "n8n-nodes-base.set",
      "position": [
        1200,
        960
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ch-author",
              "name": "author",
              "type": "string",
              "value": ""
            },
            {
              "id": "ch-quote",
              "name": "quote",
              "type": "string",
              "value": ""
            },
            {
              "id": "ch-joke",
              "name": "joke",
              "type": "string",
              "value": ""
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f12b9d82-ef4c-4234-9005-badd8ff1db37",
      "name": "Sticky Note 675bd03d",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -640
      ],
      "parameters": {
        "width": 720,
        "height": 1728,
        "content": "# Learn n8n basics by sending AI-personalized quotes to your inbox with OpenAI and Gmail\n\n# \ud83d\udce5  [Open full documentation on Notion](https://automatisation.notion.site/Course-Learn-n8n-basics-by-sending-AI-personalized-quotes-to-your-inbox-with-OpenAI-and-Gmail-39e3d6550fd981cca505db607c951c89)\n\n## How it works\nNew to n8n? This tutorial teaches you the fundamentals in 3 hands-on steps:\n1. **Run your first workflow** - click \"Execute workflow\" to fetch a random inspirational quote from a public API and watch data flow from node to node.\n2. **Add AI, a schedule and email** - a Schedule trigger runs every morning, OpenAI turns the quote into a short personalized coaching note in your language, and Gmail delivers it to your inbox.\n3. **Take the challenge** - fetch a programming joke and practice mapping fields on your own.\n\n## Setup\n1. Open the **Configuration** node and set `send_to` (your email address), `output_language`, `ai_model` and `email_subject`. This is the ONLY node you need to edit.\n2. Select your **OpenAI** credential on the \"Personalize the quote with AI\" node.\n3. Connect your **Gmail** account on the \"Send it to your inbox\" node.\n4. Test Step 1 first, then execute Step 2 from the Schedule trigger.\n\n## Requirements\n- An OpenAI API key (any GPT model)\n- A Gmail account connected via OAuth2\n- No code required - perfect for complete beginners\n\n## Customization\n- Change the delivery time in the Schedule trigger.\n- Adjust the tone with `coaching_style` or switch `output_language` (French, Spanish...).\n- Swap the ZenQuotes API for any public API (weather, news...).\n- Replace Gmail with Slack or Telegram to deliver the message elsewhere.\n\nNeed help customizing?\nContact me for consulting and support : [Linkedin](https://www.linkedin.com/in/doctor-firass/)\n\n# MY NEW YOUTUBE CHANNEL\n\ud83d\udc49 [Subscribe to my new YouTube channel](https://www.youtube.com/@DrFiras_AI). Here I'll share videos and Shorts with practical tutorials and FREE templates for n8n.\n\n[![The AI Doctor](https://www.dr-firas.com/the-ai-doctor.png)](https://www.youtube.com/@DrFiras_AI)"
      },
      "typeVersion": 1
    },
    {
      "id": "930345af-dbbe-4645-a8ce-90289251a7b0",
      "name": "Sticky Note eb725cb5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        -416
      ],
      "parameters": {
        "color": 7,
        "width": 688,
        "height": 384,
        "content": "## Step 1 - Run your first workflow\n\n1. Click \"Execute workflow\" to run it\n2. It fetches a random inspirational quote from the internet\n3. Double-click the last node to see the quote you got"
      },
      "typeVersion": 1
    },
    {
      "id": "bb54e969-451a-4967-895a-37d7529a28e3",
      "name": "Sticky Note f9e61672",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        64
      ],
      "parameters": {
        "color": 7,
        "width": 1664,
        "height": 384,
        "content": "## Step 2 - Add AI, a schedule and email\n\n1. Set your variables in \"Configuration\" (email, language, model)\n2. Select your OpenAI credential, then connect your Gmail\n3. To test, click \"Execute workflow\" on the Schedule trigger - every morning the AI turns a fresh quote into a personal coaching note and emails it to you"
      },
      "typeVersion": 1
    },
    {
      "id": "36b9d47c-45bc-437a-8cb8-73e17c502518",
      "name": "Sticky Note 3a6a8cb0",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        464
      ],
      "parameters": {
        "color": 3,
        "width": 256,
        "height": 232,
        "content": "### Configure everything here\nSet `send_to`, `output_language`, `ai_model`, `email_subject` - one single place, no need to open other nodes."
      },
      "typeVersion": 1
    },
    {
      "id": "36ced676-2798-4611-ba59-0f1454c5537e",
      "name": "Sticky Note 705b5c43",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        752
      ],
      "parameters": {
        "color": 7,
        "width": 1056,
        "height": 384,
        "content": "## Step 3 - Your challenge\n\n1. Execute this branch and check the new \"Programming joke\" output\n2. Open \"Your turn: map the fields\" and try mapping quote, author and joke yourself\n3. Bonus: add a Gmail node at the end to email your creation"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": true,
    "executionOrder": "v1"
  },
  "versionId": "fd11cf39-1c41-47ef-be8f-643712fceb9b",
  "nodeGroups": [],
  "connections": {
    "Get a quote": {
      "main": [
        [
          {
            "node": "Get a programming joke",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configuration": {
      "main": [
        [
          {
            "node": "Get a fresh quote",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean up the data": {
      "main": [
        [
          {
            "node": "Personalize the quote with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a fresh quote": {
      "main": [
        [
          {
            "node": "Clean up the data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run the challenge": {
      "main": [
        [
          {
            "node": "Get a quote",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every morning at 7am": {
      "main": [
        [
          {
            "node": "Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract the AI message": {
      "main": [
        [
          {
            "node": "Send it to your inbox",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a programming joke": {
      "main": [
        [
          {
            "node": "Your turn: map the fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1. Click 'Execute workflow'": {
      "main": [
        [
          {
            "node": "2. Get an inspirational quote",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2. Get an inspirational quote": {
      "main": [
        [
          {
            "node": "3. See the results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Personalize the quote with AI": {
      "main": [
        [
          {
            "node": "Extract the AI message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}