当前位置: 首页 > Skill >

Email To Calendar

Email To Calendar

Email To Calendar

将邮件转换为Google日历事件。扫描Gmail收件箱(或仅转发邮件),提取会议、约会、RSVP和截止日期,然后创建相应的日历事件。

1.13.3 2026.11.20 447
获取Skill文件查看使用说明
作 者:许言 许可证: 更新时间:2026.11.20
本文目录展开

CRITICAL RULES - READ BEFORE PROCESSING ANY EMAIL

  1. NEVER CALL gog DIRECTLY - ALWAYS use wrapper scripts (create_event.sh, email_read.sh, etc.). Direct gog calls bypass tracking and cause duplicates. THIS IS NON-NEGOTIABLE.
  2. IGNORE CALENDAR NOTIFICATIONS - DO NOT process emails from calendar-notification@google.com (Accepted:, Declined:, Tentative:, etc.). These are responses to existing invites, NOT new events. Run process_calendar_replies.sh to archive them.
  3. ALWAYS ASK BEFORE CREATING - Never create calendar events without explicit user confirmation in the current conversation
  4. CHECK IF ALREADY PROCESSED - Before processing any email, check processed_emails in index.json
  5. READ CONFIG FIRST - Load and apply ignore_patterns and auto_create_patterns before presenting events
  6. READ MEMORY.MD - Check for user preferences stored from previous sessions
  7. INCLUDE ALL CONFIGURED ATTENDEES - When creating/updating/deleting events, always include attendees from config with --attendees flag (and --send-updates all if supported)
  8. CHECK TRACKED EVENTS FIRST - Use lookup_event.sh --email-id to find existing events before calendar search (faster, more reliable)
  9. TRACK ALL CREATED EVENTS - The create_event.sh script automatically tracks events; use tracked IDs for updates/deletions
  10. SHOW DAY-OF-WEEK - Always include the day of week when presenting events for user verification

⛔ FORBIDDEN: DO NOT USE gog COMMANDS DIRECTLY ⛔

WRONG: gog calendar create ... or gog gmail ... RIGHT: "$SCRIPTS_DIR/create_event.sh" ... or "$SCRIPTS_DIR/email_read.sh" ...

Direct CLI calls bypass event tracking, break duplicate detection, and cause duplicate events. ALL operations MUST go through the wrapper scripts in scripts/.

Email to Calendar Skill

Extract calendar events and action items from emails, present them for review, and create/update calendar events with duplicate detection and undo support.

First-time setup: See SETUP.md for configuration options and smart onboarding.

What This Skill Accesses

For transparency, so every email and calendar action is expected and disclosed:

  • Reads Gmail — lists/searches unread mail and reads message bodies to find events.
  • Manages Google Calendar — creates and updates events; deletes events only when you undo a change.
  • Sends email — optional deadline-reminder notifications to you, only when deadline_notifications.enabled is true in config.
  • Modifies Gmail labels — marks processed mail as read and/or archives it, per the email_handling config.
  • Runs locally — shells out to the gog CLI and the bundled wrapper scripts in scripts/; never downloads or runs remote/unknown binaries.
  • Stores state locally — event tracking, pending invites, changelog, and activity logs as JSON under your data dir. No external servers, telemetry, or data sharing.

Event creation always requires explicit confirmation, and changes are undoable within 24 hours.

Reading Email Content

IMPORTANT: Before you can extract events, you must read the email body. Use the wrapper scripts.

SCRIPTS_DIR="$HOME/.openclaw/workspace/skills/email-to-calendar/scripts"

# Get a single email by ID (PREFERRED)
"$SCRIPTS_DIR/email_read.sh" --email-id "<messageId>"

# Search with body content included
"$SCRIPTS_DIR/email_search.sh" --query "in:inbox is:unread" --max 20 --include-body

Note on stale forwards: Don't use newer_than:1d because it checks the email's original date header, not when it was received. Process all UNREAD emails and rely on the "already processed" check.

Workflow

0. Pre-Processing Checks (MANDATORY)

SCRIPTS_DIR="$HOME/.openclaw/workspace/skills/email-to-calendar/scripts"
CONFIG_FILE="$HOME/.config/email-to-calendar/config.json"
INDEX_FILE="$HOME/.openclaw/workspace/memory/email-extractions/index.json"

# Start activity logging
"$SCRIPTS_DIR/activity_log.sh" start-session

# Check email mode
EMAIL_MODE=$(jq -r '.email_mode // "forwarded"' "$CONFIG_FILE")

# Check if email was already processed
EMAIL_ID="<the email message ID>"
if jq -e ".extractions[] | select(.email_id == "$EMAIL_ID")" "$INDEX_FILE" > /dev/null 2>&1; then
    "$SCRIPTS_DIR/activity_log.sh" log-skip --email-id "$EMAIL_ID" --subject "Subject" --reason "Already processed"
    exit 0
fi

# Load ignore/auto-create patterns
IGNORE_PATTERNS=$(jq -r '.event_rules.ignore_patterns[]' "$CONFIG_FILE")
AUTO_CREATE_PATTERNS=$(jq -r '.event_rules.auto_create_patterns[]' "$CONFIG_FILE")

1. Find Emails to Process

DIRECT mode: Scan all unread emails for event indicators (dates, times, meeting keywords).

FORWARDED mode: Only process emails with forwarded indicators (Fwd:, forwarded message headers).

2. Extract Events (Agent does this directly)

Read the email and extract events as structured data. Include for each event:

  • title: Descriptive name (max 80 chars)
  • date: Event date(s)
  • day_of_week: For verification
  • time: Start/end times (default: 9 AM - 5 PM)
  • is_multi_day: Whether it spans multiple days
  • is_recurring: Whether it repeats (and pattern)
  • confidence: high/medium/low
  • urls: Any URLs found in the email (REQUIRED - always look for registration links, info pages, ticketing sites, etc.)
  • deadline_date: RSVP/registration/ticket deadline date (if found)
  • deadline_action: What user needs to do (e.g., "RSVP", "get tickets", "register")
  • deadline_url: Direct link for taking action (often same as event URL)

URL Extraction Rule: ALWAYS scan the email for URLs and include the most relevant one at the BEGINNING of the event description.

2.1 Deadline Detection

Scan the email for deadline patterns that indicate action is required before the event:

Common Deadline Patterns:

  • "RSVP by [date]", "Please RSVP by [date]"
  • "Register by [date]", "Registration closes [date]"
  • "Tickets available until [date]", "Get tickets by [date]"
  • "Early bird ends [date]", "Early registration deadline [date]"
  • "Must respond by [date]", "Respond by [date]"
  • "Sign up by [date]", "Sign up deadline [date]"
  • "Deadline: [date]", "Due by [date]"
  • "Last day to [action]: [date]"

When a deadline is found:

  1. Extract the deadline date
  2. Determine the required action (RSVP, register, buy tickets, etc.)
  3. Find the URL for taking that action
  4. Flag the event for special handling (see sections below)

3. Present Items to User and WAIT

Apply event rules, then present with numbered selection:

I found the following potential events:

1. ~~ELAC Meeting (Feb 2, Monday at 8:15 AM)~~ - SKIP (matches ignore pattern)
2. **Team Offsite (Feb 2-6, Sun-Thu)** - PENDING
3. **Staff Development Day (Feb 12, Wednesday)** - AUTO-CREATE

Reply with numbers to create (e.g., '2, 3'), 'all', or 'none'.

STOP AND WAIT for user response.

After presenting, record pending invites for follow-up reminders:

# Record pending invites using add_pending.sh
"$SCRIPTS_DIR/add_pending.sh" 
    --email-id "$EMAIL_ID" 
    --email-subject "$EMAIL_SUBJECT" 
    --events-json '[{"title":"Event Name","date":"2026-02-15","time":"14:00","status":"pending"}]'

4. Check for Duplicates (MANDATORY)

ALWAYS check before creating any event:

# Step 1: Check local tracking first (fast)
TRACKED=$("$SCRIPTS_DIR/lookup_event.sh" --email-id "$EMAIL_ID")
if [ "$(echo "$TRACKED" | jq 'length')" -gt 0 ]; then
    EXISTING_EVENT_ID=$(echo "$TRACKED" | jq -r '.[0].event_id')
fi

# Step 2: If not found, try summary match
if [ -z "$EXISTING_EVENT_ID" ]; then
    TRACKED=$("$SCRIPTS_DIR/lookup_event.sh" --summary "$EVENT_TITLE")
fi

# Step 3: Fall back to calendar search using wrapper script
if [ -z "$EXISTING_EVENT_ID" ]; then
    "$SCRIPTS_DIR/calendar_search.sh" --calendar-id "$CALENDAR_ID" --from "${EVENT_DATE}T00:00:00" --to "${EVENT_DATE}T23:59:59"
fi

Use LLM semantic matching for fuzzy duplicates (e.g., "Team Offsite" vs "Team Offsite 5-6pm").

5. Create or Update Calendar Events

Use create_event.sh (recommended) - handles date parsing, tracking, and changelog:

# Create new event
"$SCRIPTS_DIR/create_event.sh" 
    "$CALENDAR_ID" 
    "Event Title" 
    "February 11, 2026" 
    "9:00 AM" 
    "5:00 PM" 
    "Description" 
    "$ATTENDEE_EMAILS" 
    "" 
    "$EMAIL_ID"

# Update existing event (pass event_id as 8th parameter)
"$SCRIPTS_DIR/create_event.sh" 
    "$CALENDAR_ID" 
    "Updated Title" 
    "February 11, 2026" 
    "10:00 AM" 
    "6:00 PM" 
    "Updated description" 
    "$ATTENDEE_EMAILS" 
    "$EXISTING_EVENT_ID" 
    "$EMAIL_ID"

For direct gog commands and advanced options, see references/gog-commands.md.

6. Email Disposition (Automatic)

Email disposition (mark as read and/or archive) is handled automatically by create_event.sh based on config settings. No manual step needed - emails are dispositioned after event creation.

To manually disposition an email:

"$SCRIPTS_DIR/disposition_email.sh" --email-id "$EMAIL_ID"

To process calendar reply emails (accepts, declines, tentatives):

"$SCRIPTS_DIR/process_calendar_replies.sh"           # Process all
"$SCRIPTS_DIR/process_calendar_replies.sh" --dry-run # Preview only
# End activity session
"$SCRIPTS_DIR/activity_log.sh" end-session

Event Creation Rules

Date/Time Handling

  • Single-day events: Default 9:00 AM - 5:00 PM
  • Multi-day events (e.g., Feb 2-6): Use --rrule "RRULE:FREQ=DAILY;COUNT=N"
  • Events with specific times: Use exact time from email

Event Descriptions

Format event descriptions in this order:

  1. ACTION WARNING (if deadline exists):

    *** ACTION REQUIRED: [ACTION] BY [DATE] ***
    
  2. Event Link (if URL found):

    Event Link: [URL]
    
  3. Event Details: Information extracted from the email

Example WITH deadline:

*** ACTION REQUIRED: GET TICKETS BY FEB 15 ***

Event Link: https://example.com/tickets

Spring Concert at Downtown Theater
Doors open at 7 PM
VIP meet & greet available

Example WITHOUT deadline:

Event Link: https://example.com/event

Spring Concert at Downtown Theater
Doors open at 7 PM

Duplicate Detection

Consider it a duplicate if:

  • Same date AND similar title (semantic matching) AND overlapping time

Always update existing events rather than creating duplicates.

Creating Deadline Events

When an event has a deadline (RSVP, registration, ticket purchase, etc.), create TWO calendar events:

1. Main Event (as normal, but with warning in description):

"$SCRIPTS_DIR/create_event.sh" 
    "$CALENDAR_ID" 
    "Spring Concert" 
    "March 1, 2026" 
    "7:00 PM" 
    "10:00 PM" 
    "*** ACTION REQUIRED: GET TICKETS BY FEB 15 ***

Event Link: https://example.com/tickets

Spring Concert at Downtown Theater
Doors open at 7 PM" 
    "$ATTENDEE_EMAILS" 
    "" 
    "$EMAIL_ID"

2. Deadline Reminder Event (separate event on the deadline date):

# Use create_event.sh for deadline reminders too (ensures tracking)
"$SCRIPTS_DIR/create_event.sh" 
    "$CALENDAR_ID" 
    "DEADLINE: Get tickets for Spring Concert" 
    "2026-02-15" 
    "09:00" 
    "09:30" 
    "Action required: Get tickets

Event Link: https://example.com/tickets

Main event: Spring Concert on March 1, 2026" 
    "" 
    "" 
    "$EMAIL_ID"

Deadline Event Properties:

  • Title format: DEADLINE: [Action] for [Event Name]
  • Date: The deadline date
  • Time: 9:00 AM (30 minute duration)
  • Reminders: Email 1 day before + popup 1 hour before
  • Description: Action required, URL, reference to main event

Email Notifications for Deadlines

When creating events with deadlines, send a notification email to alert the user:

# Load config
CONFIG_FILE="$HOME/.config/email-to-calendar/config.json"
USER_EMAIL=$(jq -r '.deadline_notifications.email_recipient // .gmail_account' "$CONFIG_FILE")
NOTIFICATIONS_ENABLED=$(jq -r '.deadline_notifications.enabled // false' "$CONFIG_FILE")

# Send notification if enabled (using wrapper script)
if [ "$NOTIFICATIONS_ENABLED" = "true" ]; then
    "$SCRIPTS_DIR/email_send.sh" 
        --to "$USER_EMAIL" 
        --subject "ACTION REQUIRED: Get tickets for Spring Concert by Feb 15" 
        --body "A calendar event has been created that requires your action.

Event: Spring Concert
Date: March 1, 2026
Deadline: February 15, 2026
Action Required: Get tickets

Link: https://example.com/tickets

Calendar events created:
- Main event: Spring Concert (March 1)
- Deadline reminder: DEADLINE: Get tickets for Spring Concert (Feb 15)

---
This notification was sent by the email-to-calendar skill."
fi

When to send notifications:

  • Only when deadline_notifications.enabled is true in config
  • Only for events that have action-required deadlines
  • Include the deadline date, action, URL, and event details

Activity Log

# Start session
"$SCRIPTS_DIR/activity_log.sh" start-session

# Log skipped emails
"$SCRIPTS_DIR/activity_log.sh" log-skip --email-id "abc" --subject "Newsletter" --reason "No events"

# Log events
"$SCRIPTS_DIR/activity_log.sh" log-event --email-id "def" --title "Meeting" --action created

# End session
"$SCRIPTS_DIR/activity_log.sh" end-session

# Show recent activity
"$SCRIPTS_DIR/activity_log.sh" show --last 3

Changelog and Undo

Changes can be undone within 24 hours:

# List recent changes
"$SCRIPTS_DIR/changelog.sh" list --last 10

# List undoable changes
"$SCRIPTS_DIR/undo.sh" list

# Undo most recent change
"$SCRIPTS_DIR/undo.sh" last

# Undo specific change
"$SCRIPTS_DIR/undo.sh" --change-id "chg_20260202_143000_001"

Pending Invites

Events not immediately actioned are tracked for reminders:

# Add pending invites (after presenting events to user)
"$SCRIPTS_DIR/add_pending.sh" 
    --email-id "$EMAIL_ID" 
    --email-subject "Party Invite" 
    --events-json '[{"title":"Birthday Party","date":"2026-02-15","time":"14:00","status":"pending"}]'

# List pending invites (JSON)
"$SCRIPTS_DIR/list_pending.sh"

# Human-readable summary
"$SCRIPTS_DIR/list_pending.sh" --summary

# Update reminder tracking
"$SCRIPTS_DIR/list_pending.sh" --summary --update-reminded

# Auto-dismiss after 3 ignored reminders
"$SCRIPTS_DIR/list_pending.sh" --summary --auto-dismiss

Event Tracking

# Look up by email ID
"$SCRIPTS_DIR/lookup_event.sh" --email-id "19c1c86dcc389443"

# Look up by summary
"$SCRIPTS_DIR/lookup_event.sh" --summary "Staff Development"

# List all tracked events
"$SCRIPTS_DIR/lookup_event.sh" --list

# Validate events exist (removes orphans)
"$SCRIPTS_DIR/lookup_event.sh" --email-id "abc" --validate

File Locations

File Purpose
~/.config/email-to-calendar/config.json User configuration
~/.openclaw/workspace/memory/email-extractions/ Extracted data
~/.openclaw/workspace/memory/email-extractions/index.json Processing index
~/.openclaw/workspace/memory/email-to-calendar/events.json Event tracking
~/.openclaw/workspace/memory/email-to-calendar/pending_invites.json Pending invites
~/.openclaw/workspace/memory/email-to-calendar/activity.json Activity log
~/.openclaw/workspace/memory/email-to-calendar/changelog.json Change history
~/.openclaw/workspace/skills/email-to-calendar/scripts/ Utility scripts
~/.openclaw/workspace/skills/email-to-calendar/MEMORY.md User preferences

References

  • Setup Guide: SETUP.md - Configuration and onboarding
  • CLI Reference: references/gog-commands.md - Detailed gog CLI usage
  • Extraction Patterns: references/extraction-patterns.md - Date/time parsing
  • Workflow Example: references/workflow-example.md - Complete example

Notes

Date Parsing

Handles common formats:

  • January 15, 2026, Wednesday January 15
  • 01/15/2026, 15/01/2026
  • Date ranges like "Feb 2-6"

Time Zones

All times assumed local timezone. Time zone info preserved in descriptions.

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,036
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,020
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,019
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,016
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,014
Skill 文件
  • SKILL.md
    • Email to Calendar Skill
    • What This Skill Accesses
    • Reading Email Content
    • Workflow
      • 0. Pre-Processing Checks (MANDATORY)
      • 1. Find Emails to Process
      • 2. Extract Events (Agent does this directly)
      • 2.1 Deadline Detection
      • 3. Present Items to User and WAIT
      • 4. Check for Duplicates (MANDATORY)
      • 5. Create or Update Calendar Events
      • 6. Email Disposition (Automatic)
    • Event Creation Rules
      • Date/Time Handling
      • Event Descriptions
      • Duplicate Detection
      • Creating Deadline Events
      • Email Notifications for Deadlines
    • Activity Log
    • Changelog and Undo
    • Pending Invites
    • Event Tracking
    • File Locations
    • References
    • Notes
      • Date Parsing
      • Time Zones
  • 项目或源文件

相关 Skill

更多
Email to Calendar Extraction Engine Email to Calendar Extraction Engine 从邮件提取日程、截止日期、待办和跟进事项。支持任意日历服务(Google、Outlook、Apple、Notion等)。无外部依赖,纯智能处理。适用于转发邮件、检查收件箱日程或从文本提取结构化安排数据。
service-qa-coach service-qa-coach Review support quality for chat, email, phone, social DM, or marketplace service teams. Use when a team needs a QA scorecard, failure-mode analysis, coaching plan, calibration checklist, or service-improvement brief without live ticketing, CRM, or contact-center system access.
高中数学作业批改助手 高中数学作业批改助手 >图片识别 直接读取学生手写作答照片,识别公式、符号、步骤 🧮 自动推导 根据题目自动生成参考答案和评分细则,无需教师预设 📊 逐步给分 每个关键步骤独立评分,体现过程分 📝 结构化报告 输出含识别内容、参考答案、逐步评分、改进建议的完整报告 🗂 批量批改 支持一次性批改多道题,最终汇总得分表
Vibration Analysis Vibration Analysis 分析来自CMS趋势、RMS/峰值、频谱及SCADA报警的风机传动链(主轴、齿轮箱、发电机)振动数据。
Traditional Bone Tool Making Basics Traditional Bone Tool Making Basics Use when you need custom, durable, repairable tools like awls, needles, scrapers, harpoons, or fishing hooks made from local animal bones or antlers and comm...