Back to .md Directory

📧 Complete Gmail + qwen Code Workflow Guide

Walks through a complete Gmail-to-qwen Code workflow for automated SEO content creation, from email detection to dashboard updates.

May 2, 2026
0 downloads
1 views
ai prompt workflow
View source

What this file does

Walks through a complete Gmail-to-qwen Code workflow for automated SEO content creation, from email detection to dashboard updates.

When to use it

  • Setting up an email-triggered content generation pipeline
  • Testing a new Gmail + AI assistant integration
  • Debugging a multi-step automation with watchers and orchestrator
  • Onboarding a team member to an existing SEO automation system

Assumes this stack

Pythonqwen CodeGmail APIObsidian

📧 Complete Gmail + qwen Code Workflow Guide

✅ Your System is Ready!

  • ✅ Gmail integration configured
  • ✅ 18 unread emails detected
  • ✅ qwen Code installed (v0.12.3)
  • ✅ Orchestrator enhanced with intelligent routing

🎯 How It Works

Workflow Overview

1. You send an email (or receive one)
   ↓
2. Gmail Watcher detects it (checks every 5 minutes)
   ↓
3. Creates action file in /Content_Ideas
   ↓
4. Orchestrator detects new file
   ↓
5. Analyzes content type (Keyword Research / Writing / Optimization)
   ↓
6. Triggers qwen Code with specialized prompt
   ↓
7. qwen Code creates brief/content/analysis
   ↓
8. Files saved to appropriate folders
   ↓
9. Dashboard updated

📝 Test the Complete Workflow

Step 1: Send Yourself a Test Email

From any email account, send an email to your Gmail address with one of these subjects:

For Keyword Research:

Subject: Keyword research needed for "AI SEO tools 2026"

Body:
I need comprehensive keyword research for the topic "AI SEO tools 2026". 
Find related keywords, analyze difficulty, and identify quick wins.

For Content Writing:

Subject: Write an article about local SEO tips for small businesses

Body:
Please create a comprehensive guide about local SEO for small businesses.
Include Google Business Profile optimization, local citations, and review management.

For Content Optimization:

Subject: Optimize my content about technical SEO checklist

Body:
I have an article about technical SEO that needs optimization.
Please analyze and provide recommendations for improving rankings.

Step 2: Start the Watchers

Open three separate terminal windows:

Terminal 1 - Gmail Watcher:

cd /Users/arshah/Documents/GitHub/ai-seo-fte
source venv/bin/activate
python src/gmail_watcher.py

Terminal 2 - Orchestrator:

cd /Users/arshah/Documents/GitHub/ai-seo-fte
source venv/bin/activate
python src/orchestrator.py

Terminal 3 - Optional: File System Watcher

cd /Users/arshah/Documents/GitHub/ai-seo-fte
source venv/bin/activate
python src/filesystem_watcher.py

Step 3: Watch the Magic Happen

Within 5 minutes, you should see:

  1. Gmail Watcher detects your email:

    Found 1 content-related emails
    Created action file: GMAIL_20260314_...md
    
  2. Orchestrator picks it up:

    Found 1 pending item(s)
    Processing: GMAIL_...md
    Detected content type: keyword_research
    Running qwen Code...
    
  3. qwen Code processes the request:

    • Reads Content_Handbook.md and Content_Strategy.md
    • Creates content brief in /Content_Briefs/
    • Updates Dashboard.md
    • Moves file to /Done/

Step 4: Check Results in Obsidian

  1. Open Obsidian with your vault
  2. Check these folders:
    • /Content_Ideas/ - New action file created
    • /Content_Briefs/ - qwen Code's analysis and brief
    • Dashboard.md - Updated with recent activity

🎬 Quick Demo (Without Email)

Want to test right now without sending an email? Run this:

cd /Users/arshah/Documents/GitHub/ai-seo-fte

# Create a test content idea manually
cat > SEO_Employee_Vault/Content_Ideas/MANUAL_keyword_research_ai_seo.md << 'EOF'
---
type: manual_request
source: user
created: 2026-03-14T01:30:00
priority: high
status: pending
---

# Keyword Research Request

Please do comprehensive keyword research for "AI SEO tools 2026".

I need:
- Primary and related keywords
- Search volume and difficulty analysis
- Competition analysis
- Content recommendations
- Quick win opportunities
EOF

# Now run the orchestrator
source venv/bin/activate
python src/orchestrator.py

The orchestrator will:

  1. Detect the manual request
  2. Identify it as keyword_research
  3. Trigger qwen Code
  4. Create a comprehensive keyword brief

📊 Content Types Detected

The orchestrator intelligently routes requests:

Content TypeTrigger WordsOutput
Keyword Research"keyword research", "find keywords", "search volume", "KD score"Keyword Research Report
Content Writing"write an article", "create content", "blog post", "guide about"Content Brief + Outline
Content Optimization"optimize", "improve SEO", "meta description", "refresh"SEO Audit + Recommendations
GeneralEverything elseAnalysis + Recommendations

🔧 Monitoring and Debugging

Check Logs

# Orchestrator logs
tail -f orchestrator.log

# Gmail watcher logs (in system log)

Check Processed Files

# See what's been processed
cat SEO_Employee_Vault/.processed_files.txt

# See what's pending
ls -la SEO_Employee_Vault/Content_Ideas/

Stop Watchers

Press Ctrl+C in each terminal window to stop the watchers.


🎯 Example Workflows

Workflow 1: Keyword Research

Email Subject: Keyword research for "best CRM software 2026"

What Happens:

  1. Gmail Watcher creates: GMAIL_...keyword_research_crm.md
  2. Orchestrator detects type: keyword_research
  3. qwen Code creates in /Content_Briefs/:
    • Primary keyword analysis
    • 15+ related keywords with metrics
    • Search intent breakdown
    • Competition analysis
    • Content recommendations

Workflow 2: Content Writing

Email Subject: Write a guide about link building strategies

What Happens:

  1. Gmail Watcher creates action file
  2. Orchestrator detects: content_writing
  3. qwen Code creates:
    • Content brief with outline
    • Target keywords
    • Word count recommendation
    • Internal linking plan
    • Meta description draft

Workflow 3: Content Optimization

Email Subject: Optimize my article about on-page SEO

What Happens:

  1. Gmail Watcher detects request
  2. Orchestrator identifies: content_optimization
  3. qwen Code provides:
    • SEO audit
    • Title/meta optimization
    • Header structure improvements
    • Keyword placement suggestions
    • Featured snippet opportunities

⚡ Pro Tips

1. Use Specific Subject Lines

✅ Good:

  • "Keyword research for AI writing tools"
  • "Write article about local SEO for dentists"
  • "Optimize content about technical SEO"

❌ Vague:

  • "SEO help needed"
  • "Content idea"
  • "Write something"

2. Include Details in Email Body

The more context you provide, the better qwen Code can help:

Good:
"Write a comprehensive guide about keyword research for 2026.
Target audience: Small business owners
Include: Tools, step-by-step process, common mistakes
Word count: 2000+ words"

3. Check Dashboard Daily

Open Dashboard.md in Obsidian every morning to see:

  • What was processed overnight
  • New content briefs created
  • Pending approvals

4. Approve Content for Publishing

When qwen Code creates content:

  1. Check /Pending_Approval/
  2. Review the content
  3. Approve: Move to /Approved/
  4. Request changes: Move to /Rejected/ with comments

🚨 Troubleshooting

Gmail Watcher Not Detecting Emails

  1. Check if watcher is running
  2. Verify authentication: ls -la token.json
  3. Re-authenticate if needed: python auth_gmail.py

Orchestrator Not Processing

  1. Check qwen Code is installed: qwen --version
  2. Verify vault path in .env
  3. Check logs: tail orchestrator.log

qwen Code Timing Out

  • Complex tasks may take time
  • Increase timeout in orchestrator.py (default: 10 min)
  • Break large requests into smaller tasks

📚 Next Steps

After testing:

  1. Set up WordPress MCP for auto-publishing
  2. Add Google Search Console integration
  3. Configure Ahrefs/SEMrush API for keyword data
  4. Set up cloud deployment for 24/7 operation

🎉 You're All Set!

Your SEO Content Writing Employee is fully configured and ready to work!

Start by:

  1. Sending yourself a test email
  2. Running the watchers
  3. Watching qwen Code create amazing content briefs!

Questions? Check:

  • README.md - Full documentation
  • QUICKSTART.md - Getting started guide
  • GMAIL_SETUP.md - Gmail setup details

What's inside

9 sections, 3 terminal commands, 3 example workflows, 1 manual test script, 1 content type table

Change this for your project

  • Replace /Users/arshah/Documents/GitHub/ai-seo-fte with your project root
  • Replace SEO_Employee_Vault with your vault directory name
  • Replace auth_gmail.py with your own authentication script name

Where it goes

A standard operating procedure. Keep where the team or agent running the process will find it.

Worth borrowing

  • Using subject-line trigger words to route requests to different content types
  • Creating manual action files as a fallback when email is unavailable
  • Separating watcher, orchestrator, and filesystem processes into independent terminals

Related Documents