AutomationFlowsAI & RAG › Mail Professional Check - Briefing giornaliero

Mail Professional Check - Briefing giornaliero

Mail Professional Check - Briefing giornaliero. Uses scheduleTrigger, gmail, googleCalendar, agent. Scheduled trigger; 15 nodes.

Cron / scheduled trigger★★★★☆ complexityAI-powered15 nodesGmailGoogle CalendarAgentLm Chat Open Router
AI & RAG Trigger: Cron / scheduled Nodes: 15 Complexity: ★★★★☆ AI nodes: yes

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Mail Professional Check - Briefing giornaliero",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 18
            }
          ]
        }
      },
      "id": "d994fa66-56de-4e00-902c-b94597636b83",
      "name": "Todos los dias a las 18:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        240,
        400
      ]
    },
    {
      "parameters": {
        "operation": "getAll",
        "returnAll": true,
        "filters": {
          "readStatus": "both",
          "receivedAfter": "={{ $today.toISO() }}"
        }
      },
      "id": "d6cd897a-188b-42f3-8ac9-afd10ede0afc",
      "name": "Traer Emails de Hoy",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        544,
        192
      ],
      "executeOnce": true,
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "emails",
        "options": {}
      },
      "id": "09fa9e22-6d83-481b-bff7-95dbcd0286d1",
      "name": "Agregar Emails",
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        848,
        192
      ]
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineByPosition",
        "options": {}
      },
      "id": "b7fb9603-a786-4de8-9c28-2197d77e3957",
      "name": "Combinar Emails y Eventos Hoy",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        1152,
        304
      ]
    },
    {
      "parameters": {
        "operation": "getAll",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "primary"
        },
        "returnAll": true,
        "timeMin": "={{ $today.toISO() }}",
        "timeMax": "={{ $today.endOf(\"day\").toISO() }}",
        "options": {}
      },
      "id": "0c9464fb-510d-4c4f-9df1-cf75cc5683e7",
      "name": "Eventos de Hoy",
      "type": "n8n-nodes-base.googleCalendar",
      "typeVersion": 1.3,
      "position": [
        544,
        400
      ],
      "executeOnce": true,
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "eventosHoy",
        "options": {}
      },
      "id": "56d466fb-534d-4195-9236-0b31b7325967",
      "name": "Agregar Eventos de Hoy",
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        848,
        400
      ]
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineByPosition",
        "options": {}
      },
      "id": "003544cb-28fc-422d-a846-8cc3468d1e0e",
      "name": "Combinar Todo",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        1440,
        400
      ]
    },
    {
      "parameters": {
        "operation": "getAll",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "primary"
        },
        "returnAll": true,
        "timeMin": "={{ $today.plus({ days: 1 }).toISO() }}",
        "timeMax": "={{ $today.plus({ days: 1 }).endOf(\"day\").toISO() }}",
        "options": {}
      },
      "id": "dff9f1d6-8766-4640-9764-94668650ce74",
      "name": "Eventos de Manana",
      "type": "n8n-nodes-base.googleCalendar",
      "typeVersion": 1.3,
      "position": [
        544,
        624
      ],
      "executeOnce": true,
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "eventosManana",
        "options": {}
      },
      "id": "fde163ce-641c-4771-884a-faf4cc189a10",
      "name": "Agregar Eventos de Manana",
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        848,
        624
      ]
    },
    {
      "parameters": {
        "jsCode": "const data = $input.first().json;\nconst emails = data.emails || [];\nconst eventosHoy = data.eventosHoy || [];\nconst eventosManana = data.eventosManana || [];\nreturn [{ json: { emails, eventosHoy, eventosManana, kpis: { emails: emails.length, today: eventosHoy.length, tomorrow: eventosManana.length } } }];"
      },
      "id": "4fd642f9-238b-4e83-b654-ce017bf697a0",
      "name": "Calcular KPIs",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1712,
        400
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Data di oggi: {{ $now.toFormat(\"EEEE dd/MM/yyyy\") }}\n\nEMAIL DI OGGI:\n{{ JSON.stringify($json.emails) }}\n\nEVENTI DI OGGI:\n{{ JSON.stringify($json.eventosHoy) }}\n\nEVENTI DI DOMANI:\n{{ JSON.stringify($json.eventosManana) }}",
        "options": {
          "systemMessage": "Sei Super Assistant, l'assistente personale di Daniel. Analizzi le email e gli eventi del giorno e generi un riepilogo esecutivo professionale in HTML con stili inline. Rispondi SEMPRE in italiano.\n\nStruttura OBBLIGATORIA:\n\n1. RIEPILOGO GENERALE DEL GIORNO (2-3 frasi con le cose piu importanti)\n\n2. EMAIL IMPORTANTI (quelle che richiedono attenzione immediata)\n\n3. EMAIL PER CATEGORIA (solo quelle con email):\n   - Lavoro / Clienti\n   - Offerte di lavoro\n   - Personale\n   - Fatture / Servizi\n   - Pubblicita\n   - Altro\n\n4. AZIONI IN SOSPESO (email che richiedono risposta, con breve descrizione di cosa fare)\n\n5. EVENTI DI OGGI\n\n6. AGENDA DI DOMANI\n\nFormato: HTML con stili inline. Colori: blu scuro #1a365d per i titoli, grigio #718096 per i metadati. Font sans-serif. Tono diretto ed esecutivo. Se una categoria non ha elementi, omettila."
        }
      },
      "id": "f569d18c-1b21-4dda-8343-6b3089fd32e8",
      "name": "Super Assistant - Generar Resumen",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        1904,
        400
      ]
    },
    {
      "parameters": {
        "model": "openai/gpt-4o-mini",
        "options": {
          "maxTokens": 4096,
          "temperature": 0
        }
      },
      "id": "6c2aa289-2415-40b3-a80e-e588a257877d",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        2000,
        592
      ],
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineByPosition",
        "options": {}
      },
      "id": "d5c7deb4-ab78-48cf-94ed-f1abf8dcf50f",
      "name": "Unire Output e KPI",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        2192,
        400
      ]
    },
    {
      "parameters": {
        "jsCode": "const input = $input.first().json;\nconst rawHtml = input.output || '';\nconst _kpis = input.kpis || null;\n\nconst PAGE_W = 595; const PAGE_H = 842; const LEFT = 48; const RIGHT = 48;\nconst TOP = 34; const BOTTOM = 38; const HEADER_H = 74; const FOOTER_H = 28;\nconst KPI_H = 64; const CONTENT_W = PAGE_W - LEFT - RIGHT;\nconst CONTENT_TOP = PAGE_H - TOP - HEADER_H - KPI_H - 18;\nconst CONTENT_BOTTOM = BOTTOM + FOOTER_H;\n\nconst COLORS = {\n  ink: [0.15, 0.18, 0.22], muted: [0.43, 0.47, 0.53],\n  accent: [0.17, 0.33, 0.56], accentSoft: [0.84, 0.91, 0.98],\n  sectionBg: [0.91, 0.96, 1.00], border: [0.80, 0.85, 0.91],\n  lightLine: [0.89, 0.91, 0.95], warningAccent: [0.78, 0.46, 0.09],\n  successAccent: [0.18, 0.47, 0.25], dark: [0.11, 0.16, 0.24],\n  mailBg: [0.85, 0.93, 1.00], importantBg: [0.99, 0.93, 0.74],\n  categoryBg: [0.90, 0.95, 1.00], actionBg: [0.99, 0.92, 0.72],\n  todayBg: [0.86, 0.95, 0.88], tomorrowBg: [0.80, 0.86, 0.96],\n  cardBg: [1.00, 1.00, 1.00]\n};\n\nconst now = new Date();\nconst todayISO = now.toISOString().slice(0, 10);\nconst todayHuman = now.toLocaleDateString('it-IT', { weekday: 'long', day: '2-digit', month: 'long', year: 'numeric' });\nconst docTitle = 'Briefing giornaliero: email e agenda';\n\nfunction cleanHtmlToText(html) {\n  return String(html)\n    .replace(/<style[^>]*>[\\s\\S]*?<\\/style>/gi, '')\n    .replace(/<script[^>]*>[\\s\\S]*?<\\/script>/gi, '')\n    .replace(/<\\/h[1-6]>/gi, '\\n').replace(/<h[1-6][^>]*>/gi, '')\n    .replace(/<br\\s*\\/?>/gi, '\\n')\n    .replace(/<\\/(?:p|div|section|article|li|tr|ul|ol)>/gi, '\\n')\n    .replace(/<li[^>]*>/gi, '\\u2022 ').replace(/<[^>]+>/g, '')\n    .replace(/&nbsp;/g, ' ').replace(/&amp;/g, '&').replace(/&lt;/g, '<')\n    .replace(/&gt;/g, '>').replace(/&quot;/g, '\"').replace(/&#39;/g, \"'\")\n    .replace(/\\r/g, '').replace(/[ \\t]+\\n/g, '\\n').replace(/\\n[ \\t]+/g, '\\n')\n    .replace(/[ \\t]{2,}/g, ' ').replace(/\\n{3,}/g, '\\n\\n').trim();\n}\n\nfunction normalizePrintable(str) {\n  return String(str)\n    .replace(/[\\u201C\\u201D]/g, '\"').replace(/[\\u2018\\u2019]/g, \"'\")\n    .replace(/[\\u2013\\u2014]/g, '-').replace(/\\u2026/g, '...')\n    .replace(/\\u00A0/g, ' ').replace(/\\u2022/g, '\\xb7')\n    .replace(/[^\\x09\\x0A\\x0D\\x20-\\xFF]/g, '?');\n}\n\nfunction escPdfText(str) {\n  return normalizePrintable(str).replace(/\\\\/g, '\\\\\\\\').replace(/\\(/g, '\\\\(').replace(/\\)/g, '\\\\)');\n}\n\nfunction approxMaxChars(w, fs, f) { f = f || 0.52; return Math.max(10, Math.floor(w / (fs * f))); }\n\nfunction wrapText(text, maxChars) {\n  const words = String(text).trim().split(/\\s+/); const lines = []; let cur = '';\n  for (let i = 0; i < words.length; i++) {\n    const w = words[i]; const t = cur ? cur + ' ' + w : w;\n    if (t.length <= maxChars) { cur = t; }\n    else {\n      if (cur) lines.push(cur);\n      if (w.length <= maxChars) { cur = w; }\n      else { let r = w; while (r.length > maxChars) { lines.push(r.slice(0, maxChars-1)+'-'); r = r.slice(maxChars-1); } cur = r; }\n    }\n  }\n  if (cur) lines.push(cur); return lines.length ? lines : [''];\n}\n\nfunction isBullet(l) { return /^([\\u2022\\xb7\\x95*\\-]\\s+|\\d+[.)]\\s+)/.test(l); }\nfunction stripBullet(l) { return l.replace(/^([\\u2022\\xb7\\x95*\\-]\\s+|\\d+[.)]\\s+)/, '').trim(); }\nfunction normalizeHeading(l) { return l.replace(/^#+\\s*/, '').replace(/^\\d+[.)]\\s*/, '').replace(/:$/, '').trim().toLowerCase().replace(/\\b\\w/g, function(c){return c.toUpperCase();}); }\n\nfunction isHeading(l) {\n  const c = normalizeHeading(l); if (!c) return false;\n  const known = ['Riepilogo Del Giorno','Riepilogo Esecutivo Del Giorno','Email Importanti','Email Per Categoria','Azioni In Sospeso','Eventi Di Oggi','Agenda Di Domani'];\n  return /^#+\\s+/.test(l) || known.indexOf(c) !== -1 || (c.length <= 70 && c.endsWith(':')) || (c.length <= 55 && /^[A-Z\\xC0-\\xFF][A-Za-z\\xC0-\\xFF0-9\\s/&()\\-]+$/.test(c));\n}\n\nfunction isCatSub(l) {\n  const c = l.trim().replace(/^[\\u2022\\xb7\\x95*\\-]\\s+/, '').replace(/:$/, '').toLowerCase();\n  return ['lavoro / clienti','offerte di lavoro','personale','fatture / servizi','pubblicita','pubblicit\u00e0','altro'].indexOf(c) !== -1;\n}\n\nfunction classifySection(n) {\n  const s = String(n).toLowerCase().trim();\n  if (s.indexOf('riepilogo') !== -1) return 'summary';\n  if (s === 'email importanti') return 'important';\n  if (s === 'email per categoria') return 'categories';\n  if (s === 'azioni in sospeso') return 'warning';\n  if (s === 'eventi di oggi') return 'today';\n  if (s === 'agenda di domani') return 'tomorrow';\n  if (s.indexOf('email') !== -1) return 'mail';\n  return 'default';\n}\n\nlet text = cleanHtmlToText(rawHtml); if (!text) text = 'Sin contenido.';\nconst rawLines = text.split('\\n').map(function(s){return s.trim();});\nconst items = []; let lastSpacer = false; let curSec = '';\n\nfor (let i = 0; i < rawLines.length; i++) {\n  const l = rawLines[i];\n  if (!l) { if (!lastSpacer){items.push({type:'spacer',h:8});lastSpacer=true;} continue; }\n  lastSpacer = false;\n  if (/^#+\\s+/.test(l) || isHeading(l)) { const ht = normalizeHeading(l); curSec = ht; items.push({type:'heading',text:ht,variant:classifySection(ht)}); continue; }\n  if (isCatSub(l)) { items.push({type:'subheading',text:l.replace(/^[\\u2022\\xb7\\x95*\\-]\\s+/,'').replace(/:$/,'').trim()}); continue; }\n  if (isBullet(l)) { items.push({type:curSec.toLowerCase()==='email per categoria'?'bulletIndented':'bullet',text:stripBullet(l),section:curSec}); continue; }\n  items.push({type:'paragraph',text:l,section:curSec});\n}\nif (!items.length) items.push({type:'paragraph',text:'Sin contenido.'});\n\nfunction computeMetrics(its) {\n  const known = ['riepilogo del giorno','riepilogo esecutivo del giorno','email importanti','email per categoria','azioni in sospeso','eventi di oggi','agenda di domani'];\n  let cs=''; let emails=0,important=0,today=0,tomorrow=0;\n  for (let i=0;i<its.length;i++){\n    const it=its[i];\n    if(it.type==='heading'){const n=it.text.toLowerCase();if(known.indexOf(n)!==-1)cs=n;continue;}\n    if(it.type!=='bullet'&&it.type!=='bulletIndented')continue;\n    if(cs==='email importanti')important++;\n    else if(cs==='email per categoria')emails++;\n    else if(cs==='eventi di oggi')today++;\n    else if(cs==='agenda di domani')tomorrow++;\n  }\n  return {emails,important,today,tomorrow};\n}\n\nconst parsedMetrics = computeMetrics(items);\nconst metrics = _kpis ? { emails:_kpis.emails, important:parsedMetrics.important, today:_kpis.today, tomorrow:_kpis.tomorrow } : parsedMetrics;\n\nconst pages=[]; let curPage=[]; let y=CONTENT_TOP;\nfunction newPage(){if(curPage.length)pages.push(curPage);curPage=[];y=CONTENT_TOP;}\nfunction ensureSpace(h){if(y-h<CONTENT_BOTTOM)newPage();}\nfunction addSpacer(h){if(y-h<CONTENT_BOTTOM)newPage();else y-=h;}\n\nfunction addParagraph(txt,opts){\n  opts=opts||{};const fs=opts.fontSize||10.3;const lh=opts.lineH||14;\n  const x=opts.x||LEFT;const w=opts.width||CONTENT_W;const col=opts.color||COLORS.ink;\n  const lines=wrapText(txt,approxMaxChars(w,fs,0.50));\n  for(let i=0;i<lines.length;i++){ensureSpace(lh);curPage.push({type:'text',x,y,font:'F1',size:fs,color:col,text:lines[i]});y-=lh;}\n  y-=opts.after||5;\n}\n\nfunction addBullet(txt,opts){\n  opts=opts||{};const fs=opts.fontSize||10.2;const lh=opts.lineH||14;\n  const bx=opts.bulletX||LEFT;const tx=opts.textX||LEFT+14;\n  const w=opts.width||(CONTENT_W-(tx-LEFT));\n  const bc=opts.bulletColor||COLORS.accent;const tc=opts.textColor||COLORS.ink;\n  const lines=wrapText(txt,approxMaxChars(w,fs,0.50));\n  for(let i=0;i<lines.length;i++){\n    ensureSpace(lh);\n    if(i===0)curPage.push({type:'text',x:bx,y,font:'F2',size:fs,color:bc,text:'\\xb7'});\n    curPage.push({type:'text',x:tx,y,font:'F1',size:fs,color:tc,text:lines[i]});y-=lh;\n  }\n  y-=opts.after||4;\n}\n\nfunction addSubheading(txt){\n  const fs=10.4;const lh=13;const x=LEFT+14;const w=CONTENT_W-14;\n  const lines=wrapText(txt,approxMaxChars(w,fs,0.50));\n  ensureSpace((lines.length*lh)+8);\n  for(let i=0;i<lines.length;i++){curPage.push({type:'text',x,y,font:'F2',size:fs,color:COLORS.dark,text:lines[i]});y-=lh;}\n  y-=2;\n}\n\nfunction addHeading(txt,variant){\n  variant=variant||'default';const fs=11.4;\n  const lines=wrapText(txt,approxMaxChars(CONTENT_W-24,fs,0.50));\n  const h=14+(lines.length*13);ensureSpace(h+26);\n  curPage.push({type:'section',x:LEFT,yTop:y,w:CONTENT_W,h,lines,variant});y-=h+10;\n}\n\nfor(let i=0;i<items.length;i++){\n  const it=items[i];\n  if(it.type==='spacer')addSpacer(it.h);\n  else if(it.type==='heading')addHeading(it.text,it.variant);\n  else if(it.type==='subheading')addSubheading(it.text);\n  else if(it.type==='bullet')addBullet(it.text);\n  else if(it.type==='bulletIndented')addBullet(it.text,{bulletX:LEFT+18,textX:LEFT+32,width:CONTENT_W-32,bulletColor:COLORS.muted});\n  else if(it.type==='paragraph'){\n    const sp=(it.section||'').indexOf('Riepilogo')!==-1?{color:COLORS.dark,fontSize:10.6,after:6}:{};\n    addParagraph(it.text,sp);\n  }\n}\nif(curPage.length)pages.push(curPage);\nif(!pages.length)pages.push([{type:'text',x:LEFT,y:CONTENT_TOP,font:'F1',size:10.5,color:COLORS.ink,text:'Sin contenido.'}]);\n\nfunction n(v){return Number(v).toFixed(2);}\nfunction rgb(c){const a=Array.isArray(c)&&c.length>=3?c:COLORS.ink;return a[0].toFixed(3)+' '+a[1].toFixed(3)+' '+a[2].toFixed(3);}\nfunction fillRect(x,y,w,h,c){return rgb(c)+' rg '+n(x)+' '+n(y)+' '+n(w)+' '+n(h)+' re f';}\nfunction strokeRect(x,y,w,h,c,lw){lw=lw||1;return n(lw)+' w '+rgb(c)+' RG '+n(x)+' '+n(y)+' '+n(w)+' '+n(h)+' re S';}\nfunction strokeLine(x1,y1,x2,y2,c,lw){lw=lw||1;return n(lw)+' w '+rgb(c)+' RG '+n(x1)+' '+n(y1)+' m '+n(x2)+' '+n(y2)+' l S';}\nfunction drawText(o){return rgb(o.color||COLORS.ink)+' rg BT /'+(o.font||'F1')+' '+n(o.size||10)+' Tf '+n(o.x)+' '+n(o.y)+' Td ('+escPdfText(o.text)+') Tj ET';}\n\nfunction renderKpiCard(x,yTop,w,h,label,value,ac){\n  const cmds=[];const yb=yTop-h;const sa=Array.isArray(ac)?ac:COLORS.accent;\n  cmds.push(fillRect(x,yb,w,h,COLORS.cardBg));cmds.push(strokeRect(x,yb,w,h,COLORS.border,0.8));\n  cmds.push(fillRect(x,yb,4,h,sa));\n  cmds.push(drawText({x:x+14,y:yb+h-21,text:label,font:'F1',size:8.8,color:COLORS.muted}));\n  cmds.push(drawText({x:x+14,y:yb+h-43,text:String(value),font:'F2',size:18,color:COLORS.ink}));\n  return cmds.join('\\n');\n}\n\nfunction renderPage(pageItems,pi,total){\n  const cmds=[];const hb=PAGE_H-TOP-HEADER_H;\n  cmds.push(fillRect(0,hb,PAGE_W,HEADER_H,COLORS.accentSoft));\n  cmds.push(strokeLine(LEFT,hb-5,PAGE_W-RIGHT,hb-5,COLORS.border,1));\n  cmds.push(drawText({x:LEFT,y:PAGE_H-TOP-26,text:docTitle,font:'F2',size:17.2,color:COLORS.accent}));\n  cmds.push(drawText({x:LEFT,y:PAGE_H-TOP-43,text:'Generato il '+todayHuman,font:'F1',size:9.4,color:COLORS.muted}));\n  cmds.push(drawText({x:PAGE_W-RIGHT-78,y:PAGE_H-TOP-26,text:'Pagina '+(pi+1)+'/'+total,font:'F1',size:9.2,color:COLORS.muted}));\n  const kpiTop=PAGE_H-TOP-HEADER_H-12;const gap=10;const cardW=(CONTENT_W-(gap*3))/4;const cardH=48;\n  cmds.push(renderKpiCard(LEFT,kpiTop,cardW,cardH,'Email',metrics.emails,COLORS.accent));\n  cmds.push(renderKpiCard(LEFT+cardW+gap,kpiTop,cardW,cardH,'Importanti',metrics.important,COLORS.warningAccent));\n  cmds.push(renderKpiCard(LEFT+(cardW+gap)*2,kpiTop,cardW,cardH,'Oggi',metrics.today,COLORS.successAccent));\n  cmds.push(renderKpiCard(LEFT+(cardW+gap)*3,kpiTop,cardW,cardH,'Domani',metrics.tomorrow,COLORS.dark));\n  const footerY=BOTTOM+FOOTER_H;\n  cmds.push(strokeLine(LEFT,footerY,PAGE_W-RIGHT,footerY,COLORS.lightLine,1));\n  cmds.push(drawText({x:LEFT,y:BOTTOM+10,text:'Report generato automaticamente da workflow n8n',font:'F1',size:8.5,color:COLORS.muted}));\n  cmds.push(drawText({x:PAGE_W-RIGHT-88,y:BOTTOM+10,text:todayISO,font:'F1',size:8.5,color:COLORS.muted}));\n  for(let i=0;i<pageItems.length;i++){\n    const it=pageItems[i];\n    if(it.type==='section'){\n      const bb=it.yTop-it.h+4;let bg=COLORS.sectionBg;let ac=COLORS.accent;\n      if(it.variant==='summary'){bg=COLORS.mailBg;ac=COLORS.accent;}\n      else if(it.variant==='important'){bg=COLORS.importantBg;ac=COLORS.warningAccent;}\n      else if(it.variant==='categories'){bg=COLORS.categoryBg;ac=COLORS.accent;}\n      else if(it.variant==='warning'){bg=COLORS.actionBg;ac=COLORS.warningAccent;}\n      else if(it.variant==='today'){bg=COLORS.todayBg;ac=COLORS.successAccent;}\n      else if(it.variant==='tomorrow'){bg=COLORS.tomorrowBg;ac=COLORS.dark;}\n      else if(it.variant==='mail'){bg=COLORS.mailBg;ac=COLORS.accent;}\n      cmds.push(fillRect(it.x,bb,it.w,it.h,bg));cmds.push(fillRect(it.x,bb,4,it.h,ac));\n      let ty=it.yTop-14;\n      for(let j=0;j<it.lines.length;j++){cmds.push(drawText({x:it.x+12,y:ty,text:it.lines[j],font:'F2',size:11.2,color:ac}));ty-=13;}\n    } else if(it.type==='text'){cmds.push(drawText(it));}\n  }\n  return cmds.join('\\n');\n}\n\nconst N=pages.length;const CID=1;const PID=2;\nconst PIDS=[];for(let i=0;i<N;i++)PIDS.push(3+i);\nconst CIDS=[];for(let i=0;i<N;i++)CIDS.push(3+N+i);\nconst FR=3+2*N;const FB=FR+1;const FI=FB+1;const TOT=FI;\nconst off={};let body='%PDF-1.4\\n';\nfunction addObj(id,c){off[id]=body.length;body+=id+' 0 obj\\n'+c+'\\nendobj\\n';}\naddObj(CID,'<< /Type /Catalog /Pages '+PID+' 0 R >>');\naddObj(PID,'<< /Type /Pages /Kids ['+PIDS.map(function(id){return id+' 0 R';}).join(' ')+'] /Count '+N+' >>');\nfor(let p=0;p<N;p++)addObj(PIDS[p],'<< /Type /Page /Parent '+PID+' 0 R /MediaBox [0 0 '+PAGE_W+' '+PAGE_H+'] /Contents '+CIDS[p]+' 0 R /Resources << /Font << /F1 '+FR+' 0 R /F2 '+FB+' 0 R >> >> >>');\nfor(let p=0;p<N;p++){const c=renderPage(pages[p],p,N);const l=Buffer.byteLength(c,'latin1');addObj(CIDS[p],'<< /Length '+l+' >>\\nstream\\n'+c+'\\nendstream');}\naddObj(FR,'<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>');\naddObj(FB,'<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >>');\naddObj(FI,'<< /Title ('+escPdfText(docTitle)+') /Author (n8n) /Producer (n8n Code Node) /Subject (Briefing giornaliero) /CreationDate (D:'+todayISO.replace(/-/g,'')+'000000) >>');\nconst xp=body.length;\nbody+='xref\\n0 '+(TOT+1)+'\\n';body+='0000000000 65535 f \\n';\nfor(let i=1;i<=TOT;i++)body+=String(off[i]).padStart(10,'0')+' 00000 n \\n';\nbody+='trailer\\n<< /Size '+(TOT+1)+' /Root '+CID+' 0 R /Info '+FI+' 0 R >>\\n';\nbody+='startxref\\n'+xp+'\\n%%EOF';\nconst b64=Buffer.from(body,'latin1').toString('base64');\nreturn [{json:input,binary:{attachment:{data:b64,mimeType:'application/pdf',fileName:'briefing_giornaliero_'+todayISO+'.pdf',fileExtension:'pdf'}}}];"
      },
      "id": "5b64c78b-0483-4095-8830-26ffc04e73e0",
      "name": "Generar PDF",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2464,
        400
      ]
    },
    {
      "parameters": {
        "sendTo": "<redacted>",
        "subject": "=Super Assistant - Riepilogo del {{ $now.toFormat(\"dd/MM/yyyy\") }}",
        "message": "={{ $json.output }}",
        "options": {
          "appendAttribution": false,
          "attachmentsUi": {
            "attachmentsBinary": [
              {
                "property": "attachment"
              }
            ]
          },
          "senderName": "Super Assistant"
        }
      },
      "id": "a9864d5e-ce50-4f55-9d00-eaaaa2c4e8ce",
      "name": "Enviar Resumen a Daniel",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        2704,
        400
      ],
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Todos los dias a las 18:00": {
      "main": [
        [
          {
            "node": "Traer Emails de Hoy",
            "type": "main",
            "index": 0
          },
          {
            "node": "Eventos de Hoy",
            "type": "main",
            "index": 0
          },
          {
            "node": "Eventos de Manana",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Traer Emails de Hoy": {
      "main": [
        [
          {
            "node": "Agregar Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agregar Emails": {
      "main": [
        [
          {
            "node": "Combinar Emails y Eventos Hoy",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combinar Emails y Eventos Hoy": {
      "main": [
        [
          {
            "node": "Combinar Todo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Eventos de Hoy": {
      "main": [
        [
          {
            "node": "Agregar Eventos de Hoy",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agregar Eventos de Hoy": {
      "main": [
        [
          {
            "node": "Combinar Emails y Eventos Hoy",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Combinar Todo": {
      "main": [
        [
          {
            "node": "Calcular KPIs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Eventos de Manana": {
      "main": [
        [
          {
            "node": "Agregar Eventos de Manana",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agregar Eventos de Manana": {
      "main": [
        [
          {
            "node": "Combinar Todo",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Calcular KPIs": {
      "main": [
        [
          {
            "node": "Super Assistant - Generar Resumen",
            "type": "main",
            "index": 0
          },
          {
            "node": "Unire Output e KPI",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Super Assistant - Generar Resumen": {
      "main": [
        [
          {
            "node": "Unire Output e KPI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Super Assistant - Generar Resumen",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Unire Output e KPI": {
      "main": [
        [
          {
            "node": "Generar PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generar PDF": {
      "main": [
        [
          {
            "node": "Enviar Resumen a Daniel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": true
  },
  "versionId": "018561b8-5216-493c-82e9-d819a78c2dce",
  "meta": {
    "aiBuilderAssisted": true,
    "templateCredsSetupCompleted": true
  },
  "id": "4BLyI3ccUe9YIQyt",
  "tags": []
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

About this workflow

Mail Professional Check - Briefing giornaliero. Uses scheduleTrigger, gmail, googleCalendar, agent. Scheduled trigger; 15 nodes.

Source: https://gitlab.com/Daniel_Sarmiento/n8n-workflow-professional-inbox-agenda-summary/-/blob/main/Mail_Professional_Check___Resumen_18hs.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →