Outlook - New Email
Triggers when a new email arrives in a Microsoft Outlook mailbox.
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
- 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_intervalseconds (default 60) have passed since its last start, with the input{ $scheduled: true }plus the stored$trigger_state. - Resolves the node config, requires
connection_idandmailbox_email, gets a Graph token and always targets/users/<mailbox_email>. - If the incoming item has
resource(a Graph change notification), it fetches that message and returns it onout. - Scheduled run: one query for messages of
folderreceived from$trigger_state.lastTimeCheckedup to now, oldest first, at most 50. Manual run: the same query everypolling_intervalseconds from the moment the run started, refreshing the token each cycle, until a message arrives or 30 minutes pass. - 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.
- Chooses
emptywhen no message arrived,heavy_attachmentswhen exactly one arrived and itsattachmentCountis at leastattachment_threshold, andoutotherwise. It returnsmeta.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
}
}{
"ok": true,
"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
},
"port": "out",
"meta": {
"trigger_state": {
"lastTimeChecked": "2026-11-26T14:03:00.120Z"
}
}
}Configuration
-
connection_idstring 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_emailstring Required Accepts expressions -
Email address of the mailbox to monitor for new emails.
-
folderstring Optional -
The mail folder to watch for new messages.
-
polling_intervalnumber Optional -
How often to check for new emails. Minimum 60 seconds.
-
attachment_thresholdnumber 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.
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.
{
"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.
{
"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.
{
"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 }).
{
"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.
| Expression | Editor | Worker |
|---|---|---|
$("Outlook - New Email").item.json.idThe message ID. Use this for reply/forward/delete operations. | ||
$("Outlook - New Email").item.json.subject | ||
$("Outlook - New Email").item.json.fromSender email address. | ||
$("Outlook - New Email").item.json.toRecipient email addresses. | ||
$("Outlook - New Email").item.json.receivedDateTime | ||
$("Outlook - New Email").item.json.bodyEmail body content. | ||
$("Outlook - New Email").item.json.bodyPreview | ||
$("Outlook - New Email").item.json.isRead | ||
$("Outlook - New Email").item.json.hasAttachments | ||
$("Outlook - New Email").item.json.attachmentCountNumber of attachments. | ||
$("Outlook - New Email").item.json.importance | ||
$("Outlook - New Email").item.json.messages | — | |
$("Outlook - New Email").item.json.count | — | |
$("Outlook - New Email").item.json.hasNewEmails | — | |
$("Outlook - New Email").item.json.lastTimeChecked | — | |
$("Outlook - New Email").item.json.previousCheckAt | — | |
$("Outlook - New Email").item.json.cc | — | |
$("Outlook - New Email").item.json.bodyContentType | — | |
$("Outlook - New Email").item.json.conversationId | — | |
$("Outlook - New Email").item.json.internetMessageId | — |
— 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
-
idstring Optional -
The message ID. Use this for reply/forward/delete operations.
-
subjectstring Optional -
fromstring Optional -
Sender email address.
-
toarray Optional -
Recipient email addresses.
-
receivedDateTimestring Optional -
bodystring Optional -
Email body content.
-
bodyPreviewstring Optional -
isReadboolean Optional -
hasAttachmentsboolean Optional -
attachmentCountnumber Optional -
Number of attachments.
-
importancestring 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
}
}
}{
"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"
]
}{
"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"
}
}
}[
{
"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
- 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
lastTimeCheckedthen moves to now, so messages beyond the first 50 in one interval are not picked up. When several messages arrive, processmessages(for example withflow.split). - The mailbox is addressed as
/users/<mailbox_email>, so the credential needs application permissionMail.Read(client credentials). The full messagebodyis included in the output.
Reviewed against the orchestrator code · 31e874b · 2026-11-26