On this page
Sommatic Docs
Open portal

Outlook - New Email

Triggers when a new email arrives in a Microsoft Outlook mailbox.

View as Markdown
Open in
Connectors Available connectors.microsoft.outlook.trigger Version 1.0.0 Execution: async

Starts a workflow with the new messages of one Outlook mailbox folder. On a schedule it checks once per polling interval since the last check; in a manual run it waits until mail arrives (up to 30 minutes).

Listens for incoming emails via Microsoft Graph API subscriptions. When a new email is received, the workflow is triggered with the full email data (id, subject, from, body, attachments info).

How it works:

  • When the workflow starts, a Graph API subscription is created for the configured mailbox.
  • Microsoft notifies Sommatic AI when a new email arrives.
  • The trigger fetches the full email and passes it to the next node.

Use Cases:

  • Auto-reply to incoming support emails.
  • Process email attachments (OCR, classification).
  • Route emails to different workflows based on sender or subject.

How it works

  1. What starts it: the backend scheduler checks every 10 seconds the active workflows that have a published version and contain this node, and starts the published version when polling_interval seconds (default 60) have passed since its last start, with the input { $scheduled: true } plus the stored $trigger_state.
  2. Resolves the node config, requires connection_id and mailbox_email, gets a Graph token and always targets /users/<mailbox_email>.
  3. If the incoming item has resource (a Graph change notification), it fetches that message and returns it on out.
  4. Scheduled run: one query for messages of folder received from $trigger_state.lastTimeChecked up to now, oldest first, at most 50. Manual run: the same query every polling_interval seconds from the moment the run started, refreshing the token each cycle, until a message arrives or 30 minutes pass.
  5. Counts the attachments (up to 100) of each message that has them, and when exactly one message arrived it copies that message's fields to the root of the output.
  6. Chooses empty when no message arrived, heavy_attachments when exactly one arrived and its attachmentCount is at least attachment_threshold, and out otherwise. It returns meta.trigger_state.lastTimeChecked, which the backend merges into the workflow's stored trigger state after the run.

In a workflow

The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.

{
  "node_id": "node-support-inbox",
  "label": "Support inbox",
  "operator_slug": "connectors.microsoft.outlook.trigger",
  "operator_version": "1.0.0",
  "config": {
    "connection_id": "pi-credential-xxxx",
    "mailbox_email": "[email protected]",
    "folder": "inbox",
    "polling_interval": 60,
    "attachment_threshold": 5
  }
}

Configuration

connection_id string Required

Credential for Microsoft Graph API access. Accepts credentials of type `oauth2` (access + refresh token), `service-account` (tenant id + client id + client secret), or `object` (advanced Graph config).

mailbox_email string Required Accepts expressions

Email address of the mailbox to monitor for new emails.

folder string Optional

The mail folder to watch for new messages.

Default: inbox

Allowed values: inboxsentitemsdraftsdeleteditemsjunkemailarchive

polling_interval number Optional

How often to check for new emails. Minimum 60 seconds.

Default: 60

attachment_threshold number Optional

Number of attachments at or above which the email routes to the heavy_attachments port. Useful for routing to a dedicated attachment processing node.

Default: 5

Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.

Behaviour in the code

What the implementation does with these keys beyond what the schema says.

polling_interval
The 60-second minimum is not enforced. The scheduler reads it from the workflow draft, and in manual runs it is the wait between checks.
attachment_threshold
Only evaluated when exactly one message arrived; with several messages the port is always out.
folder
A Graph well-known folder name, used as is in the request path.

Output ports

out default

New messages arrived (and not the heavy single-message case). The root fields of the email are present only when exactly one message arrived.

Data
{
  "messages": [
    {
      "id": "AAMkAGI2TG93AAA=",
      "subject": "Order 123 question",
      "from": "[email protected]",
      "to": [
        "[email protected]"
      ],
      "cc": [],
      "receivedDateTime": "2026-11-26T14:02:51Z",
      "body": "<html><body><p>Hello, where is my order?</p></body></html>",
      "bodyContentType": "html",
      "bodyPreview": "Hello, where is my order?",
      "isRead": false,
      "hasAttachments": true,
      "importance": "normal",
      "conversationId": "AAQkAGI2TG93CCC=",
      "internetMessageId": "<[email protected]>",
      "attachmentCount": 1
    }
  ],
  "count": 1,
  "hasNewEmails": true,
  "lastTimeChecked": "2026-11-26T14:03:00.120Z",
  "previousCheckAt": "2026-11-26T14:02:00.004Z",
  "id": "AAMkAGI2TG93AAA=",
  "subject": "Order 123 question",
  "from": "[email protected]",
  "to": [
    "[email protected]"
  ],
  "cc": [],
  "receivedDateTime": "2026-11-26T14:02:51Z",
  "body": "<html><body><p>Hello, where is my order?</p></body></html>",
  "bodyContentType": "html",
  "bodyPreview": "Hello, where is my order?",
  "isRead": false,
  "hasAttachments": true,
  "importance": "normal",
  "conversationId": "AAQkAGI2TG93CCC=",
  "internetMessageId": "<[email protected]>",
  "attachmentCount": 1
}
heavy_attachments

Exactly one message arrived and it has attachment_threshold attachments or more. The output has the same shape as out.

Data
{
  "messages": [
    {
      "id": "AAMkAGI2TG94AAA=",
      "subject": "Scanned documents",
      "from": "[email protected]",
      "to": [
        "[email protected]"
      ],
      "cc": [],
      "receivedDateTime": "2026-11-26T14:03:40Z",
      "body": "<html><body><p>Attached.</p></body></html>",
      "bodyContentType": "html",
      "bodyPreview": "Attached.",
      "isRead": false,
      "hasAttachments": true,
      "importance": "normal",
      "conversationId": "AAQkAGI2TG94CCC=",
      "internetMessageId": "<[email protected]>",
      "attachmentCount": 7
    }
  ],
  "count": 1,
  "hasNewEmails": true,
  "lastTimeChecked": "2026-11-26T14:04:00.087Z",
  "previousCheckAt": "2026-11-26T14:03:00.120Z",
  "id": "AAMkAGI2TG94AAA=",
  "subject": "Scanned documents",
  "from": "[email protected]",
  "to": [
    "[email protected]"
  ],
  "cc": [],
  "receivedDateTime": "2026-11-26T14:03:40Z",
  "body": "<html><body><p>Attached.</p></body></html>",
  "bodyContentType": "html",
  "bodyPreview": "Attached.",
  "isRead": false,
  "hasAttachments": true,
  "importance": "normal",
  "conversationId": "AAQkAGI2TG94CCC=",
  "internetMessageId": "<[email protected]>",
  "attachmentCount": 7
}
empty

No new message in this check. When a manual run waits 30 minutes without mail, the output also has timedOut: true and polledForMs.

Data
{
  "messages": [],
  "count": 0,
  "hasNewEmails": false,
  "lastTimeChecked": "2026-11-26T14:05:00.031Z",
  "previousCheckAt": "2026-11-26T14:04:00.087Z"
}
error

A validation failed (the output is the envelope { ok, errors, port }) or the Graph query failed (the output is { error }).

Data
{
  "error": "Request failed with status code 403"
}

In expressions

What a later node can read from this node's output with $("Outlook - New Email").item.json.<path> (write your node's label instead of Outlook - New Email). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through out, from the output shown in Ports.

ExpressionEditorWorker
$("Outlook - New Email").item.json.idstring= "AAMkAGI2TG93AAA="The message ID. Use this for reply/forward/delete operations.
$("Outlook - New Email").item.json.subjectstring= "Order 123 question"
$("Outlook - New Email").item.json.fromstring= "[email protected]"Sender email address.
$("Outlook - New Email").item.json.toarray= […] (1)Recipient email addresses.
$("Outlook - New Email").item.json.receivedDateTimestring= "2026-11-26T14:02:51Z"
$("Outlook - New Email").item.json.bodystring= "<html><body><p>Hello, where is my order?</p>…"Email body content.
$("Outlook - New Email").item.json.bodyPreviewstring= "Hello, where is my order?"
$("Outlook - New Email").item.json.isReadboolean= false
$("Outlook - New Email").item.json.hasAttachmentsboolean= true
$("Outlook - New Email").item.json.attachmentCountnumber= 1Number of attachments.
$("Outlook - New Email").item.json.importancestring= "normal"
$("Outlook - New Email").item.json.messagesarrayNot suggested by the editor= […] (1)—
$("Outlook - New Email").item.json.countnumberNot suggested by the editor= 1—
$("Outlook - New Email").item.json.hasNewEmailsbooleanNot suggested by the editor= true—
$("Outlook - New Email").item.json.lastTimeCheckedstringNot suggested by the editor= "2026-11-26T14:03:00.120Z"—
$("Outlook - New Email").item.json.previousCheckAtstringNot suggested by the editor= "2026-11-26T14:02:00.004Z"—
$("Outlook - New Email").item.json.ccarrayNot suggested by the editor= […] (0)—
$("Outlook - New Email").item.json.bodyContentTypestringNot suggested by the editor= "html"—
$("Outlook - New Email").item.json.conversationIdstringNot suggested by the editor= "AAQkAGI2TG93CCC="—
$("Outlook - New Email").item.json.internetMessageIdstringNot suggested by the editor= "<[email protected]>"—

— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).

Errors

Message Port Cause and fix
Microsoft 365 credential is required error connection_id is empty. Mailbox email is required is the same check for mailbox_email.
Failed to resolve Microsoft 365 access token error The credential could not be resolved or the token request failed.
Poll failed: <message> error The message query failed, for example 403 when the app lacks Mail.Read on the mailbox or 404 for an unknown mailbox.
Failed to fetch email from resource: <message> error The message referenced by a change notification could not be read.

Output contract

id string Optional

The message ID. Use this for reply/forward/delete operations.

subject string Optional
from string Optional

Sender email address.

to array Optional

Recipient email addresses.

receivedDateTime string Optional
body string Optional

Email body content.

bodyPreview string Optional
isRead boolean Optional
hasAttachments boolean Optional
attachmentCount number Optional

Number of attachments.

importance string Optional

Contracts (JSON Schema)

The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.

{
  "slug": "connectors.microsoft.outlook.trigger",
  "name": "Outlook - New Email",
  "category": "integrations",
  "version": "1.0.0",
  "description": "Triggers when a new email arrives in a Microsoft Outlook mailbox.\n\n  Listens for incoming emails via Microsoft Graph API subscriptions. When a new email is received, the workflow is triggered with the full email data (id, subject, from, body, attachments info).\n\n  **How it works:**\n  - When the workflow starts, a Graph API subscription is created for the configured mailbox.\n  - Microsoft notifies Sommatic AI when a new email arrives.\n  - The trigger fetches the full email and passes it to the next node.\n\n  **Use Cases:**\n  - Auto-reply to incoming support emails.\n  - Process email attachments (OCR, classification).\n  - Route emails to different workflows based on sender or subject.",
  "capabilities": [
    "email",
    "microsoft",
    "outlook",
    "trigger",
    "webhook"
  ],
  "group": [
    {
      "key": "microsoft",
      "name": "Microsoft",
      "icon_url": "/icons/integrations/microsoft/microsoft.svg"
    },
    {
      "key": "microsoft365",
      "name": "Microsoft 365",
      "icon_url": "/icons/integrations/microsoft/microsoft365.svg"
    }
  ],
  "icon_url": "/icons/integrations/microsoft/outlook.svg",
  "config_schema": {
    "type": "object",
    "properties": {
      "connection_id": {
        "type": "string",
        "title": "Microsoft 365 Credential",
        "description": "Credential for Microsoft Graph API access. Accepts credentials of type `oauth2` (access + refresh token), `service-account` (tenant id + client id + client secret), or `object` (advanced Graph config).",
        "ui_widget": "connection_picker",
        "ui_options": {
          "credential_types": [
            "oauth2",
            "service-account",
            "object"
          ],
          "types": [
            "outlook",
            "microsoft365",
            "oauth2"
          ]
        }
      },
      "mailbox_email": {
        "type": "string",
        "title": "Mailbox Email",
        "description": "Email address of the mailbox to monitor for new emails.",
        "format": "expression"
      },
      "folder": {
        "type": "string",
        "title": "Folder",
        "enum": [
          "inbox",
          "sentitems",
          "drafts",
          "deleteditems",
          "junkemail",
          "archive"
        ],
        "default": "inbox",
        "description": "The mail folder to watch for new messages."
      },
      "polling_interval": {
        "type": "number",
        "title": "Polling Interval (seconds)",
        "default": 60,
        "description": "How often to check for new emails. Minimum 60 seconds."
      },
      "attachment_threshold": {
        "type": "number",
        "title": "Heavy Attachments Threshold",
        "default": 5,
        "description": "Number of attachments at or above which the email routes to the heavy_attachments port. Useful for routing to a dedicated attachment processing node."
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    },
    "required": [
      "connection_id",
      "mailbox_email"
    ]
  },
  "input_contract_schema": null,
  "output_contract_schema": {
    "type": "object",
    "description": "The incoming email data from Microsoft Graph API.",
    "properties": {
      "id": {
        "type": "string",
        "description": "The message ID. Use this for reply/forward/delete operations."
      },
      "subject": {
        "type": "string"
      },
      "from": {
        "type": "string",
        "description": "Sender email address."
      },
      "to": {
        "type": "array",
        "description": "Recipient email addresses."
      },
      "receivedDateTime": {
        "type": "string",
        "format": "date-time"
      },
      "body": {
        "type": "string",
        "description": "Email body content."
      },
      "bodyPreview": {
        "type": "string"
      },
      "isRead": {
        "type": "boolean"
      },
      "hasAttachments": {
        "type": "boolean"
      },
      "attachmentCount": {
        "type": "number",
        "description": "Number of attachments."
      },
      "importance": {
        "type": "string"
      }
    }
  },
  "ports": [
    {
      "port_id": "out",
      "label": "New Email",
      "is_default": true,
      "description": "A new email was received (below attachment threshold)."
    },
    {
      "port_id": "heavy_attachments",
      "label": "Heavy Attachments",
      "description": "Email has attachments at or above the threshold. Route to a dedicated attachment processing node."
    },
    {
      "port_id": "empty",
      "label": "No New Emails",
      "description": "No new emails found in this polling cycle."
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Failed to fetch email or subscription error."
    }
  ],
  "execution_mode": "async",
  "tags": [
    "email",
    "microsoft",
    "outlook",
    "trigger",
    "incoming"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_sommatic_ai",
    "profile": {
      "name": "Sommatic AI",
      "verified": true,
      "url": "https://me.veripass.com/sommatic",
      "logo_url": null
    }
  }
}

Execution

Execution
async
Stateful
No
Retries (retryOnFail)
No
Credentials
Resolved on the server from connection_id; the secret never reaches the workflow.
Capabilities
emailmicrosoftoutlooktriggerwebhook
Tags
emailmicrosoftoutlooktriggerincoming

Notes and limits

  • Test vs production: only the published version is started by the scheduler, so a draft never polls on its own. Running the workflow manually starts the blocking polling loop instead; with sample data the engine skips this node and passes the sample input on out.
  • The first scheduled run (no stored state) checks the window from now to now, so it finds nothing; mail is picked up from the next cycle on.
  • At most 50 messages are read per check and lastTimeChecked then moves to now, so messages beyond the first 50 in one interval are not picked up. When several messages arrive, process messages (for example with flow.split).
  • The mailbox is addressed as /users/<mailbox_email>, so the credential needs application permission Mail.Read (client credentials). The full message body is included in the output.

Reviewed against the orchestrator code · 31e874b · 2026-11-26

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs