Outlook - New Email
Se dispara cuando llega un correo nuevo a un buzón de Microsoft Outlook.
Inicia un workflow con los mensajes nuevos de una carpeta de un buzón de Outlook. Por programación revisa una vez por intervalo de sondeo desde la última revisión; en una ejecución manual espera hasta que llegue correo (máximo 30 minutos).
Escucha los correos entrantes mediante suscripciones de Microsoft Graph API. Cuando se recibe un correo nuevo, el workflow se dispara con todos los datos del correo (id, asunto, remitente, cuerpo, información de adjuntos).
Cómo funciona:
- Cuando se inicia el workflow, se crea una suscripción de Graph API para el buzón configurado.
- Microsoft notifica a Sommatic AI cuando llega un correo nuevo.
- El trigger obtiene el correo completo y lo pasa al siguiente nodo.
Casos de uso:
- Responder automáticamente a los correos de soporte entrantes.
- Procesar adjuntos de correo (OCR, clasificación).
- Enrutar correos a distintos workflows según el remitente o el asunto.
Cómo funciona
- Qué lo inicia: el programador del backend revisa cada 10 segundos los workflows activos que tienen una versión publicada y contienen este nodo, e inicia la versión publicada cuando pasaron
polling_intervalsegundos (por defecto 60) desde su último inicio, con la entrada{ $scheduled: true }más el$trigger_stateguardado. - Resuelve la configuración del nodo, exige
connection_idymailbox_email, obtiene un token de Graph y siempre apunta a/users/<mailbox_email>. - Si el ítem de entrada tiene
resource(una notificación de cambios de Graph), obtiene ese mensaje y lo devuelve porout. - Ejecución programada: una consulta de los mensajes de
folderrecibidos desde$trigger_state.lastTimeCheckedhasta ahora, del más antiguo al más reciente, máximo 50. Ejecución manual: la misma consulta cadapolling_intervalsegundos desde que empezó la ejecución, renovando el token en cada ciclo, hasta que llegue un mensaje o pasen 30 minutos. - Cuenta los adjuntos (hasta 100) de cada mensaje que los tenga y, cuando llegó exactamente un mensaje, copia sus campos a la raíz de la salida.
- Elige
emptysi no llegó ningún mensaje,heavy_attachmentssi llegó exactamente uno y suattachmentCountes al menosattachment_threshold, youten los demás casos. Devuelvemeta.trigger_state.lastTimeChecked, que el backend combina con el estado del disparador guardado del workflow al terminar la ejecución.
En un workflow
El nodo tal como aparece en un archivo de workflow (draft_nodes[]) y el envelope de una ejecución exitosa.
{
"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": "support@example.com",
"folder": "inbox",
"polling_interval": 60,
"attachment_threshold": 5
}
}{
"ok": true,
"data": {
"messages": [
{
"id": "AAMkAGI2TG93AAA=",
"subject": "Order 123 question",
"from": "ana@example.com",
"to": [
"support@example.com"
],
"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": "<CAF1x2y3z@mail.example.com>",
"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": "ana@example.com",
"to": [
"support@example.com"
],
"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": "<CAF1x2y3z@mail.example.com>",
"attachmentCount": 1
},
"port": "out",
"meta": {
"trigger_state": {
"lastTimeChecked": "2026-11-26T14:03:00.120Z"
}
}
}Configuración
-
connection_idstring Obligatorio -
Credencial de acceso a Microsoft Graph API. Acepta credenciales de tipo `oauth2` (token de acceso + token de actualización), `service-account` (tenant id + client id + client secret) u `object` (configuración avanzada de Graph).
-
mailbox_emailstring Obligatorio Acepta expresiones -
Dirección del buzón que se monitorea en busca de correos nuevos.
-
folderstring Opcional -
La carpeta de correo que se vigila en busca de mensajes nuevos.
-
polling_intervalnumber Opcional -
Con qué frecuencia se buscan correos nuevos. Mínimo 60 segundos.
-
attachment_thresholdnumber Opcional -
Número de adjuntos a partir del cual el correo se dirige al puerto heavy_attachments. Útil para enrutarlo a un nodo dedicado al procesamiento de adjuntos.
Su configuración muestra los ajustes de ejecución compartidos, pero este nodo aún no aplica reintentos (retryOnFail, maxTries). Ningún nodo aplica continueOnFail.
Comportamiento en el código
Lo que hace la implementación con estas claves más allá de lo que dice el esquema.
-
polling_interval - El mínimo de 60 segundos no se valida. El programador lo lee del borrador del workflow y, en ejecuciones manuales, es la espera entre revisiones.
-
attachment_threshold - Solo se evalúa cuando llegó exactamente un mensaje; con varios mensajes el puerto siempre es
out. -
folder - Nombre de carpeta conocida de Graph, usado tal cual en la ruta de la solicitud.
Puertos de salida
out por defecto Llegaron mensajes nuevos (y no es el caso de un único mensaje con muchos adjuntos). Los campos del correo en la raíz solo aparecen cuando llegó exactamente un mensaje.
{
"messages": [
{
"id": "AAMkAGI2TG93AAA=",
"subject": "Order 123 question",
"from": "ana@example.com",
"to": [
"support@example.com"
],
"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": "<CAF1x2y3z@mail.example.com>",
"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": "ana@example.com",
"to": [
"support@example.com"
],
"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": "<CAF1x2y3z@mail.example.com>",
"attachmentCount": 1
}heavy_attachments Llegó exactamente un mensaje y tiene attachment_threshold adjuntos o más. La salida tiene la misma forma que out.
{
"messages": [
{
"id": "AAMkAGI2TG94AAA=",
"subject": "Scanned documents",
"from": "ana@example.com",
"to": [
"support@example.com"
],
"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": "<CAF4u5v6w@mail.example.com>",
"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": "ana@example.com",
"to": [
"support@example.com"
],
"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": "<CAF4u5v6w@mail.example.com>",
"attachmentCount": 7
}empty No hay mensajes nuevos en esta revisión. Cuando una ejecución manual espera 30 minutos sin correo, la salida también trae timedOut: true y polledForMs.
{
"messages": [],
"count": 0,
"hasNewEmails": false,
"lastTimeChecked": "2026-11-26T14:05:00.031Z",
"previousCheckAt": "2026-11-26T14:04:00.087Z"
}error Falló una validación (la salida es el sobre { ok, errors, port }) o falló la consulta a Graph (la salida es { error }).
{
"error": "Request failed with status code 403"
}En expresiones
Lo que un nodo posterior puede leer de la salida de este nodo con $("Outlook - New Email").item.json.<ruta> (escribe la etiqueta de tu nodo en lugar de Outlook - New Email). Editor marca las rutas que sugiere el editor de workflows en Previous Nodes (el contrato de salida); Worker marca las rutas que el worker devuelve de verdad por out, según la salida que muestra Puertos.
| Expresión | Editor | Worker |
|---|---|---|
$("Outlook - New Email").item.json.idEl ID del mensaje. Úsalo para las operaciones de responder, reenviar o eliminar. | ||
$("Outlook - New Email").item.json.subject | ||
$("Outlook - New Email").item.json.fromDirección de correo del remitente. | ||
$("Outlook - New Email").item.json.toDirecciones de correo de los destinatarios. | ||
$("Outlook - New Email").item.json.receivedDateTime | ||
$("Outlook - New Email").item.json.bodyContenido del cuerpo del correo. | ||
$("Outlook - New Email").item.json.bodyPreview | ||
$("Outlook - New Email").item.json.isRead | ||
$("Outlook - New Email").item.json.hasAttachments | ||
$("Outlook - New Email").item.json.attachmentCountNúmero de adjuntos. | ||
$("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: El worker la devuelve pero el editor no la sugiere: escríbela a mano. Las claves dentro de objetos pueden depender de tus datos o de la configuración (por ejemplo, una clave por etiqueta).
Errores
| Mensaje | Puerto | Causa y solución |
|---|---|---|
Microsoft 365 credential is required | error | connection_id está vacío. Mailbox email is required es la misma validación para mailbox_email. |
Failed to resolve Microsoft 365 access token | error | No se pudo resolver la credencial o falló la solicitud del token. |
Poll failed: <message> | error | Falló la consulta de mensajes, por ejemplo 403 si la aplicación no tiene Mail.Read sobre el buzón o 404 si el buzón no existe. |
Failed to fetch email from resource: <message> | error | No se pudo leer el mensaje referido por una notificación de cambios. |
Contrato de salida
-
idstring Opcional -
El ID del mensaje. Úsalo para las operaciones de responder, reenviar o eliminar.
-
subjectstring Opcional -
fromstring Opcional -
Dirección de correo del remitente.
-
toarray Opcional -
Direcciones de correo de los destinatarios.
-
receivedDateTimestring Opcional -
bodystring Opcional -
Contenido del cuerpo del correo.
-
bodyPreviewstring Opcional -
isReadboolean Opcional -
hasAttachmentsboolean Opcional -
attachmentCountnumber Opcional -
Número de adjuntos.
-
importancestring Opcional
Contratos (JSON Schema)
La definición exactamente como la declara el orquestador. All es el *.definition.js completo; compáralo con las secciones de arriba para ver diferencias entre la documentación y el esquema. Úsala para validar un nodo antes de publicar.
{
"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."
}
]Ejecución
- Ejecución
async- Con estado
- No
- Reintentos (
retryOnFail) - No
- Credenciales
- Se resuelven en el servidor a partir de
connection_id; el secreto nunca llega al workflow. - Capacidades
emailmicrosoftoutlooktriggerwebhook- Etiquetas
emailmicrosoftoutlooktriggerincoming
Notas y límites
- Prueba frente a producción: el programador solo inicia la versión publicada, así que un borrador nunca sondea por sí solo. Al ejecutar el workflow manualmente se inicia en cambio el ciclo de sondeo bloqueante; con datos de muestra el motor omite este nodo y entrega la entrada de muestra por
out. - La primera ejecución programada (sin estado guardado) revisa el intervalo de ahora a ahora, así que no encuentra nada; el correo se recoge a partir del siguiente ciclo.
- Se leen como máximo 50 mensajes por revisión y luego
lastTimeCheckedpasa a ahora, así que los mensajes que superen los primeros 50 de un intervalo no se recogen. Cuando llegan varios mensajes, procesamessages(por ejemplo conflow.split). - El buzón se direcciona como
/users/<mailbox_email>, así que la credencial necesita el permiso de aplicaciónMail.Read(client credentials). La salida incluye elbodycompleto del mensaje.
Revisado contra el código del orquestador · 31e874b · 2026-11-26