- Comience ya
- Crear
- Añadir un agente de IA a un flujo de trabajo
- Llamar a una API externa
- Procesar correos electrónicos entrantes
- Crear un flujo de trabajo de notificación de Slack
- Añadir aprobación humana a un flujo de trabajo
- Crear un flujo de trabajo de agente de chat
- Gestionar errores
- Fundamentos de la depuración
- Intervención humana: escalada o paso humano
- Evaluar tus flujos de trabajo
- Solicitud HTTP
- Cómo funcionan los nodos conectores
- Crear una conexión
- Ventas y relaciones con los clientes
- Atención al cliente y mesa de ayuda
- Mensajes y reuniones
- Correo electrónico
- Marketing
- Redes sociales
- Archivos, documentos y firma electrónica
- Proyectos, colaboración y código
- Personas y contratación
- Finanzas y comercio
- Modelos y agentes de IA
- Habla, visión y lenguaje
- Datos y ubicación
- Cloud, identidad y seguridad
- Implementar y ejecutar
- Ejemplos
- Referencia
Procesar correos electrónicos entrantes
Build a workflow that starts when a new email arrives, extracts key fields, and routes the message to the right action based on its content.
Lo que creas
Un flujo de trabajo que se inicia automáticamente cuando llega un nuevo correo electrónico, extrae campos clave del mensaje y lo enruta a la acción correcta en función de su contenido, por ejemplo, registrar solicitudes de soporte en un sistema de tickets o escalar mensajes urgentes a un canal de Slack.
Antes de comenzar
- Una conexión a tu buzón, como Microsoft Outlook 365 o Gmail. Crear una conexión describe cómo crear una.
Nodos utilizados
- Connector trigger with the Email Received event: starts the workflow when a new email arrives in the connected mailbox.
- Script: extracts the sender, subject, and body from the email.
- Decision, twice: checks that the email has the fields you need, then routes it based on content.
- Terminate: ends the workflow cleanly if the email is missing a field.
Pasos
Con una configuración de agente de codificación, puedes omitir los pasos manuales. Pregúntelo:
Build a Maestro Automate workflow that starts when a new email arrives in my mailbox connection, extracts the sender, subject, and body, and uses a Decision node to send urgent messages to Slack and everything else to my support system.
Build a Maestro Automate workflow that starts when a new email arrives in my mailbox connection, extracts the sender, subject, and body, and uses a Decision node to send urgent messages to Slack and everything else to my support system.
A continuación, abre el flujo de trabajo en el lienzo, compruébalo con los siguientes pasos y pruébalo. Configurar tu agente de codificación describe la configuración.
1. Create a workflow and change its trigger to Email Received
- Create a project, as Your first workflow describes. The canvas opens with a Manual Trigger on it.
- Select the Manual Trigger, then select Connector trigger in the Change trigger list.
- Choose your email app, Microsoft Outlook 365 or Gmail, then the Email Received event.
- In the Connector section, select the connection to your mailbox.
2. Extraer campos del correo electrónico
-
Select the + on the output handle of the trigger.
-
Search for Script and select it.
-
In Code, return the fields you need from the trigger's output:
const email = $vars.<trigger ID>.output; return { senderEmail: email.sender.<address field>, emailSubject: email.subject, emailBody: email.body.<text field> };const email = $vars.<trigger ID>.output; return { senderEmail: email.sender.<address field>, emailSubject: email.subject, emailBody: email.body.<text field> };
In Outlook, sender and body are objects: expand them under { } Insert in the Script node to find the address and the text. The exact field names vary by connector.
3. Check that the email has the fields you need
Not every email has the expected fields. Check them before the workflow uses them:
- Select the + on the output handle of the Script node.
- Search for Decision and select it.
- Set the condition to check that the required fields are present, for example
$vars.script1.output.senderEmail != null. - From the False handle, add a Script node that logs the problem.
- From the output handle of that Script node, add a Terminate node.
The True branch carries the valid emails. The next step routes them.
4. Route urgent messages
- Select the + on the True handle of the Decision node from step 3.
- Search for Decision and select it.
- Set the condition to catch urgent messages, for example
$vars.script1.output.emailSubject.toLowerCase().includes("urgent"). - Connect the True branch to a high-priority action, for example a Slack notification node.
- Connect the False branch to a standard action, for example creating a ticket in your support system.
Any node that has an Error handle can also be connected to the error path from step 3. The Error handling page describes how.
5. Probar y depurar
- Select Run Debug (▶) in the bottom toolbar of the canvas. The debug run uses an email that's already in the connected mailbox, so you don't need to send one.
- In the execution panel, check the email's fields under Variables > Inputs.
- Check in the execution trace that the email took the path you expected.
- To test the other path, send yourself an email that matches it, for example one with "urgent" in the subject.
- Select Run Debug (▶) again.
- Check under Variables > Inputs that the run picked up that email.
Debugging basics describes the execution panel.
Resultado
The workflow starts when a new email arrives, extracts the sender, subject, and body, and routes the message to the right action. Emails with missing fields end on the error path and do not break the workflow.
Ampliar este flujo de trabajo
- Invoke an AI agent: before the routing Decision, add an Autonomous Agent node to classify the email with AI rather than a keyword match.
- Route to more than two paths: replace the routing Decision with a Switch node, for example to send urgent messages, support requests, and everything else to different actions.
- Recorrer los archivos adjuntos: si el correo electrónico tiene archivos adjuntos, añade un nodo de bucle para procesar cada uno.
- Reply to the sender: after routing, add an email connector node to send a confirmation reply to
{{ $vars.script1.output.senderEmail }}.
Próximos pasos
- Implementar un flujo de trabajo: hace que el flujo de trabajo se ejecute sin ti.
- Guías: más flujos de trabajo para crear.
- Comunidad: comparte lo que creaste o pide ayuda a otros creadores.
- Lo que creas
- Antes de comenzar
- Nodos utilizados
- Pasos
- 1. Create a workflow and change its trigger to Email Received
- 2. Extraer campos del correo electrónico
- 3. Check that the email has the fields you need
- 4. Route urgent messages
- 5. Probar y depurar
- Resultado
- Ampliar este flujo de trabajo
- Próximos pasos