MinAI - Về trang chủ
Lý thuyết
7/1330 phút
Đang tải...

Email Summarization

Tự động tóm tắt email dài và tạo daily digest với AI

📋 Email Summarization

0

🎯 Mục tiêu bài học

TB5 min

Sau bài học này, bạn sẽ:

✅ Xây dựng single email summarizer workflow

✅ Tạo thread summarizer cho email conversations dài

✅ Build daily digest workflow tự động

✅ Extract action items từ emails và integrate Slack

Biến inbox overload thành concise summaries. Build workflows tóm tắt email, tạo daily digest, và extract action items.

1

🔍 Use Cases

TB5 min
Diagram
Đang vẽ diagram...

Checkpoint

Bốn use cases chính của email summarization là gì?

2

📧 Single Email Summarizer

TB5 min
Diagram
Đang vẽ diagram...
JavaScript
1// OpenAI System Prompt
2const systemPrompt = `
3You are an email summarizer. For each email, provide:
41. **TL;DR** (1 sentence, max 15 words)
52. **Key Points** (2-4 bullet points)
63. **Action Items** (tasks to do, or "None")
74. **Deadline** (if mentioned, or "None")
85. **Reply Needed** (yes/no)
9
10Format as clean text, not JSON.
11Keep the language same as the original email.
12`;
13
14// User message
15const userMessage = `
16From: ${$json.from}
17Subject: ${$json.subject}
18Date: ${$json.date}
19
20${$json.body}
21`;

Checkpoint

AI Summarizer trích xuất những thông tin chính nào từ email?

3

🧠 Thread Summarizer

TB5 min
JavaScript
1// Code node: Combine thread messages
2const messages = $json.messages; // Array from Gmail Get Thread
3
4const threadContent = messages.map((msg, i) => `
5--- Message ${i + 1} ---
6From: ${msg.from}
7Date: ${msg.date}
8${msg.body}
9`).join("\n");
10
11const prompt = `
12Summarize this email thread:
13- Number of messages: ${messages.length}
14- Participants: list all
15- Key decisions made
16- Open questions
17- Action items per person
18
19Thread:
20${threadContent}
21`;
22
23return { prompt, messageCount: messages.length };

Checkpoint

Thread Summarizer khác gì so với Single Email Summarizer?

4

📊 Daily Digest Workflow

TB5 min
Diagram
Đang vẽ diagram...
JavaScript
1// Code node: Prepare digest prompt
2const emails = $input.all();
3
4const emailList = emails.map((e, i) => `
5[${i + 1}] From: ${e.json.from}
6Subject: ${e.json.subject}
7Preview: ${e.json.body.substring(0, 200)}
8`).join("\n---\n");
9
10const digestPrompt = `
11Create a morning email digest from ${emails.length} emails received today.
12
13Format:
14## Email Digest - ${new Date().toLocaleDateString()}
15Total: ${emails.length} emails
16
17### Urgent (needs immediate attention)
18- [subject] from [sender] - [1 line summary]
19
20### Important (respond today)
21- ...
22
23### FYI (no action needed)
24- ...
25
26### Action Items
27- [ ] task from email X
28
29Emails:
30${emailList}
31`;
32
33return { prompt: digestPrompt };

Checkpoint

Daily Digest chia emails thành những nhóm priority nào?

5

⚡ Action Item Extraction

TB5 min
JavaScript
1// OpenAI prompt for action item extraction
2const extractPrompt = `
3Extract all action items from this email.
4For each action item:
5- Task description
6- Assigned to (if mentioned)
7- Due date (if mentioned)
8- Priority (high/medium/low based on context)
9
10Return JSON array:
11[
12 {
13 "task": "...",
14 "assignedTo": "...",
15 "dueDate": "...",
16 "priority": "..."
17 }
18]
19
20Email:
21From: ${$json.from}
22Subject: ${$json.subject}
23Body: ${$json.body}
24`;

Checkpoint

Action Item Extraction trích xuất những trường dữ liệu nào?

6

🛠️ Slack Integration

TB5 min
JavaScript
1// Format for Slack message
2const summary = $json.summary;
3const slackMessage = {
4 blocks: [
5 {
6 type: "header",
7 text: {
8 type: "plain_text",
9 text: `Email Summary: ${$json.subject}`
10 }
11 },
12 {
13 type: "section",
14 text: {
15 type: "mrkdwn",
16 text: `*From:* ${$json.from}\n*TL;DR:* ${summary.tldr}`
17 }
18 },
19 {
20 type: "section",
21 text: {
22 type: "mrkdwn",
23 text: `*Key Points:*\n${summary.keyPoints.map(p => ` ${p}`).join('\n')}`
24 }
25 }
26 ]
27};
28
29return slackMessage;
Pro Tip

Set up Gmail filter để chỉ summarize emails dài hơn 200 words. Emails ngắn không cần summary.

Checkpoint

Làm thế nào để format email summary cho Slack notification?

7

📝 Bài Tập Thực Hành

TB5 min
Exercises
  1. Build single email summarizer với Slack notifications
  2. Create daily digest workflow chạy lúc 8 AM
  3. Extract action items và tạo Todoist/Trello tasks tự động
  4. Build thread summarizer cho email conversations dài

Checkpoint

Bạn đã hoàn thành daily digest workflow chưa? Mô tả kết quả?

🚀 Bài tiếp theo

Blog Post Generator — Xây dựng pipeline tự động tạo blog posts với AI.