🎫 Convert Outlook emails to Planner tasks and monitor Secure Score with Teams alerts in M365

⚡ 375 views · 🎫 Ticket Management & Triage

Description

Keep your IT operations moving, every action email becomes a tracked task, and every security alert lands where it belongs, automatically.

Every IT team deals with the same two problems: important emails that should become tasks but don’t, and security posture scores that nobody checks until something breaks. This workflow solves both automatically. It scans your Outlook inbox every 30 minutes for actionable emails and converts them into Microsoft Planner tasks, while a separate Monday morning pipeline monitors your Microsoft Secure Score and creates a priority-1 alert task if you drop below 80%.


How it works

The workflow runs two independent pipelines on a single Microsoft Graph OAuth2 credential:

Pipeline 1: Email-to-Task Parser (every 30 minutes)

  1. Email Ingestion: Polls Outlook for unread emails every 30 minutes. Exits cleanly if the inbox is empty. Splits emails into a sequential batch loop for one-at-a-time processing.
  2. Keyword Extraction & Date Parsing: Strips HTML from the email body and scans subject and body for configurable action keywords (URGENT, ACTION REQUIRED, TASK:, PLEASE REVIEW, CRITICAL). Extracts due dates from ISO format (2025-06-30), structured prefixes (due: 30.6.2025), or relative phrases (today, tomorrow, end of week, Friday).
  3. Task Creation Chain: Creates a Planner task via Graph API with the correct priority and due date, attaches the sender details and a 500-character body preview as the task description, posts a Teams notification, sends an auto-reply to the sender, and marks the email as read. Every node runs with Continue on Fail so a single API error does not crash the batch.
  4. Poison Pill Guard & Rate Limit: Checks upstream nodes for silent failures before continuing. Waits 2 seconds between emails to respect Graph API rate limits, then loops back for the next email.

Pipeline 2: Security Score Monitor (every Monday at 08:00)

  1. Score Fetch & Calculation: Fetches the latest Microsoft Secure Score from the Graph Security API and calculates it as a percentage of the maximum achievable score.
  2. Alert Routing & Deduplication: If below 80%, checks whether an open alert task already exists in Planner to avoid duplicate accumulation across weekly runs. Creates a new task or updates the existing one with the latest score.
  3. Security Task & Teams Alert: Creates or updates a priority-1 Planner task with a 24-hour due date and a Defender portal reference. Posts a Teams alert with current score, maximum score, and scan date. If the score is healthy, posts a green summary instead.

Key benefits


Setup

  1. Credentials: Connect your Microsoft Graph OAuth2 credential to all nodes (covers Outlook, Planner, and Teams)
  2. Workflow variables: Set the following in the n8n Variables panel:
    • PLANNER_PLAN_ID
    • PLANNER_BUCKET_ID
    • TASK_ASSIGNEE_USER_ID
    • TEAMS_TEAM_ID
    • TEAMS_CHANNEL_ID
    • MONITORED_MAILBOX (UPN of the Outlook mailbox to scan)
    • ACTION_KEYWORDS (comma-separated, defaults to: ACTION REQUIRED,URGENT,TASK:,PLEASE REVIEW,CRITICAL)
  3. Error alert: Update the recipient address in the Send Error Notification Email node (it-admin@company.fi)
  4. Timezone: Set the REPORT_TIMEZONE environment variable if your team is not in Europe/Helsinki (defaults to Europe/Helsinki)
  5. Graph API permissions: Ensure your registered Azure App has Mail.ReadWrite, Tasks.ReadWrite, ChannelMessage.Send, and SecurityEvents.Read.All
  6. Activate: Turn the workflow on Pipeline 1 starts on the next 30-minute interval, Pipeline 2 fires the following Monday at 08:00

Who this is for


Required credentials

Required Graph API permissions

Mail.ReadWrite Tasks.ReadWrite ChannelMessage.Send SecurityEvents.Read.All


How to customize it

đź”— Nodes Used

HTTP Request, Microsoft Teams, Microsoft Outlook, Schedule Trigger

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup