8
n8n 中文网amn8n.com

规划每周膳食并将食材添加到Notion(Cron + 邮件)

高级

这是一个Personal Productivity, Multimodal AI领域的自动化工作流,包含 20 个节点。主要使用 If, Set, Code, Cron, Notion 等节点。 在Notion中生成每周购物清单并自动发送邮件通知

前置要求
  • Notion API Key
  • Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "8UQEEzm7Vbhc46n5",
  "meta": {
    "instanceId": "8c8b20afd941aa66690830b5f1f0b9d7a4611a25b0382c8675a2fab2026ff320",
    "templateCredsSetupCompleted": true
  },
  "name": "Plan weekly meals and add groceries to Notion (Cron + Email)",
  "tags": [],
  "nodes": [
    {
      "id": "c9419408-69ff-4a74-bba7-568633b6617c",
      "name": "README – Template Description",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1264,
        0
      ],
      "parameters": {
        "width": 480,
        "height": 888,
        "content": "## Who's it for\nBusy homemakers, creators, and parents who want an elegant, zero-cost way to plan weekly meals.\n\n## What it does\n- Runs every Sunday at 6 PM\n- Pulls a built-in list of 7 sample recipes  \n- Adds ingredients to a **Notion database** grocery list  \n- Emails the list (or Telegram) so you’re ready for the week\n\n## How to set up\n1. Import this workflow  \n2. Add **Notion** credential → connect your **Meal Planner** database  \n3. Add **SMTP** credential (or Telegram)  \n4. Activate\n\n## Requirements\n- Free Notion account  \n- SMTP or Telegram credential (optional)  \n\n## How to customize\n- Change Cron day/time  \n- Swap the recipe list for your own  \n- Add dietary tags or portions in Notion\n\n## Change weekly time\nOpen **Cron: Weekly Meal Plan (Sun 6 PM)** and set your preferred day/time.\n_Tip:_ For testing, switch to **Every minute**, then set it back to **Every week** before activating.\n\n\n## Reliability\nThis template includes a Notion connection check and simple error notifications so failures are surfaced instantly."
      },
      "typeVersion": 1,
      "backgroundColor": "#FFF2CC"
    },
    {
      "id": "51f1ed9d-ba40-4f05-874b-fbcf3d08bb8e",
      "name": "Cron: Weekly Meal Plan (Sun 6 PM)",
      "type": "n8n-nodes-base.cron",
      "position": [
        -864,
        448
      ],
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "mode": "custom",
              "cronExpression": "0 18 * * 0"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b2e86a43-dc0a-454a-9e44-4396fd8ee13a",
      "name": "Set: Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -640,
        448
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "recipeList",
              "value": "- 🌸 Creamy Tuscan Chicken\n- 🥗 Lemon-Garlic Shrimp Salad\n- 🍝 One-Pan Veggie Pasta\n- 🥦 Teriyaki Salmon & Rice\n- 🍕 Margherita Flatbread\n- 🍫 Dark-Choc Overnight Oats\n- 🥒 Cucumber-Lime Smoothie"
            },
            {
              "name": "emailTo",
              "value": "recipient@example.com"
            },
            {
              "name": "notionDb",
              "value": "YOUR_NOTION_DB_ID"
            },
            {
              "name": "telegramChatId"
            },
            {
              "name": "fromEmail",
              "value": "sender@example.com"
            },
            {
              "name": "notifyEmail",
              "value": "owner@example.com"
            },
            {
              "name": "notionLogDb",
              "value": "YOUR_NOTION_LOG_DB_ID"
            }
          ],
          "boolean": [
            {
              "name": "sendTelegram"
            },
            {
              "name": "logToNotion"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 2
    },
    {
      "id": "aaade1ef-c090-4c13-a0a2-f99b7b3c9efa",
      "name": "Code: Generate Grocery Items",
      "type": "n8n-nodes-base.code",
      "position": [
        -192,
        448
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "f6208598-ef71-4233-8539-51d2c63162a4",
      "name": "Notion: Add to Grocery List",
      "type": "n8n-nodes-base.notion",
      "position": [
        32,
        448
      ],
      "parameters": {
        "options": {},
        "resource": "databasePage",
        "databaseId": "={{ $json.notionDb}}"
      },
      "typeVersion": 2
    },
    {
      "id": "7288a4a3-3cfe-4053-b6b7-fd2a75eaa7dd",
      "name": "IF: Telegram Enabled?",
      "type": "n8n-nodes-base.if",
      "position": [
        480,
        352
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.sendTelegram}}",
              "operation": "is true"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "342b2a5c-8484-4ded-816b-ca71daf29493",
      "name": "Email: Send Grocery List",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        256,
        328
      ],
      "webhookId": "c7d2fd33-951c-4a4f-9953-c7465edda04c",
      "parameters": {
        "text": "Hi! Here’s your elegant weekly grocery list:\n{{ $json.recipeList }}\n\nHappy cooking!",
        "options": {},
        "subject": "🛒 This Week’s Grocery List",
        "toEmail": "={{ $json.emailTo}}",
        "fromEmail": "={{ $json.fromEmail}}"
      },
      "typeVersion": 2
    },
    {
      "id": "08b75965-a564-4934-bc34-b5054b2b60d3",
      "name": "Telegram: Confirmation",
      "type": "n8n-nodes-base.telegram",
      "position": [
        704,
        352
      ],
      "webhookId": "5a46242e-398e-410e-9666-51afa569577e",
      "parameters": {
        "text": "🛒 Grocery list emailed! Happy cooking 🌸",
        "chatId": "={{ $json.telegramChatId}}",
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "f9705add-d781-48e2-b181-64de111be8d3",
      "name": "Setup Tips",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        80
      ],
      "parameters": {
        "width": 500,
        "height": 200,
        "content": "### Quick Tune-ups\n- [ ] Add Notion credential → connect your **Meal Planner** database  \n- [ ] Add SMTP (or Telegram) credential  \n- [ ] Edit recipes or Cron time in **Set: Configuration**  \n- [ ] Test once by changing Cron to `Every minute`, then revert"
      },
      "typeVersion": 1,
      "backgroundColor": "#FFFFFF"
    },
    {
      "id": "cae9cd00-0605-4d52-9c17-380e1abe9e75",
      "name": "Notion: Validate Database Connection",
      "type": "n8n-nodes-base.notion",
      "notes": "Checks access to the Notion database ID before creating pages.",
      "position": [
        -416,
        448
      ],
      "parameters": {
        "resource": "database",
        "databaseId": "={{ $json.notionDb }}"
      },
      "credentials": {
        "notionApi": {
          "id": "Gx5gB3LfWa4PIPIy",
          "name": "Notion account"
        }
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "39d75fb3-c322-4e6f-9e0c-14b563a0e8ce",
      "name": "Catch: Error Handling",
      "type": "n8n-nodes-base.set",
      "notes": "Receives error output from upstream nodes and forwards to error email.",
      "position": [
        704,
        544
      ],
      "parameters": {
        "options": {}
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "3020db74-fdf7-4633-b7b6-c1e040d6bbaa",
      "name": "Email: Send Error Notification",
      "type": "n8n-nodes-base.emailSend",
      "notes": "Attach SMTP credentials after import.",
      "position": [
        1152,
        544
      ],
      "webhookId": "4c55e50f-ae36-449c-8f1e-496b057a7668",
      "parameters": {
        "text": "A workflow error occurred.\nNode: {{$json.errorNode}}\nMessage: {{$json.errorMessage}}\nWhen: {{$json.timestamp}}\n\n{{ $json.errorStack ? ('Stack:\\n' + $json.errorStack) : '' }}",
        "options": {},
        "subject": "❗ Meal Planner – Error in {{$json.errorNode}}",
        "toEmail": "={{ $json.notifyEmail }}",
        "fromEmail": "={{ $json.fromEmail }}"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "c854bddb-ac88-4d48-b124-40a63bf9b38e",
      "name": "Email: Send Success Notification",
      "type": "n8n-nodes-base.emailSend",
      "notes": "Optional success notice; can be disabled before submit if you prefer.",
      "position": [
        480,
        160
      ],
      "webhookId": "84c9a9a9-2a08-4947-800b-1f2fd5b26b36",
      "parameters": {
        "text": "Your weekly grocery list has been created and emailed.\nGenerated at: {{$json.generatedAtHuman}} ({{$json.generatedAt}})\n\nRecipes:\n{{$json.recipeList}}\n\nGrocery List:\n{{$json.groceryList}}",
        "options": {},
        "subject": "✅ Meal Planner – Success",
        "toEmail": "={{ $json.notifyEmail }}",
        "fromEmail": "={{ $json.fromEmail }}"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "2af14a15-4442-47e9-8c4b-0a485d3b1a39",
      "name": "Log: Workflow Execution",
      "type": "n8n-nodes-base.set",
      "notes": "Placeholder logger. Replace with Notion/Sheets if you want persistent logs.",
      "position": [
        -720,
        -96
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "status",
              "value": "success"
            },
            {
              "name": "timestamp",
              "value": "={{ (new Date()).toISOString() }}"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "0c3ca0a5-da6e-4dfe-9b20-d7e08b63239d",
      "name": "Format: Error Payload",
      "type": "n8n-nodes-base.code",
      "notes": "Normalizes error details for notifications and logging.",
      "position": [
        928,
        544
      ],
      "parameters": {},
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "25aacfc2-14ce-4825-b286-2bb96852c2f9",
      "name": "IF: Telegram Enabled (Error)?",
      "type": "n8n-nodes-base.if",
      "position": [
        1152,
        736
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.sendTelegram }}",
              "operation": "is true"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b2afc239-0a18-43b6-be34-62500a5da118",
      "name": "Telegram: Error Notification",
      "type": "n8n-nodes-base.telegram",
      "notes": "Optional Telegram error alert.",
      "position": [
        1376,
        736
      ],
      "webhookId": "04f74ba6-dfc8-4c56-96c1-02438dcf85bc",
      "parameters": {
        "text": "⚠️ Meal Planner error in {{$json.errorNode}}:\\n{{$json.errorMessage}}\\n{{$json.timestamp}}",
        "chatId": "={{ $json.telegramChatId }}",
        "additionalFields": {}
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "fa604269-843c-4a91-9771-66d852c01e2e",
      "name": "IF: Log to Notion?",
      "type": "n8n-nodes-base.if",
      "position": [
        704,
        160
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.logToNotion }}",
              "operation": "is true"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "86f13624-de11-4f3e-9c34-14a82029767c",
      "name": "Notion: Append Log Entry (Success)",
      "type": "n8n-nodes-base.notion",
      "notes": "Optional persistent logging to Notion.",
      "position": [
        928,
        160
      ],
      "parameters": {
        "options": {},
        "resource": "databasePage",
        "databaseId": "={{ $json.notionLogDb }}"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "57e2a84d-1d70-4260-b712-452791ad9de3",
      "name": "Notion: Append Log Entry (Error)",
      "type": "n8n-nodes-base.notion",
      "position": [
        1152,
        352
      ],
      "parameters": {
        "options": {},
        "resource": "databasePage",
        "databaseId": "={{ $json.notionLogDb }}"
      },
      "notesInFlow": true,
      "typeVersion": 2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c1b0c323-3026-4acb-96be-4a6d3c332c36",
  "connections": {
    "IF: Log to Notion?": {
      "main": [
        [
          {
            "node": "Notion: Append Log Entry (Success)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set: Configuration": {
      "main": [
        [
          {
            "node": "Notion: Validate Database Connection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Catch: Error Handling": {
      "main": [
        [
          {
            "node": "Format: Error Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format: Error Payload": {
      "main": [
        [
          {
            "node": "Email: Send Error Notification",
            "type": "main",
            "index": 0
          },
          {
            "node": "IF: Telegram Enabled (Error)?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Notion: Append Log Entry (Error)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF: Telegram Enabled?": {
      "main": [
        [
          {
            "node": "Telegram: Confirmation",
            "type": "main",
            "index": 0
          },
          {
            "node": "Catch: Error Handling",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email: Send Grocery List": {
      "main": [
        [
          {
            "node": "IF: Telegram Enabled?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Email: Send Success Notification",
            "type": "main",
            "index": 0
          },
          {
            "node": "Catch: Error Handling",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion: Add to Grocery List": {
      "main": [
        [
          {
            "node": "Email: Send Grocery List",
            "type": "main",
            "index": 0
          },
          {
            "node": "Catch: Error Handling",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code: Generate Grocery Items": {
      "main": [
        [
          {
            "node": "Notion: Add to Grocery List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF: Telegram Enabled (Error)?": {
      "main": [
        [
          {
            "node": "Telegram: Error Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email: Send Success Notification": {
      "main": [
        [
          {
            "node": "IF: Log to Notion?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cron: Weekly Meal Plan (Sun 6 PM)": {
      "main": [
        [
          {
            "node": "Set: Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion: Validate Database Connection": {
      "main": [
        [
          {
            "node": "Code: Generate Grocery Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 个人效率, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量20
分类2
节点类型8
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 查看

分享此工作流