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:| Field | Description |
|---|---|
| Name | Display name (e.g., “Customer Support”, “Sales Team”) |
| Gmail address (set automatically when connected) | |
| Color | Brand color for visual identification |
| Categories | List of category definitions for AI classification |
| Signature | HTML email signature appended to all outgoing emails |
| Document | Reference documentation in Markdown format |
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
Connect to Gmail
After creating a service, connect it to a Gmail account:Sign In to Google
You’ll be redirected to Google’s authorization page. Sign in with the Gmail account you want to connect.
Grant Permissions
Approve the following scopes:
https://www.googleapis.com/auth/gmail.readonly— Read emailshttps://www.googleapis.com/auth/gmail.send— Send emailshttps://www.googleapis.com/auth/gmail.modify— Modify labels and threads
src/app/api/services/oauth/callback/route.ts
Service Configuration
Basic Settings
- Service Name
- Brand Color
- Connection Status
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
- 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: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
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
Email Signatures
Signatures are automatically appended to all AI-generated drafts and outgoing emails.Signature Format
Signatures use HTML format for rich formatting:Best regards,
Sarah Chen
Customer Success Team Acme Inc.
[email protected] | +1 (555) 123-4567
Help Center
Signature Best Practices
Keep It Concise
Keep It Concise
- 3-5 lines maximum
- Include only essential contact info
- Avoid large images or logos (email size)
Use Semantic HTML
Use Semantic HTML
Supported tags:
<p>for paragraphs<br>for line breaks<strong>or<b>for bold<em>or<i>for italic<a href="...">for links
<div>(use<p>instead)- Inline CSS (use style attribute)
- External stylesheets (not supported in email)
Test Rendering
Test Rendering
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
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:| Property | Purpose |
|---|---|
| Name | Display text (e.g., “Billing Question”, “Bug Report”) |
| Background Color | Hex code for category pill background |
| Text Color | Hex code for category pill text |
Creating Categories
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
- Customer Support
- Sales
- Operations
- 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:- Reads the email thread content
- Compares against your category list (names only)
- Assigns the most relevant category ID
- Returns the category with the draft
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
- Incremental Sync
- Full Sync
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
- Retrieves
lastHistoryIdfrom database - Calls Gmail History API with that ID
- Processes only changed threads
- Updates
lastHistoryIdfor next sync
Manual Sync
Trigger sync from the Services tab:- Open Settings → Services
- Select the service you want to sync
- Click “지금 동기화” (Sync Now) for incremental or “전체 동기화” (Full Sync)
- Watch the sync logs appear below the buttons
- 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:- Cron Jobs: Schedule periodic syncs (e.g., every 15 minutes)
- Push Notifications: Gmail notifies DelightBridge when new emails arrive
src/app/api/cron/sync-gmail/route.ts
Deleting Services
To delete a service:- Open Settings → Services
- Click the trash icon on the service card
- Confirm the deletion
- Service and all associated data are removed
schema.ts:49 (categories), schema.ts:58 (threads)
Best Practices
Organize by Function
Organize by Function
Create services that map to your team structure:
- Support Service: [email protected]
- Sales Service: [email protected]
- Partnerships Service: [email protected]
Keep Documents Updated
Keep Documents Updated
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
Test AI Behavior
Test AI Behavior
After updating documents or categories:
- Open an existing inbox thread
- Click “Regenerate” to generate a new draft
- Verify AI is using updated information correctly
- Use “Talk to Draft” to test edge cases
Monitor Sync Logs
Monitor Sync Logs
Check sync logs regularly for errors:
- State mismatch: Token refresh issue, reconnect Gmail
- Quota exceeded: Reduce sync frequency
- Network timeout: Retry sync
Related Features
AI Drafts
Learn how AI uses your documents and categories to generate drafts
Team Collaboration
Set up permissions and workspace members for your services