Skip to content

Playbook: Email to Calendar

Objective

Automatically extract dates and events from incoming emails and sync them to the primary family calendar.

Pre-requisites

Workflow Architecture

flowchart TD
    A[New Email in IMAP folder] --> B[n8n Workflow Trigger]
    B --> C[Convert Email to PDF]
    C --> D[Upload to Paperless-ngx]
    D --> E[Extract Text via OCR]
    E --> F[Call LLM for Date Extraction]
    F --> G{Event Found?}
    G -- Yes --> H[Create Google Calendar Event]
    G -- No --> I[Tag as Failed / Notify]
    H --> J[Update Paperless Tag: synced]
    I --> K[Update Paperless Tag: failed]

Step-by-Step Flow

  1. Ingestion: n8n workflow triggers via IMAP on a new email in the Automate/Intake folder.
  2. Storage: n8n uploads the email body (as PDF) or any existing PDF attachments to Paperless-ngx with the tag needs-processing.
  3. Extraction: n8n calls the LLM with the Date Extraction Prompt, passing the OCR text from Paperless.
  4. Verification: LLM returns a structured JSON object containing event_name, start_date, end_date, and location.
  5. Action: n8n creates an event in Google Calendar using the data returned by the LLM.
  6. Cleanup: n8n updates the Paperless document tag from needs-processing to synced-to-calendar.

Data Contract

Field Type Format Source
event_name String Plain Text Email Subject/Body
start_date DateTime ISO8601 Email Body
end_date DateTime ISO8601 Email Body
location String Plain Text Email Body

Failure Modes & Recovery

  • Extraction Failed: LLM returns "No event found".
    • Detection: n8n check for null fields.
    • Recovery: Tag document in Paperless as automation-failed and send a notification to Matrix.
  • IMAP Timeout:
    • Detection: n8n workflow execution error.
    • Recovery: Retry policy in n8n (3 retries).

Variants

  • SaaS Only: Replace n8n/Ollama with Zapier and ChatGPT.
  • Local Only: Replace Google Calendar with Radicale via CalDAV.

Contribution Metadata

  • Confidence: high
  • Last reviewed: 2026-03-01

Sources / References

  • https://github.com/joanmarcriera/Home-office-automations