Skip to main content
Services are the foundation of DelightBridge. Each service represents a connected Gmail account with its own configuration, branding, and AI behavior. This guide covers how to set up and manage services effectively.

Understanding Services

A Service in DelightBridge is:
  • A connected Gmail account (e.g., [email protected], [email protected])
  • A container for threads and conversations from that account
  • A set of configuration options that control AI behavior and email formatting
  • A visual identity (name and color) for easy recognition in the UI

Service Data Model

Each service stores:
FieldDescription
NameDisplay name (e.g., “Customer Support”, “Sales Team”)
EmailGmail address (set automatically when connected)
ColorBrand color for visual identification
CategoriesList of category definitions for AI classification
SignatureHTML email signature appended to all outgoing emails
DocumentReference documentation in Markdown format
See database schema: src/lib/db/schema.ts:33-44

Creating and Connecting Services

Admin permission required — Only users with Admin role can create services and connect Gmail accounts.

Create a New Service

1

Open Settings

Click the settings icon (gear) in the left sidebar.
2

Navigate to Services Tab

Click “서비스 관리” (Service Management) in the settings sidebar.
3

Add Service

Click the “서비스 추가 + 연결” (Add Service + Connect) button in the top-right.
4

Service Created

A new service is created with:
  • Default name: “New Service”
  • Placeholder email: “연결 전” (Not yet connected)
  • Random color from the preset palette
  • Empty categories, signature, and documents

Connect to Gmail

After creating a service, connect it to a Gmail account:
1

Initiate OAuth Flow

Click “Google 계정 연결” (Connect Google Account) button.
2

Sign In to Google

You’ll be redirected to Google’s authorization page. Sign in with the Gmail account you want to connect.
3

Grant Permissions

Approve the following scopes:
  • https://www.googleapis.com/auth/gmail.readonly — Read emails
  • https://www.googleapis.com/auth/gmail.send — Send emails
  • https://www.googleapis.com/auth/gmail.modify — Modify labels and threads
4

Automatic Configuration

DelightBridge receives the OAuth tokens and:
  • Stores refresh token securely in database
  • Fetches your Gmail profile information
  • Updates the service email address automatically
  • Marks the service as “connected”
OAuth implementation: src/app/api/services/oauth/callback/route.ts
If you see an error like “이미 다른 서비스에서 사용 중인 Gmail 계정입니다” (Gmail account already in use), that email is connected to another service. Disconnect it first or use a different Gmail account.

Service Configuration

Basic Settings

Give your service a descriptive name:
  • Appears in the sidebar and mail list header
  • Should clearly identify the purpose (e.g., “Support”, “Sales”, “Partnerships”)
  • Can be changed at any time by clicking “수정” (Edit) on the service card
Best Practices:
  • Use team or department names
  • Keep it short (1-2 words)
  • Use title case (“Customer Support” not “customer support”)

Reference Documents

Reference documents provide context to the AI when generating draft replies. Think of them as your team’s knowledge base.

Document Format

Documents are written in Markdown format:
# Refund Policy

## Standard Refunds
- Within 7 days of purchase: Full refund
- 7-30 days: Store credit only
- After 30 days: Contact us for case-by-case review

## How to Request
1. Reply to your order confirmation email
2. Include order number and reason
3. We'll process within 2 business days

## Exceptions
- Digital products: No refunds after download
- Custom orders: Non-refundable
- Sale items: Final sale (no refunds)

# Shipping Information

## Delivery Times
- US: 3-5 business days
- Canada: 5-7 business days  
- International: 10-15 business days

## Tracking
Tracking numbers are emailed within 24 hours of shipment.

What to Include

Policies

  • Refund and return policies
  • Privacy and data handling
  • Terms of service
  • SLA commitments

Procedures

  • How to process common requests
  • Escalation procedures
  • Account management steps
  • Troubleshooting guides

Product Info

  • Feature descriptions
  • Pricing and billing details
  • Technical specifications
  • Compatibility information

Tone Guidelines

  • Brand voice principles
  • Greeting and sign-off preferences
  • Formality level
  • Emoji usage rules

Editing Documents

1

Open Settings

Go to Settings → “문서 및 서명” (Documents & Signature).
2

Select Service

Choose which service to configure from the dropdown.
3

Write in Markdown

Use the large text area to write or paste your documentation.Tips:
  • Use # for main headings, ## for subheadings
  • Use - for bullet lists, 1. for numbered lists
  • Use **bold** for emphasis
  • Keep sections focused and scannable
4

Save

Click “저장” (Save) at the bottom. Changes take effect immediately for new draft generation.
AI reads the full document when generating drafts. Well-organized documents with clear headings help AI find relevant information faster.

Email Signatures

Signatures are automatically appended to all AI-generated drafts and outgoing emails.

Signature Format

Signatures use HTML format for rich formatting:
<p>Best regards,<br>
<strong>Sarah Chen</strong><br>
Customer Success Team</p>

<p style="margin-top: 12px; font-size: 12px; color: #6b7280;">
<strong>Acme Inc.</strong><br>
[email protected] | +1 (555) 123-4567<br>
<a href="https://acme.com/help" style="color: #3b82f6;">Help Center</a>
</p>
This renders as:
Best regards,
Sarah Chen
Customer Success Team
Acme Inc.
[email protected] | +1 (555) 123-4567
Help Center

Signature Best Practices

  • 3-5 lines maximum
  • Include only essential contact info
  • Avoid large images or logos (email size)
Supported tags:
  • <p> for paragraphs
  • <br> for line breaks
  • <strong> or <b> for bold
  • <em> or <i> for italic
  • <a href="..."> for links
Avoid:
  • <div> (use <p> instead)
  • Inline CSS (use style attribute)
  • External stylesheets (not supported in email)
Use the preview panel in the settings modal:
  • Preview updates in real-time as you type
  • Check formatting on both light and dark backgrounds
  • Test links to ensure they open correctly

Editing Signatures

1

Navigate to Documents Tab

Settings → “문서 및 서명” (Documents & Signature)
2

Select Service

Choose the service from the dropdown.
3

Edit HTML

Write or paste HTML in the signature text area.
4

Preview

The preview panel below shows how your signature will appear in emails.
5

Save

Click “저장” (Save). New drafts will use the updated signature.

Categories

Categories help organize threads and guide AI behavior. AI automatically assigns categories when generating drafts based on email content.

Category Properties

Each category has:
PropertyPurpose
NameDisplay text (e.g., “Billing Question”, “Bug Report”)
Background ColorHex code for category pill background
Text ColorHex code for category pill text

Creating Categories

1

Open Categories Tab

Settings → “카테고리 설정” (Category Settings)
2

Select Service

Choose which service to configure.
3

Add Category

Click the “추가” (Add) button.
4

Configure Category

  • Enter a clear, descriptive name
  • Choose a color preset or enter custom hex codes
  • Click “저장” (Save)

Category Color Presets

Blue

Text: #1d4ed8

Red

Text: #b91c1c

Green

Text: #065f46

Purple

Text: #6d28d9

Pink

Text: #9d174d

Yellow

Text: #92400e

Category Examples by Team

  • Bug Report (Red)
  • Feature Request (Purple)
  • How-To Question (Blue)
  • Billing Issue (Yellow)
  • General Inquiry (Gray)

How AI Uses Categories

When generating a draft, AI:
  1. Reads the email thread content
  2. Compares against your category list (names only)
  3. Assigns the most relevant category ID
  4. Returns the category with the draft
Implementation: src/app/api/draft/generate/route.ts:22-50
Good category names help AI make better classifications. Use specific, action-oriented names like “Refund Request” instead of vague terms like “Issue”.

Syncing Services

Keep your inbox up-to-date with Gmail by syncing services manually or via automated schedules.

Sync Types

Fetches only new or changed threads since the last sync:
  • Speed: Fast (typically < 5 seconds)
  • API Usage: Minimal
  • Use Case: Regular updates throughout the day
How it works:
  1. Retrieves lastHistoryId from database
  2. Calls Gmail History API with that ID
  3. Processes only changed threads
  4. Updates lastHistoryId for next sync

Manual Sync

Trigger sync from the Services tab:
  1. Open Settings → Services
  2. Select the service you want to sync
  3. Click “지금 동기화” (Sync Now) for incremental or “전체 동기화” (Full Sync)
  4. Watch the sync logs appear below the buttons
Sync logs show:
  • Timestamp
  • Service name
  • Sync mode (incremental or full)
  • Number of threads synced
  • Number of messages upserted
  • Success or error status

Automatic Sync

DelightBridge can automatically sync services via:
  1. Cron Jobs: Schedule periodic syncs (e.g., every 15 minutes)
  2. Push Notifications: Gmail notifies DelightBridge when new emails arrive
Cron endpoint: src/app/api/cron/sync-gmail/route.ts
For high-volume inboxes, set up a cron job to run incremental sync every 15-30 minutes. Use full sync only when needed (e.g., weekly maintenance).

Deleting Services

Destructive action — Deleting a service permanently removes:
  • All threads associated with that service
  • All messages within those threads
  • All drafts
  • Gmail connection tokens
This cannot be undone.
To delete a service:
  1. Open Settings → Services
  2. Click the trash icon on the service card
  3. Confirm the deletion
  4. Service and all associated data are removed
Database cascade delete: schema.ts:49 (categories), schema.ts:58 (threads)

Best Practices

Create services that map to your team structure:This allows different teams to manage their own categories, documents, and signatures.
Schedule regular reviews of reference documents:
  • Monthly: Review for outdated information
  • After policy changes: Update immediately
  • After product launches: Add new product info
  • Based on feedback: Improve unclear sections
After updating documents or categories:
  1. Open an existing inbox thread
  2. Click “Regenerate” to generate a new draft
  3. Verify AI is using updated information correctly
  4. Use “Talk to Draft” to test edge cases
Check sync logs regularly for errors:
  • State mismatch: Token refresh issue, reconnect Gmail
  • Quota exceeded: Reduce sync frequency
  • Network timeout: Retry sync

AI Drafts

Learn how AI uses your documents and categories to generate drafts

Team Collaboration

Set up permissions and workspace members for your services

Build docs developers (and LLMs) love