Client: Half Dozen

Arc for Gmail

Multi-user OAuth-based Gmail→Notion sync with AI-powered summaries and automatic contact management

• Cloudflare Workers • Workers AI • Notion API 2025-09-03 • Gmail API

The Challenge

Half Dozen needed a way to capture important email interactions in their Notion workspace without manual copying. The system had to support multiple team members, preserve email formatting, and automatically categorize internal vs. external participants.

Technical constraints:

  • Multi-user OAuth (multiple Gmail accounts)
  • HTML email → Notion block conversion
  • Character encoding issues (mojibake)
  • Notion API 2025-09-03 (new data_source_id architecture)
  • Bespoke contact categorization (halfdozen.co domain handling)

Applying the Arc Pattern

This project validated the Arc pattern: efficient connection between points. Gmail → Notion as a one-way sync with minimal transformation.

The Arc Implementation:

Gmail (OAuth)  ──────arc──────>  Notion (OAuth)

1. User labels email "Log to Notion"
2. Worker syncs every 5 minutes (cron)
3. HTML → Notion blocks (minimal transformation)
4. AI summary generation (Workers AI)
5. Contact auto-creation + categorization
					

Arc principles applied:

  • Single direction: Gmail→Notion only, no bidirectional complexity
  • Minimal transformation: Preserve email structure, sanitize only when necessary
  • OAuth-based: Users authorize their own accounts, no API key management
  • Serverless: Cloudflare Workers at the edge, scales automatically

Technical Implementation

Infrastructure

  • • Cloudflare Workers (serverless)
  • • KV Storage (thread tracking, OAuth tokens)
  • • Cron Triggers (5-minute sync cycle)
  • • Workers AI (email summarization)

API Integration

  • • Gmail API (OAuth 2.0, thread fetching)
  • • Notion API 2025-09-03 (data_source_id)
  • • Workers AI (@cf/meta/llama-3.1-8b-instruct)
  • • node-html-parser (email conversion)

Key Technical Challenges Solved

1. Character Encoding (Mojibake)

Email HTML contains broken UTF-8 sequences. Built comprehensive sanitization removing 40+ mojibake patterns while preserving valid punctuation.

2. Rich Text Array Limits

Notion enforces 100-item limit per rich_text array. Implemented automatic paragraph splitting for long emails with many inline formatting changes.

3. Contact Categorization

Bespoke logic: halfdozen.co emails → Owner field (internal team), external emails → Contacts database with auto-creation and relation linking.

4. HTML → Notion Conversion

Preserves bold, italic, links, headings, lists, quotes, code blocks. Skips tables and images. Maintains email thread structure with dividers.

Results

Deployed to production at Half Dozen with bespoke configuration for their team.

5 min

Sync cycle

Multi-user

OAuth support

100%

Automated

Validated outcomes:

  • Email formatting preserved (links, bold, italic, structure)
  • Contacts auto-created and linked via relations
  • AI summaries generated for quick context
  • Internal vs. external participant categorization working
  • Production-stable on 5-minute cron (no failures)

Development Approach

Built using Claude Code (AI-native development) with comprehensive documentation and test scripts for debugging.

Time to production: ~11 hours (vs. 25-30 hours traditional)

Cost: ~$6.30 in AI costs (vs. $3,750 manual development)

ROI: 99.8% cost savings, 55-65% time savings

Full experiment documentation and research paper available at createsomething.io.

Why This Validates Arc

Arc for Gmail was the first implementation of the Arc pattern. Its success in production validates that "efficient connection between points" is a canonical approach worth replicating.

The pattern proved reusable: Arc for Fireflies (transcripts → Notion) is next, following the exact same principles with different endpoints.

Read the full Arc pattern documentation at createsomething.ltd/patterns/arc.

Need a Custom Sync Integration?

The Arc pattern can connect any systems: Slack→Notion, Fireflies→Notion, Discord→Notion, and beyond.

Start a Conversation