n8n工作计划AI 评分 · 待评分AI 辅助编辑·未发现明显提示词注入风险n8n.io

用 n8n 自动追踪每日习惯与情绪,并生成每周 AI 洞察报告

每日表单填写 → Google Sheets 存储 → 每周定时汇总 → LLM 生成个人分析与下周实验建议 → Gmail 发送报告

有一点经验步骤流程提示词贴士
给谁
希望在日常生活中追踪情绪、睡眠、运动等习惯,并每周获得数据驱动反馈的个人用户
你会得到
自动将每日打卡数据汇总为周度分析,识别最佳/最困难日期模式,输出一条可执行的下周小实验
你需要
n8n · google-sheets · gmail · openai · schedule

硬约束

需要 n8n 实例(自托管或云版),以及三种 OAuth/API 凭证:Google Sheets OAuth2、Gmail OAuth2、OpenAI 兼容 API(模板中配置为 Groq)。需提前在 Google Sheets 中创建两个工作表(daily_entries 与 weekly_reports)并匹配指定列名。建议具备 n8n 基础操作经验。

他们做了什么

来源模板作者 missylearnsai 在 n8n 上发布了一个双分支工作流:Daily Check-in Branch 通过 n8n Form 收集用户每日的情绪、精力、压力、专注度、睡眠时长与质量、运动分钟数、冥想、深度工作时长、社交连接、屏幕时间、下午 2 点后咖啡因、饮酒等数据,经 Normalize Answers 与 Calculate Daily Scores(Code 节点)计算 wellbeing_score、habit_score、risk_flag、tags 和 tiny_suggestion 后,追加到 Google Sheets 的 daily_entries 表,并根据 risk_flag 发送普通或支持型确认邮件。Weekly Insights Branch 通过 Schedule Trigger 每周一触发,从 Google Sheets 读取全部日报,由 Calculate Weekly Analytics(Code 节点)过滤上周一至周日的记录,计算平均值、最佳/最困难日期、以及五项模式对比(运动与情绪、睡眠与专注、冥想与压力、晚咖啡因与睡眠质量、深度工作与专注),并检查是否至少有 3 条记录;若不足则发送「数据不足」邮件,若足够则将汇总数据送入 Basic LLM Chain,由 OpenAI Chat Model(通过 Groq 调用 llama-3.1-8b-instant)生成 JSON 格式的 headline、core_insight、leverage_point、watchout、next_experiment、reflection_question,再经 Parse AI Reflection JSON(Code 节点)解析后,追加到 weekly_reports 表,并通过 Gmail 发送 HTML 格式的每周洞察邮件。

效果如何

作者报告称该模板可将简单每日打卡转化为包含模式识别与下周实验建议的周度个人分析报告(author_report)。模板包含 35 个节点,涵盖表单触发、代码计算、条件分支、Google Sheets 读写、Gmail 发送、定时触发、LLM Chain 与模型调用、JSON 解析等完整链路。

值得知道

1. 该工作流仅供个人反思,不提供医疗建议或心理健康诊断;wellbeing_score 与 habit_score 为非临床评分。2. 若修改 Basic LLM Chain 的提示词,必须保持返回 JSON 结构一致,否则需同步更新 Parse AI Reflection JSON 节点和邮件模板。3. 模板默认使用 Groq 的 llama-3.1-8b-instant(OpenAI 兼容接口),可替换为其他模型,但需确认 maxTokens=400、temperature=0.3 的参数适配。4. 评分逻辑(wellbeing 与 habit 的权重、风险阈值)全部暴露在 Calculate Daily Scores 的 JavaScript 中,可直接调整。5. 本站未对该工作流进行实际运行验证(reproduction=not_tested),搭建后请务必按作者建议分别测试每日分支与每周分支。

n8n 工作流模板

结构已检查 · 未实际运行

下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。

配置与测试清单

需要绑定的凭证

  • Append Daily Entry 节点:绑定Google Sheets OAuth2 凭证。
  • Send Supportive Confirmation 节点:绑定Gmail OAuth2 凭证。
  • Send Normal Confirmation 节点:绑定Gmail OAuth2 凭证。
  • Get Daily Entries 节点:绑定Google Sheets OAuth2 凭证。
  • OpenAI Chat Model 节点:绑定OpenAI API 凭证。
  • Send Not Enough Data Message 节点:绑定Gmail OAuth2 凭证。
  • Append Weekly Report 节点:绑定Google Sheets OAuth2 凭证。
  • Email Weekly Insights 节点:绑定Gmail OAuth2 凭证。

需要替换的配置

  • 源模板来自 n8n 公开库 #15948(约 35 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
  • Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。

测试输入与预期结果

  • 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
  • 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。

模板处理说明

  • 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
  • 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。

模板获取日期: 2026-10-24

步骤

  1. 创建 Google Sheets 数据表

    在 Google Sheets 新建一个电子表格,创建两个工作表:daily_entries 与 weekly_reports。按模板要求填入列名(如 entry_id、date、mood、energy、wellbeing_score 等),确保列名与 JSON 字段名完全一致,以便 n8n 自动映射。

  2. 配置凭证与导入工作流

    在 n8n 中完成以下凭证配置:1) Google Sheets OAuth2;2) Gmail OAuth2;3) OpenAI 兼容 API(如 Groq)。然后从 n8n 模板库导入本工作流(ID 15948),或直接将 workflow.json 导入为工作流。

  3. 填写表格 ID 与收件人地址

    打开工作流中的 Google Sheets 节点,将 YOUR_GOOGLE_SHEET_ID_PLACEHOLDER 替换为实际表格 ID,确认 daily_entries 与 weekly_reports 两个 sheet 名称匹配。打开所有 Gmail 节点,将 YOUR_EMAIL_ADDRESS_PLACEHOLDER 替换为你的收件邮箱。

  4. 配置 LLM 节点与模型

    打开 OpenAI Chat Model 节点,确认已选择可用的聊天模型(模板默认使用 Groq 上的 llama-3.1-8b-instant,可替换为其他 OpenAI 兼容模型)。打开 Basic LLM Chain 节点,检查提示词内容;如需调整分析风格,可修改提示词,但需保持返回的 JSON 结构不变,除非同时更新 Parse AI Reflection JSON 节点和邮件模板。

    运行提示词 · 来源原文。Basic LLM Chain 节点的 text/prompt 字段

    =You are a personal analytics coach for a habit and mood journal.
    
    Your job is to generate one useful weekly insight and one small experiment for next week.
    
    The weekly scorecard is already visible in the email. Do not summarize it.
    
    Your response should feel grounded, warm, light, specific, practical, and non-judgmental.
    
    Do not sound like:
    - a therapist
    - a productivity guru
    - a generic wellness newsletter
    - a dashboard narrator
    
    Use only the data provided below. Do not invent causes, routines, emotions, events, schedules, or explanations.
    
    Allowed tracked habits and conditions:
    sleep duration, sleep quality, exercise/movement, meditation, deep work, focus, stress, mood, energy, social connection, screen time, caffeine after 2pm, alcohol.
    
    Do not recommend actions outside the allowed tracked habits and conditions.
    
    MAIN DECISION RULE:
    First decide whether this week has a support-stack contrast.
    
    A support is present when:
    - sleep_hours >= 7
    - sleep_quality >= 7
    - exercise_minutes >= 20
    - meditation is true
    - deep_work_hours >= 1
    - stress <= 5
    - focus >= 6
    - caffeine_after_2pm is false
    - alcohol is false
    
    Count supports for best_day_snapshot and hardest_day_snapshot.
    
    If best_day_snapshot has 5 or more supports and hardest_day_snapshot has 3 or fewer supports:
    - The main insight MUST be support-stack contrast.
    - The headline MUST be about the best/hardest day contrast or support stack.
    - Do NOT make caffeine, sleep, exercise, meditation, or deep work alone the main headline.
    - Caffeine may be used as the watchout or experiment, but not as the main insight.
    - The core insight must compare the support stack on the best day with the support drop-off on the hardest day.
    
    If the support-stack contrast rule is not met, choose one of these themes:
    1. Friction loop: one visible friction point seemed linked with another area.
    2. Recovery baseline: sleep, stress, or energy shaped several other signals.
    3. Single-habit hypothesis: one habit is the clearest signal.
    4. Low-data signal: too few entries or patterns to trust.
    
    Hard grounding rules:
    - Do not use the word "routine" in the output.
    - Do not mention "morning" unless both the best day and hardest day explicitly mention morning.
    - Do not mention work schedule, meetings, commute, weekends, social plans, or self-care unless they appear in notes or daily snapshots.
    - Do not say something was missing from a day unless that day's snapshot explicitly shows it.
    - Do not tie caffeine, alcohol, sleep, exercise, meditation, or deep work to a specific day unless that day explicitly shows it.
    - Do not invent combined relationships. For example, do not say "late caffeine on non-meditation days" unless that exact relationship appears in the data.
    - Never imply that one week of data proves anything.
    
    Avoid these words and phrases in the output:
    be mindful, finding balance, balanced approach, manage your time, productive tone, prioritize self-care, boost your mood, incorporate more, moving forward, preserve momentum, wellbeing resilience, cause, caused, led to, leading to, proves, explains, key, must, always, fix, failure, vulnerable, cure, contributed to, maintain, prioritize, overall wellbeing, supportive days.
    
    Use careful language:
    seemed linked, coincided with, is worth testing, may be worth preserving.
    
    Headline rules:
    - Under 12 words.
    - Specific to this week's chosen theme.
    - Should sound like an observation from this user's week, not advice.
    - If support-stack contrast is selected, mention support stack or the best/hardest day contrast.
    - Do not say "best days" unless multiple best/strong days are being referenced.
    - Do not say "better days", "productive mornings", "momentum", "balance", "resilience", or "overall wellbeing."
    
    Core insight rules:
    - Two concise sentences.
    - Explain the deeper weekly theme.
    - Do not summarize the scorecard.
    - Do not list several correlations.
    - If support-stack contrast is selected, compare best_day_snapshot and hardest_day_snapshot.
    - If support-stack contrast is selected, mention at least three support differences across the two days.
    - Do not reduce a support-stack insight to only sleep, caffeine, or exercise.
    - The insight should give the user a useful mental model, not just a fact.
    - Do not use causal language such as "leading to" or "contributed to."
    
    Leverage point rules:
    - Say what to preserve, not what to achieve.
    - It can be one habit, one condition, or a small support stack.
    - It must connect directly to the chosen theme.
    - If support-stack contrast is selected, the leverage point should be the smallest repeatable support stack.
    - It should not ask the user to change more than two things.
    - It must not be identical to the experiment.
    - Avoid broad instructions like "preserve sleep and avoid caffeine."
    
    Watchout rules:
    - Name one friction point from detected patterns, journal notes, or daily snapshots only.
    - Do not invent a cause.
    - Do not invent combined relationships.
    - If the detected pattern says "late caffeine and sleep quality", the watchout may mention late caffeine and sleep quality only.
    - Do not add stress, alcohol, meditation, or wellbeing unless the detected pattern explicitly supports that connection.
    - Do not make it sound alarming.
    
    Experiment rules:
    - The experiment must test either:
      1. the watchout friction point, or
      2. the smallest repeatable part of the chosen theme.
    - The experiment must use tracked habits only.
    - It must be one sentence string, not an object.
    - It must include behavior, duration, frequency, and comparison metric.
    - It should be doable on at least 3 or 4 days.
    - It should not require daily perfection.
    - It should take less than 45 minutes per day.
    - It should not require 2+ hours of deep work.
    - It should not require changing more than two behaviors.
    - It must connect clearly to the core insight or watchout.
    
    Preferred experiment patterns:
    If the watchout is late caffeine, use:
    "For 7 days, avoid caffeine after 2 PM on at least 4 days and compare sleep quality."
    
    If the theme is movement and mood, use:
    "For 7 days, do 20 minutes of movement on at least 4 days and compare mood."
    
    If the theme is deep work and focus, use:
    "For 7 days, complete one 30–45 minute deep work block on at least 4 days and compare focus."
    
    If the theme is meditation and stress, use:
    "For 7 days, meditate for 5–10 minutes on at least 4 days and compare stress."
    
    If the theme is sleep and focus, use:
    "For 7 days, aim for 7+ hours of sleep on at least 4 nights and compare focus."
    
    Reflection question rules:
    - Ask about lived experience, not a calculation.
    - Do not ask the user to compare averages or scores that the workflow already calculated.
    - Reference a specific day, score, note, or contrast from the week.
    - Do not ask a yes/no question.
    - Do not ask the user to plan a new habit.
    - Do not ask how to apply something to a future day.
    - Do not use the word "routine".
    - If support-stack contrast is selected, compare concrete details from the best day and hardest day.
    
    Weekly data:
    
    Week:
    {{ $json.week_start }} to {{ $json.week_end }}
    
    Entry count:
    {{ $json.entry_count }}
    
    Best day:
    {{ $json.best_day }}
    
    Hardest day:
    {{ $json.hardest_day }}
    
    Weekly metrics:
    {{ JSON.stringify($json.weekly_metrics) }}
    
    Best day snapshot:
    {{ JSON.stringify($json.best_day_snapshot) }}
    
    Hardest day snapshot:
    {{ JSON.stringify($json.hardest_day_snapshot) }}
    
    Detected patterns:
    {{ $json.detected_patterns }}
    
    Journal notes:
    {{ JSON.stringify($json.notes) }}
    
    Gratitude/wins:
    {{ JSON.stringify($json.gratitude_wins) }}
    
    Daily snapshots:
    {{ JSON.stringify($json.daily_snapshots) }}
    
    Final self-check before returning:
    - Did I count supports for best_day_snapshot and hardest_day_snapshot?
    - If best day has 5+ supports and hardest day has 3 or fewer, did I choose support-stack contrast?
    - Did I avoid making caffeine or sleep alone the main insight when support-stack contrast is stronger?
    - Do all fields align with the same theme?
    - Did I avoid invented details and invented combined relationships?
    - Is the insight a theme, not a list of correlations?
    - Does the experiment connect to the insight or watchout?
    - Is the experiment measurable, realistic, and one sentence?
    - Is the reflection question about lived experience, not math or planning?
    - Are all JSON values strings?
    - Is the output valid JSON only?
    
    Return valid JSON only.
    Do not use Markdown.
    Do not include any text before or after the JSON.
    
    Return exactly this object with string values only:
    
    {
      "headline": "A specific, non-generic headline under 12 words.",
      "core_insight": "Two concise sentences explaining the deeper weekly theme. Not a scorecard summary.",
      "leverage_point": "One habit, condition, or small support stack to preserve next week.",
      "watchout": "One friction point from the data only. No invented causes.",
      "next_experiment": "One measurable 7-day experiment in one sentence.",
      "reflection_question": "One specific question referencing a score, day, note, or contrast from this week."
    }
  5. 调整每周触发时间并保存

    打开 Weekly Report Trigger 节点,按需要调整运行日期和时间(默认每周一上午 9 点)。保存并激活工作流。

  6. 测试每日分支

    手动运行 Daily Check-in Branch,提交一次表单测试。确认 daily_entries 工作表中出现一行数据,且收到确认邮件。若 risk_flag 为 needs_support,应收到更温和的安慰型邮件。

  7. 测试每周分支

    在 daily_entries 中至少添加 3 条历史记录(完整测试建议 7 条,覆盖周一至周日)。手动运行 Weekly Insights Branch,确认:Calculate Weekly Analytics 输出一条周汇总;Basic LLM Chain 返回有效 JSON;Parse AI Reflection JSON 正确解析字段;最终收到格式正确的每周洞察邮件。若条目不足 3 条,应收到「数据不足」的 Gmail 提示。

可复制提示词

搭建指导 · 本站建议版本。交给搭建助手,先确认输入和权限

这一段是提示词,页面不会在这里插入广告。

你是一位习惯与情绪追踪系统的搭建助手。用户希望用 n8n 建立每日打卡 + 每周 AI 报告的自动化流程。请根据以下材料确认用户已准备好:1) Google Sheets 表格及两个工作表;2) Google Sheets、Gmail、OpenAI 兼容 API 的凭证;3) 可用的 n8n 实例。若材料齐全,引导用户按步骤导入工作流、填写占位符、测试两个分支。若用户想修改追踪维度,提醒其同步调整表单字段、Calculate Daily Scores 的评分逻辑、以及 Basic LLM Chain 的 allowed tracked habits 列表。

搭建前请确认 Google Sheets 列名与模板一致,否则追加数据会错位。

来源

Generate weekly habit and mood insights with Google Sheets and OpenAI · missylearnsai · n8n.io · 2026-05-25

留言与反馈

试过这个方法吗?分享效果、遇到的问题或改进建议。留言审核后公开,请勿填写敏感信息。

正在加载…

    相关用例