Files
monoadmin 65a75ef45c Upload files to "email-to-ai-task"
I've created a comprehensive README for your Email to Vikunja workflow. It covers the entire workflow from email monitoring through task creation and notification, including all the key transformations and integrations involved. The README explains what each node does, how they connect, what credentials you'll need, and how to configure it for your specific setup.
2026-01-08 01:04:19 -08:00

4.5 KiB

Email to AI Task (Vikunja)

An automated workflow that converts emails into structured tasks in Vikunja using AI-powered extraction.

Overview

This n8n workflow monitors an email inbox, automatically extracts task information from incoming emails using an AI model, and creates tasks in Vikunja. It provides intelligent parsing of task details like titles, summaries, priorities, and due dates, with Slack notifications upon task creation.

Workflow Steps

1. Email Trigger (IMAP)

Monitors an IMAP email account for new messages. Downloads attachments and tracks the last read message to avoid processing duplicates.

Configuration:

  • Uses stored IMAP credentials
  • Auto-download of attachments enabled
  • Message tracking enabled

2. Build AI Prompt

Constructs a prompt from the email subject and body to send to the AI model.

Input Fields:

  • subject: Email subject line
  • textPlain: Plain text body of the email

Output: A formatted prompt instructing the AI to extract task information as JSON.

3. HTTP Request (AI Generation)

Sends the constructed prompt to a local Ollama AI model endpoint for task extraction.

Endpoint: http://api.chat.pathcore.org/api/generate Model: Mistral Method: POST

The AI returns structured data with the following fields:

  • title: Task title
  • summary: Task description
  • priority: Priority level (1-5)
  • due_date: When the task is due
  • labels: Associated labels/tags

4. Code in JavaScript

Post-processes the AI response to ensure data validity and format compliance.

Transformations:

  • Extracts JSON from the AI response using regex
  • Converts natural language due dates to ISO 8601 format:
    • "end of month" → last day of current month
    • "end of week" → Friday of current week
    • "today" → current date
    • "tomorrow" → next day
    • "next week" → 7 days from now
    • Parses explicit dates to ISO format
  • If no due date is provided, defaults to tomorrow
  • Ensures labels is always an array
  • Handles AI errors with a "Manual review required" task

Output Format:

{
  "title": "string",
  "description": "string",
  "priority": 1-5,
  "due_date": "ISO8601 datetime or null",
  "labels": ["string"]
}

5. HTTP Request (Vikunja API)

Creates the task in Vikunja using the extracted and formatted data.

Endpoint: https://tasks.pathcore.org/api/v1/projects/1/tasks Method: PUT Authentication: HTTP Header Auth (Vikunja API credentials) Project ID: 1

6. Slack Notification

Sends a message to the vijunka-tasks Slack channel with details about the newly created task.

Information Included:

  • Task ID and identifier
  • Title and description
  • Priority and completion status
  • Due date and timeline
  • Assignees and labels
  • Created/updated timestamps

Requirements

External Services

  • Email Account: IMAP-compatible email service
  • AI Model: Ollama or compatible API with Mistral model at http://api.chat.pathcore.org/api/generate
  • Vikunja: Task management system at https://tasks.pathcore.org
  • Slack: For notifications (optional)

Credentials

  • IMAP account credentials
  • Vikunja API authentication (HTTP header auth)
  • Slack OAuth2 token (for notifications)

Configuration

Email Setup

Configure the IMAP credentials in the "Email Trigger (IMAP)" node with your email provider's IMAP settings.

Vikunja Project

Update the project_id in both the "Build AI Prompt" and "HTTP Request1" nodes if using a different project (currently set to project 1).

Slack Channel

The notification message is sent to the vijunka-tasks channel. Change the channelId in the "Send a message" node to use a different channel.

AI Model

If using a different AI endpoint or model, update the URL and model name in the "HTTP Request" node.

Usage

Once activated and configured, the workflow automatically processes incoming emails:

  1. New email arrives in the monitored inbox
  2. AI extracts task details from the email content
  3. Task is created in Vikunja with extracted information
  4. Slack notification is sent with task details

Error Handling

If the AI response cannot be parsed as JSON, the workflow creates a task titled "Manual review required" with the full AI response as the description, flagged with the "ai-error" label for manual review.

Workflow Status

  • Active: Yes
  • Execution Order: v1

Notes

This workflow is particularly useful for converting action items from email conversations into structured, trackable tasks in your Vikunja instance.