🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Perplexity + Gmail: newsletter drafts ready to approve

Lisa Granqvist Partner Workflow Automation Expert

Your newsletter process probably breaks in the same place every week. Research lives in one tab, drafts live in another, approvals happen in a messy email thread, and the “final” version somehow still ships with a stale stat or missing disclaimer.

This Perplexity Gmail automation hits marketing managers first, because deadlines don’t care about context switching. But founders shipping investor updates and client-facing advisors sending weekly market notes feel the drag too. You end up spending about 2 hours just getting to a “sendable” draft.

This workflow turns that weekly scramble into a repeatable approval loop, then drops a polished Gmail draft in your account. You’ll see what it automates, what to customize, and where the common failures happen.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: Perplexity + Gmail: newsletter drafts ready to approve

The Problem: Newsletters Get Stuck in Research and Approvals

A “weekly newsletter” sounds simple until you actually try to run it like a system. You start by gathering credible updates, then you reshape them into something readable, then you chase someone for approval, then you redo half the draft because the reviewer replied with “tiny tweaks” and three screenshots. Meanwhile, you’re also trying not to publish anything risky or inaccurate. The worst part is the mental load: every week feels like rebuilding the same machine from scratch, which quietly steals time from strategy, partnerships, and actual marketing.

It adds up fast. Here’s where it breaks down in real life.

  • Research gets copied from multiple sources, and one wrong number can trigger a last-minute rewrite.
  • Drafting takes longer than it should because you’re constantly reformatting, rewording, and re-explaining context.
  • Approvals happen in scattered replies, which means version control becomes guesswork.
  • Compliance or factual checks get skipped when you’re under the gun, then you “hope it’s fine.”

The Solution: AI Research + Drafting + Approval, Then a Gmail Draft

This n8n workflow automates your weekly newsletter production cycle end to end, without turning it into a black box. It starts on a schedule (weekly by default), computes the date window you want covered, then asks Perplexity for structured research in a predictable JSON format. That research becomes the input for an editorial drafting step in OpenAI, which writes a long-form newsletter (about 2,000 words) in your preferred style. Before anyone sees it, a separate quality check step scans for factual issues and compliance risk, so you’re not sending something you’ll regret. Finally, the workflow emails a preview with clear Approve/Revise actions and, once approved, generates a clean Gmail draft ready for you to send.

The workflow begins with a scheduled run and a defined week window. Perplexity gathers the raw material, OpenAI shapes it into a newsletter and formats it into HTML, then n8n routes it through a simple approval loop. Approval creates the final Gmail draft. Revisions route back into the editorial step with the reviewer’s notes.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you publish one weekly newsletter and you normally spend about 2 hours researching, 2 hours drafting, and another hour chasing approvals and applying edits. That’s roughly 5 hours per issue. With this workflow, you spend maybe 10 minutes adjusting the angle (if needed), then you review the emailed preview and click Approve or request changes. Even if you add 20 minutes for review and tweaks, you’re still getting back about 4 hours each week.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Perplexity for research API calls.
  • OpenAI to draft, format, and quality-check.
  • Gmail to send previews and create drafts.
  • Perplexity API key (get it from your Perplexity account settings).
  • OpenAI API key (get it from the OpenAI API dashboard).

Skill level: Intermediate. You’ll connect OAuth/API credentials and edit prompts, but you won’t be writing an app.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

A scheduled run kicks everything off. The workflow triggers every week, then calculates the right “week window” so your research stays focused on the latest updates.

Research is collected and normalized. Perplexity is called to fetch structured market research, and n8n parses the JSON so later steps can reference consistent fields instead of messy text.

The newsletter is drafted, formatted, and checked. OpenAI generates the editorial draft, then an HTML composing step turns it into an email-ready layout. A dedicated QC pass reviews for factual issues and potential compliance concerns before anything goes to a human.

Approval happens through email, then Gmail gets the final draft. n8n sends a preview email with Approve/Revise actions. Clicking routes to an n8n-hosted approval page, and approval triggers the “Generate Final Draft” node that creates a Gmail draft in your account.

You can easily modify the prompts and the HTML branding to match your voice. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Schedule Trigger

This workflow starts on a weekly schedule and calculates the market week window for downstream research.

  1. Add and open Scheduled Run Trigger.
  2. Set the schedule rule to run weekly at 8:00 by configuring the interval for weeks with triggerAtHour set to 8.
  3. Connect Scheduled Run Trigger to Compute Week Window so the date range and run_key are generated for the current week.

Step 2: Connect Market Research and Parse the Response

These nodes fetch weekly market data and normalize the JSON into a consistent structure for drafting.

  1. Open Market Research LLM and ensure the request uses the provided system and user prompts with week context expressions like {{ $json.week_label }}, {{ $json.start_iso }}, and {{ $json.end_iso }}.
  2. Credential Required: Connect your perplexityApi credentials in Market Research LLM.
  3. Confirm the connection flow Compute Week WindowMarket Research LLMParse Research JSON.
  4. Review Parse Research JSON to ensure the robust JSON parser and normalization logic remains intact; this node cleans the model output before editorial processing.

Step 3: Set Up Editorial Drafting and HTML Composition

This section builds the editorial JSON, composes HTML, and runs quality checks before sending a preview.

  1. In Prepare Editorial Context, set your firm details by updating values like firm_name to Company Name, contact_url to contact url, and view_url to https://website/${runKey}.
  2. Open Editorial Draft LLM and keep jsonOutput enabled. The prompt uses an expression to set the mode: {{ $json.editor_json ? 'REVISE' : 'FRESH' }}.
  3. Credential Required: Connect your openAiApi credentials in Editorial Draft LLM.
  4. Open HTML Composer LLM and keep jsonOutput enabled. This node reads editor JSON from Editorial Draft LLM and uses date expressions such as {{ $('Compute Week Window').isExecuted ? $node['Compute Week Window'].json.start_iso : ($json.week_meta?.start_iso || '') }}.
  5. Credential Required: Connect your openAiApi credentials in HTML Composer LLM.
  6. Open Quality Check LLM and keep jsonOutput enabled to return structured compliance and fact-check results.
  7. Credential Required: Connect your openAiApi credentials in Quality Check LLM.
  8. Verify the flow Editorial Draft LLMHTML Composer LLMQuality Check LLMBuild Preview Payload.

⚠️ Common Pitfall: If HTML Composer LLM returns non-JSON output, Build Preview Payload will throw “No HTML from builders or payload.” Keep the model output strictly to the requested JSON schema.

Step 4: Configure Preview Delivery and Approval Webhooks

This path sends a preview email with approval links and hosts the approval/revision interface.

  1. Open Build Preview Payload and verify it composes encoded_context from the editorial and QC output.
  2. In Dispatch Preview Email, set sendTo to [YOUR_EMAIL] and keep the HTML message expression that builds approval/revision buttons using https://[YOURDOMAIN].app.n8n.cloud/webhook/newsletter-approval.
  3. Credential Required: Connect your gmailOAuth2 credentials in Dispatch Preview Email.
  4. Configure Approval Link Webhook with path set to newsletter-approval and responseMode set to responseNode.
  5. Ensure Approval Page Response returns the approval/revision HTML and handles #ctx context from the URL hash.
  6. Configure Approval Submit Webhook with path set to newsletter-approval-submit and httpMethod set to POST.

⚠️ Common Pitfall: Replace [YOURDOMAIN] and [YOUR_EMAIL] in Dispatch Preview Email and webhook response HTML, otherwise approval links will break.

Step 5: Configure Approval Processing and Final Draft Creation

This branch processes approval or revision requests, updates the context, and creates the final Gmail draft.

  1. Confirm the webhook flow: Approval Submit WebhookDecode Context PayloadNormalize Request DataEvaluate Action Type.
  2. In Evaluate Action Type, keep the approval condition using the expression {{ ($json.body?.action || $json.query?.action || '').toLowerCase() }} equals approve.
  3. When approval is true, ensure the output goes to Generate Final Draft and then Return Webhook Reply.
  4. Credential Required: Connect your gmailOAuth2 credentials in Generate Final Draft.
  5. When approval is false, ensure the output goes to Notes Present Check and then Combine Revision NotesEditorial Draft LLM for revision cycles.
  6. Keep Return Form HTML and Return Webhook Reply as the response nodes for webhooks to close the loop.

⚠️ Common Pitfall: If notes are not passed to Combine Revision Notes, the revision loop will default to an empty notes field. Check that the approval form sends notes on POST.

Step 6: Test and Activate Your Workflow

Validate the full workflow, including approval and revision flows, before running on schedule.

  1. Click Execute Workflow to run Scheduled Run Trigger manually and confirm Dispatch Preview Email sends a preview.
  2. Open the approval email and click Approve and Request revisions to verify both webhook paths (Approval Link Webhook and Approval Submit Webhook).
  3. Confirm Generate Final Draft creates a Gmail draft with a subject formatted by the expression in the node.
  4. Check that Return Webhook Reply and Return Form HTML respond with HTML pages and no errors.
  5. When satisfied, toggle the workflow to Active to enable weekly production runs.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • Gmail OAuth credentials can expire or need specific permissions. If things break, check your n8n Credentials panel and your Google account’s connected apps first.
  • If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
  • Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.

Frequently Asked Questions

How long does it take to set up this Perplexity Gmail automation?

About 45 minutes if you already have your API keys and Gmail OAuth ready.

Do I need coding skills to automate newsletter drafting with Perplexity Gmail automation?

No. You will mostly connect accounts and edit prompts.

Is n8n free to use for this Perplexity Gmail automation workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in Perplexity and OpenAI API usage (cost depends on token volume and model choice).

Where can I host n8n to run this Perplexity Gmail automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I customize this Perplexity Gmail automation workflow for a non-finance newsletter?

Yes, and it’s mostly prompt work. Update the Perplexity “Market Research” prompt to your domain (tech, education, internal comms), then adjust the editorial and QC prompts so tone and rules match your audience. Many teams also swap the disclaimer/signature inside the HTML composing step to match brand requirements.

Why is my Gmail connection failing in this Perplexity Gmail automation workflow?

Most of the time it’s OAuth. Reconnect your Gmail credential in n8n and make sure the Google account still allows access (workspace policies can block it). If the preview email sends but draft creation fails, check that the Gmail node is using the same authorized account you expect, not an old credential. Also watch for rate limits if you test repeatedly in a short window.

How many newsletters can this Perplexity Gmail automation handle?

On n8n Cloud Starter, it’s generally fine for a weekly newsletter (or several) because you’re running a handful of executions per issue. If you self-host, there’s no execution cap, so scale is mostly limited by your server and AI API quotas. Practically, the slow part is the AI generation, not n8n, so expect each issue to take a few minutes of processing time.

Is this Perplexity Gmail automation better than using Zapier or Make?

Often, yes, if you care about the approval loop and logic. This workflow uses multiple webhooks, branching (Approve vs. Revise), and “carry context forward” behavior, which is where Zapier and Make can get expensive or awkward. n8n also gives you the self-hosted option, which is a big deal if you plan to scale. If you only need “generate draft and email it,” Zapier can be simpler. If you’re unsure, Talk to an automation expert and you’ll get a straight recommendation.

Once this is running, your weekly newsletter stops being a recurring fire drill. You review, approve, and move on.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

\n
\n \n
\n
\n\n
\n

Approving will create the final Gmail draft.

\n \n
\n \n\n

Tip: the large context is carried in the URL hash, not in the query.

\n
\n\n \n\n`;\n})()\n}}\n" }, "typeVersion": 1.4, "alwaysOutputData": true }, { "id": "b1d7e9ac-aac7-4991-95a2-969eed35e16f", "name": "Prepare Editorial Context", "type": "n8n-nodes-base.code", "position": [ 250, 210 ], "parameters": { "jsCode": "const src = $json; // output of Parse Perplexity JSON\nconst week = $node[\"Compute Week Window\"].json.week_label;\nconst runKey = $node[\"Compute Week Window\"].json.run_key || String(Date.now());\n\nreturn [{\n json: {\n ...src,\n\n // Values the Editorial LLM should see & use in the HTML it generates:\n week_label: week,\n firm_name: \"Company Name\",\n contact_url: \"contact url\",\n view_url: `https://website/${runKey}`,\n year: new Date().getFullYear()\n }\n}];\n" }, "typeVersion": 2, "alwaysOutputData": true }, { "id": "578406b0-c63f-4189-916a-4c25c04ab62e", "name": "Market Research LLM", "type": "n8n-nodes-base.perplexity", "position": [ 670, 200 ], "parameters": { "options": { "topP": 1, "maxTokens": 4000, "temperature": 0.2 }, "messages": { "message": [ { "role": "system", "content": "=You are a buy-side markets researcher for high-net-worth clients. Your job is to collect and synthesize weekly market facts (prices, % moves, yields, credible headlines) and return ONE STRICT JSON object only.\n\nHARD RULES\n- Output ONE valid JSON object. No prose, no markdown, no code fences.\n- Use the provided ISO window as the only reference period (official closes only; no intraday).\n- Prefer primary sources and tier-1 outlets only: index providers (S&P, Nasdaq, FTSE, STOXX, MSCI), exchanges, central banks, Treasury/FRED/ONS/Eurostat, IMF/World Bank, and Reuters/FT/WSJ/Bloomberg.\n- Exclude minor markets and assets unless they have moved enough to affect a typical multi-asset institutional portfolio or shifted global risk sentiment.\n- Every numeric row should include \u22651 source; important rows should include \u22652.\n- Be neutral; do not speculate or predict.\n- If something can't be corroborated, omit it (do not invent placeholders).\n\nCOVERAGE SCOPE (weekly closes; w/w = this week close vs last week close; YTD vs prior year end)\n\nINDICES (\u226515 mixed regions with sector breakdown):\n- US: S&P 500, Nasdaq Composite, Dow Jones, Russell 2000, Russell 1000 Growth, Russell 1000 Value\n- Europe: STOXX Europe 600, FTSE 100, DAX 30, CAC 40, FTSE MIB, IBEX 35\n- Asia-Pacific: Nikkei 225, Hang Seng, CSI 300, KOSPI, ASX 200, Nifty 50\n- Global: MSCI World, MSCI Emerging Markets, MSCI ACWI\n- Include weekly high/low ranges where available\n- Do not include regional indices, currencies, or commodities outside the defined list unless their weekly change impacted listed equity, rates, or credit indices.\n\nRATES & CREDIT (yields in %, bps w/w changes):\n- Sovereign: US 3m, 2y, 5y, 10y, 30y; DE 2y, 10y; UK 2y, 10y; JP 2y, 10y; AU 2y, 10y\n- Curves: US 2s10s, 5s30s in bps; term structure analysis\n- Credit: US IG spreads, US HY spreads, EUR IG spreads, EUR HY spreads (bps w/w)\n- Real rates: US 5y5y breakevens, 10y TIPS yields\n\nFX MAJORS (w/w % changes, volatility if available):\n- DXY, EURUSD, USDJPY, GBPUSD, USDCAD, AUDUSD, USDCHF, NZDUSD\n- EM FX: USDCNY, USDBRL, USDMXN, USDINR if relevant to weekly moves\n- Include EM FX and minor commodities only if their volatility or price shift impacts cross-asset flows or ranks as a leading driver cited by two or more tier-1 sources\n\nCOMMODITIES (w/w % changes, technical levels):\n- Energy: WTI Crude, Brent Crude, Natural Gas (US & EU), Gasoline\n- Metals: Gold, Silver, Copper, Platinum, Palladium\n- Agriculture: Wheat, Corn, Soybeans (if significant moves)\n- Include key support/resistance levels where relevant\n- Include EM FX and minor commodities only if their volatility or price shift impacts cross-asset flows or ranks as a leading driver cited by two or more tier-1 sources\n\nVOLATILITY & RISK METRICS:\n- Equity vol: VIX, VXN (Nasdaq vol), VSTOXX, VIX9D\n- Bond vol: MOVE index\n- FX vol: JPY, EUR implied vols if elevated\n- Risk-[CONFIGURE_YOUR_API_KEY]/off indicators: High-beta vs low-vol performance\n\nSECTOR PERFORMANCE (S&P GICS Level 1, w/w %):\n- All 11 sectors with specific callouts for top 3 winners/bottom 3 laggards\n- Notable sub-sector moves (banks, semis, REITs, utilities)\n- Style factors: Growth vs Value, Large vs Small cap performance\n\nMARKET BREADTH & TECHNICALS:\n- S&P 500: % above 50dma, 200dma; new highs/lows\n- NYSE: advance/decline ratio, up/down volume\n- Nasdaq: advance/decline, new highs/lows ratio\n- Key technical levels: S&P 500 support/resistance, major moving averages\n\nECONOMIC DATA & EVENTS (with market impact analysis):\n- Central Bank Actions: Fed, ECB, BoJ, BoE decisions or speeches with yield/FX impact\n- Inflation Data: CPI, PCE, Core readings with bond market reaction\n- Employment: NFP, unemployment, wage growth with sector implications\n- Growth Indicators: GDP, PMIs, retail sales with equity sector impact\n- Include actual vs consensus vs prior for key releases\n- Ignore sub-sector or single-stock headlines unless they have driven top-three sector moves in one of the named indices, or been widely cited by tier-1 outlets for shifting market direction.\n\nGEOPOLITICAL & POLICY DEVELOPMENTS:\n- Fed/ECB policy signals and market interpretation\n- Regulatory changes affecting sectors (banks, tech, energy)\n- Trade developments, sanctions, geopolitical tensions\n- Fiscal policy announcements with market-moving potential\n- Only retain topics where the news altered global indices, major sovereign curves, cross-asset correlations, or HNW portfolio risk metrics in that week.\n\nCORPORATE & STRUCTURAL THEMES:\n- Major earnings themes if in earnings season\n- M&A activity affecting sectors or indices\n- Credit events or downgrades affecting spreads\n- Notable IPO/secondary offerings if market-moving\n- avoid smaller markets that have little impact on the portfolio of the clients who will receive the newsletter\n- Only retain topics where the news altered global indices, major sovereign curves, cross-asset correlations, or HNW portfolio risk metrics in that week.\n\nWEEK-AHEAD CALENDAR (6-15 events):\n- Economic releases: exact date, time, consensus, why it matters to markets\n- Central bank events: speeches, minutes, decisions\n- Corporate events: major earnings, ex-dividend dates\n- Policy events: auctions, regulatory announcements\n- Each event must include market relevance and potential portfolio impact\n\nCLIENT PORTFOLIO CONTEXT:\nFor each major theme, include:\n- \"hnw_impact\": How this affects typical 60/40+ portfolios, alternative investments\n- \"positioning_implications\": General themes (duration, quality, diversification, not specific trades)\n- \"risk_level\": low/medium/high for client attention prioritization\n- \"time_horizon\": immediate/tactical (1-3 months)/strategic (6+ months)\n\nRETURN STRICT JSON WITH EXPANDED STRUCTURE:\n\n{\n \"metadata\": {\n \"week_label\": \"Week of [Date] - [Date]\",\n \"window\": { \n \"start_iso\": \"YYYY-MM-DDTHH:mm:ssZ\", \n \"end_iso\": \"YYYY-MM-DDTHH:mm:ssZ\", \n \"tz\": \"America/New_York\" \n },\n \"research_timestamp\": \"YYYY-MM-DDTHH:mm:ssZ\",\n \"primary_themes\": [\"theme1\", \"theme2\", \"theme3\"]\n },\n\n \"equity_indices\": [\n { \n \"name\": \"S&P 500\", \n \"close\": 0, \n \"w_w_pct\": \"+0.0%\", \n \"ytd_pct\": \"+0.0%\", \n \"week_high\": 0,\n \"week_low\": 0,\n \"technical_note\": \"Above/below key MA\",\n \"date\": \"YYYY-MM-DD\", \n \"tz\": \"America/New_York\",\n \"sources\": [ \n { \"publisher\": \"S&P DJI\", \"url\": \"...\" }, \n { \"publisher\": \"Reuters\", \"url\": \"...\" } \n ] \n }\n // Include all 15+ indices with same structure\n ],\n\n \"rates_credit\": {\n \"sovereigns\": [\n { \n \"name\": \"US 10y\", \n \"yield_pct\": 0.00, \n \"w_w_bps\": 0, \n \"ytd_bps\": 0,\n \"technical_level\": \"near resistance/support\",\n \"date\": \"YYYY-MM-DD\", \n \"sources\": [ { \"publisher\": \"U.S. Treasury/FRED\", \"url\": \"...\" } ] \n }\n // Include all major sovereigns\n ],\n \"curves\": [\n { \"name\": \"US 2s10s\", \"spread_bps\": 0, \"w_w_bps\": 0, \"ytd_bps\": 0 },\n { \"name\": \"US 5s30s\", \"spread_bps\": 0, \"w_w_bps\": 0, \"ytd_bps\": 0 }\n ],\n \"credit_spreads\": [\n { \"name\": \"US IG\", \"spread_bps\": 0, \"w_w_bps\": 0, \"ytd_bps\": 0 },\n { \"name\": \"US HY\", \"spread_bps\": 0, \"w_w_bps\": 0, \"ytd_bps\": 0 },\n { \"name\": \"EUR IG\", \"spread_bps\": 0, \"w_w_bps\": 0, \"ytd_bps\": 0 },\n { \"name\": \"EUR HY\", \"spread_bps\": 0, \"w_w_bps\": 0, \"ytd_bps\": 0 }\n ],\n \"real_rates\": [\n { \"name\": \"US 5y5y Breakeven\", \"rate_pct\": 0.00, \"w_w_bps\": 0 },\n { \"name\": \"US 10y TIPS\", \"yield_pct\": 0.00, \"w_w_bps\": 0 }\n ]\n },\n\n \"fx_markets\": [\n { \n \"pair\": \"DXY\", \n \"close\": 0.00, \n \"w_w_pct\": \"+0.0%\", \n \"ytd_pct\": \"+0.0%\",\n \"volatility_note\": \"elevated/normal\",\n \"technical_level\": \"key support/resistance\",\n \"sources\": [ { \"publisher\": \"ICE/Reuters\", \"url\": \"...\" } ] \n }\n // Include all 8+ major pairs\n ],\n\n \"commodities\": [\n { \n \"name\": \"WTI Crude\", \n \"close\": 0.00, \n \"w_w_pct\": \"+0.0%\", \n \"ytd_pct\": \"+0.0%\",\n \"technical_level\": \"$XX support/resistance\",\n \"fundamental_driver\": \"supply/demand factor\",\n \"sources\": [ { \"publisher\": \"EIA/NYMEX\", \"url\": \"...\" } ] \n }\n // Include all major commodities\n ],\n\n \"volatility_risk\": {\n \"equity_vol\": [\n { \"name\": \"VIX\", \"close\": 0.00, \"w_w_pct\": \"+0.0%\", \"regime\": \"low/elevated/high\" },\n { \"name\": \"VXN\", \"close\": 0.00, \"w_w_pct\": \"+0.0%\" }\n ],\n \"bond_vol\": [\n { \"name\": \"MOVE\", \"close\": 0.00, \"w_w_pct\": \"+0.0%\" }\n ],\n \"risk_sentiment\": {\n \"risk_on_off\": \"risk-[CONFIGURE_YOUR_API_KEY]/risk-[CONFIGURE_YOUR_API_KEY]/mixed\",\n \"quality_spread\": \"IG vs HY spread change\",\n \"defensive_sectors\": \"Utilities, Staples performance vs market\"\n }\n },\n\n \"sector_performance\": [\n { \n \"sector\": \"Information Technology\", \n \"w_w_pct\": \"+0.0%\", \n \"ytd_pct\": \"+0.0%\",\n \"key_drivers\": [\"earnings\", \"rates\", \"regulation\"],\n \"notable_movers\": [\"NVDA weight impact\", \"if relevant\"],\n \"sources\": [ { \"publisher\": \"S&P DJI\", \"url\": \"...\" } ] \n }\n // All 11 GICS sectors\n ],\n\n \"market_breadth\": {\n \"sp500_breadth\": {\n \"pct_above_50dma\": 0,\n \"pct_above_200dma\": 0,\n \"new_highs\": 0,\n \"new_lows\": 0,\n \"weekly_interpretation\": \"broad/narrow participation\"\n },\n \"nyse_data\": {\n \"adv_dec_ratio\": 0.00,\n \"up_vol_pct\": 0,\n \"down_vol_pct\": 0\n },\n \"technical_levels\": {\n \"sp500_support\": 0000,\n \"sp500_resistance\": 0000,\n \"key_moving_averages\": \"50dma, 200dma levels\"\n }\n },\n\n \"economic_calendar_past\": [\n { \n \"date\": \"YYYY-MM-DD\", \n \"time\": \"HH:mm\",\n \"region\": \"US\", \n \"indicator\": \"CPI YoY\", \n \"actual\": \"0.0%\",\n \"consensus\": \"0.0%\",\n \"prior\": \"0.0%\",\n \"market_impact\": \"bond yields rose/fell Xbps\",\n \"portfolio_relevance\": \"supports Fed easing/tightening\",\n \"sources\": [ { \"publisher\": \"BLS\", \"url\": \"...\" } ] \n }\n // 8-15 key releases from the past week\n ],\n\n \"macro_policy_themes\": [\n {\n \"theme\": \"Fed Policy Path\",\n \"development\": \"Powell speech signals dovish pivot\",\n \"market_reaction\": \"10y yields fell 15bps, financials underperformed\",\n \"client_implication\": \"duration extension opportunity\",\n \"time_horizon\": \"tactical\",\n \"sources\": [ { \"publisher\": \"Federal Reserve\", \"url\": \"...\" } ]\n }\n // 3-6 major themes\n ],\n\n \"corporate_structural\": [\n {\n \"theme\": \"Tech Earnings Momentum\",\n \"details\": \"Semiconductor strength drives Nasdaq outperformance\",\n \"sector_impact\": \"IT +2.5% vs S&P +1.2%\",\n \"portfolio_angle\": \"quality growth beneficiary\",\n \"sources\": [ { \"publisher\": \"Bloomberg\", \"url\": \"...\" } ]\n }\n // 2-4 themes if relevant\n ],\n\n \"week_ahead_calendar\": [\n { \n \"date\": \"YYYY-MM-DD\", \n \"time\": \"HH:mm\",\n \"tz\": \"America/New_York\",\n \"region\": \"US\", \n \"event\": \"FOMC Minutes\", \n \"consensus\": \"N/A or expected reading\",\n \"why_matters\": \"Signals December rate cut probability\",\n \"portfolio_impact\": \"Duration and financial sector positioning\",\n \"importance\": \"high/medium/low\",\n \"primary_source_url\": \"federalreserve.gov link if available\" \n }\n // 8-15 events, prioritized by market impact\n ],\n\n \"client_context\": {\n \"week_summary\": {\n \"primary_driver\": \"One sentence on main market driver\",\n \"secondary_driver\": \"One sentence on secondary theme\", \n \"hnw_portfolio_impact\": \"How typical 60/40+ allocation performed\",\n \"risk_level\": \"low/medium/high\",\n \"attention_priority\": \"routine/elevated/urgent\"\n },\n \"positioning_themes\": {\n \"equity\": \"quality bias continues, growth leadership\",\n \"fixed_income\": \"extend duration on dovish Fed\",\n \"alternatives\": \"REITs benefit from rate cuts\",\n \"fx_commodities\": \"dollar weakness supports commodities\"\n },\n \"risk_considerations\": [\n \"Geopolitical tensions remain elevated\",\n \"Credit spreads at tight levels\",\n \"Volatility regime could shift quickly\"\n ]\n },\n\n \"data_quality\": {\n \"coverage_complete\": {\n \"indices\": true,\n \"rates\": true, \n \"fx\": true,\n \"commodities\": true,\n \"volatility\": true,\n \"sectors\": true,\n \"breadth\": true,\n \"economic_data\": true,\n \"calendar\": true\n },\n \"source_tier_distribution\": {\n \"tier_1_pct\": 85,\n \"tier_2_pct\": 15,\n \"total_sources\": 45\n },\n \"missing_data\": [],\n \"research_confidence\": \"high/medium/low\",\n \"core_ok\": true,\n \"ok_to_send\": true\n },\n\n \"kpi_summary_strings\": [\n \"S&P 500 4,622 (+1.2% w/w, +14.6% YTD)\",\n \"Nasdaq Composite 16,000 (+2.5% w/w, +24.2% YTD)\",\n \"US 10y 4.22% (+4bps w/w, +45bps YTD)\",\n \"DXY 103.2 (-0.8% w/w, +2.1% YTD)\",\n \"WTI $73.45 (+2.1% w/w, -8.2% YTD)\",\n \"VIX 14.2 (-2.1pts w/w)\"\n ]\n}\n\nIf any required datapoint is missing or cannot be corroborated from primary sources, add it to data_quality.missing_data and set the corresponding coverage boolean to false. Prioritize accuracy over completeness - omit rather than estimate." }, { "content": "=Generate the global market report for the week **{{ $json.week_label }}**, using only official closes between:\n- start: {{ $json.start_iso }}\n- end: {{ $json.end_iso }}\nTimezone: Singapore.\n\nFill every numeric section you can corroborate. Omit anything you cannot validate with tier-1 sources. Compute w/w and YTD (vs prior year end). Return ONE JSON matching the schema in the system prompt.\n" } ] }, "requestOptions": [] }, "credentials": { "perplexityApi": { "id": "credential-id", "name": "" } }, "typeVersion": 1, "alwaysOutputData": true }, { "id": "77a4ff73-cfc4-4e3e-a832-9be006d0fdeb", "name": "Quality Check LLM", "type": "@n8n/n8n-nodes-langchain.openAi", "position": [ 540, 400 ], "parameters": { "modelId": { "__rl": true, "mode": "list", "value": "gpt-3.5-turbo", "cachedResultName": "GPT-3.5-TURBO" }, "options": { "maxTokens": 1000, "temperature": 0 }, "messages": { "values": [ { "role": "system", "content": "=You are \u201cQC\u201d\u2014a deterministic, conservative validator for a weekly client newsletter at a $50B private wealth firm.\n\nScope:\n1) FACT-CHECK the draft\u2019s claims against the supplied research JSON.\n2) COMPLIANCE SCAN for risky language (promissory, specific advice, guarantees, allocations).\n3) THEME Reject any draft where more than 5% of the content covers assets, events, or regions that are not part of an average institutional/RIA client's multi-asset portfolio.\n\nDecision rules:\n- Flag ONLY what you can point to explicitly in the draft.\n- Be conservative: better to flag than miss.\n- Never rewrite the newsletter\u2014just report issues.\n\nOutput: A single JSON object **exactly** in this schema (no extra text):\n{\n \"material_issue\": boolean, // true if any high-severity fact or comp issue\n \"facts\": [\n {\n \"severity\": \"low|medium|high\",\n \"where\": \"section/heading or CSS selector or short quote\",\n \"claim\": \"verbatim or tight paraphrase of the draft claim\",\n \"reason\": \"why it\u2019s wrong/unsupported/overstated\",\n \"evidence\": \"numbers/dates from research JSON that contradict or fail to support\",\n \"fix\": \"plain-language correction suggestion\"\n }\n ],\n \"compliance\": [\n {\n \"severity\": \"low|medium|high\",\n \"where\": \"section/heading or short quote\",\n \"issue\": \"promissory language / specific advice / guarantee / allocation / performance claim / other\",\n \"snippet\": \"verbatim risky wording\",\n \"policy\": \"short label of the violated guardrail\",\n \"fix\": \"safer phrasing or removal guidance\"\n }\n ],\n \"notes\": [\n \"optional short observations to help the editor (never prescriptive rewriting)\"\n ]\n}\n\nSeverity guidance:\n- high = could mislead on facts or breach core compliance.\n- medium= material nuance missing; could be misread by clients.\n- low = wording tone or minor precision issue.\n" }, { "content": "=WEEK_CONTEXT:\n{{\n JSON.stringify({\n start_iso: $json.week_meta?.start_iso || $json.start_iso || \"\",\n end_iso: $json.week_meta?.end_iso || $json.end_iso || \"\",\n week_label: $json.week_meta?.week_label || $json.week_label || \"\"\n })\n}}\n\nDRAFT_HTML:\n{{\n (() => {\n let html = ($json.html || \"\").toString();\n // keep QC fast: drop scripts/styles and cap length\n html = html.replace(//gi, \"\")\n .replace(//gi, \"\");\n return html.length > 30000 ? html.slice(0, 30000) : html;\n })()\n}}\n\nRESEARCH_JSON:\n{{\n (() => {\n // If you already attach a compact research object in context, use it directly.\n const r = $json.research || {};\n // Optional: if r can be huge, pick only needed keys:\n // const slim = { equities: r.equities, rates: r.rates, fx: r.fx, notes: r.notes };\n const s = JSON.stringify(r);\n return s.length > 30000 ? s.slice(0, 30000) : s;\n })()\n}}\n\n\nINSTRUCTIONS:\n- Compare DRAFT_HTML against RESEARCH_JSON using WEEK_CONTEXT for dates.\n- If RESEARCH_JSON is empty, skip factual checks and only run compliance checks; set notes = \"facts_skipped_no_research\".\n- Match numeric values exactly (including %/bps). If rounding differs but clearly references the same RESEARCH number, mark \"medium\" and suggest rounding to one decimal (or bps for yields).\n- Flag any dates not equal to WEEK_CONTEXT (including YEAR).\n- Focus only on issues that matter for institutional communications.\n\nReturn ONLY the JSON object specified in the system message.\n" } ] }, "simplify": false, "jsonOutput": true }, "credentials": { "openAiApi": { "id": "credential-id", "name": "" } }, "typeVersion": 1.8, "alwaysOutputData": true }, { "id": "9a9426ae-4678-4e06-9126-bf090b1acffe", "name": "HTML Composer LLM", "type": "@n8n/n8n-nodes-langchain.openAi", "position": [ 280, 360 ], "parameters": { "modelId": { "__rl": true, "mode": "list", "value": "gpt-3.5-turbo", "cachedResultName": "GPT-3.5-TURBO" }, "options": { "maxTokens": 4000, "temperature": 0.2 }, "messages": { "values": [ { "role": "system", "content": "=You are \u201cHTML Builder\u201d. Input: the editor JSON above. Output: ONE JSON:\n{ \"subject\": string, \"html\": string }\n\nRENDERING RULES\"\n- Headline: render ONLY

{{ $json.message.content.newsletter_content.headline }}

.\n- Do NOT render newsletter_content.subheader anywhere in the HTML body.\n- (Subject logic unchanged.)\n- Subject: use newsletter_content.subject if present; otherwise \"Weekly Markets \u2014 \" + newsletter_content.subheader. {{ $json.message.content.newsletter_content.subject_options }} and {{ $json.message.content.newsletter_content.headline }} need to be consistent\n\nHTML STRUCTURE:\n- Full HTML document () with and responsive meta.\n- Container: max-width 720px; centered; 24px page padding.\n- Typography: -apple-system, Segoe UI, Roboto, Arial, sans-serif; base 16px; line-height ~1.55.\n- Palette: #111 text; #555 secondary; dividers #e6e6e9; subtle background #f6f7fb; link #2d6cdf.\n- Sections in this exact order & labels (the order MUST be respected):\n 1) Author Note \u2192 newsletter_content.sections.author_note_html\n 2) Weekly Markets Summary \u2192 newsletter_content.sections.market_summary_html\n 3) Deeper Dive \u2192 newsletter_content.sections.deep_dive_html\n 4) What to Expect Next Week \u2192 newsletter_content.sections.next_week_html\n 5) Sources \u2192 newsletter_content.sections.sources_html\n 6) Disclaimers \u2192 newsletter_content.sections.disclaimer_html\n 7) Signature \u2192 signature_html\n\nSTYLE: \n- use

/

, 24\u201328px spacing, 1px dividers (#e6e6e9), bullet lists where provided. Avoid large data tables unless supplied by the editor (next_week table is expected).\n- Sanitize/escape untrusted inputs; no inline JS; no external assets.\n\nTABLES (EMAIL-SAFE \u2014 use THIS exact markup for \u201cWhat to Expect Next Week\u201d)\n- Emit pure HTML with INLINE styles only. No Markdown tables. No

🔓 Unlock All 10,000+ Templates Free

Get instant access to every AI workflow and prompt. One email, full access.

Join 5,000+ automation pros. No spam.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal