Quick Overview
This workflow runs daily, pulls recent competitor newsletter emails from Gmail, analyzes each message with Anthropic Claude, and appends structured insights and response ideas to Google Sheets, then marks processed emails as read and labeled so they aren’t analyzed twice.
How it works
- Runs every day at 9:00 AM to load the Gmail search query, maximum email body length, and your brand context.
- Reads your Google Sheets log to collect Message IDs that have already been analyzed.
- Fetches matching emails from Gmail, skips any already logged, and cleans/truncates the email body text for analysis.
- Sends each prepared email to Anthropic Claude to extract a structured competitor analysis and a concrete response idea based on your brand context.
- Parses Claude’s JSON output and formats one row per successfully analyzed email.
- Appends the results to Google Sheets, then marks each processed Gmail message as read and applies an “Analyzed” label.
Setup
- Add credentials for Gmail, Google Sheets, and Anthropic (Claude) in n8n.
- In Gmail, create labels (for example “Competitors” and “Analyzed”) and set up a filter so competitor newsletters get the “Competitors” label.
- Create a Google Sheet with columns for MessageId, email metadata, and analysis fields, then select the target spreadsheet and sheet tab in the Google Sheets nodes.
- Set the correct Gmail label/query and choose the “Analyzed” label in the Gmail labeling step.
- Update the brand description in the workflow’s brand context setting so Claude’s response ideas match your business.