AI-Deepseek-R1t Approbation des déplacements pour réunions et demande d'autorisation de dépenses

Avancé

Ceci est unDocument Extraction, Multimodal AIworkflow d'automatisation du domainecontenant 24 nœuds.Utilise principalement des nœuds comme If, Set, Code, Gmail, Merge. Automatisation de l'approbation des voyages et des réunions avec Deepseek AI, Gmail et Google Sheets

Prérequis
  • Compte Google et informations d'identification Gmail API
  • Peut nécessiter les informations d'identification d'authentification de l'API cible
  • Informations d'identification Google Sheets API
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "81yLdORwZmVNF6Ja",
  "meta": {
    "instanceId": "b91e510ebae4127f953fd2f5f8d40d58ca1e71c746d4500c12ae86aad04c1502",
    "templateCredsSetupCompleted": true
  },
  "name": "AI-Deepseek-R1t Conference Travel Approval & Expense Authorization Request",
  "tags": [],
  "nodes": [
    {
      "id": "0d8d20d1-ebfd-48d5-a0f7-69df51d4dd87",
      "name": "Déclencheur manuel",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        432,
        816
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ef08d98d-ba47-4d3f-acdf-c6940156c21e",
      "name": "Configuration du flux de travail",
      "type": "n8n-nodes-base.set",
      "position": [
        608,
        816
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "conferenceName",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Conference name__>"
            },
            {
              "id": "id-2",
              "name": "conferenceDuration",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Conference duration (e.g., 3-5 June 2024)__>"
            },
            {
              "id": "id-3",
              "name": "hostCountry",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Host country__>"
            },
            {
              "id": "id-4",
              "name": "fundingSource",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Funding source (e.g., Research Grant XYZ)__>"
            },
            {
              "id": "id-5",
              "name": "registrationFee",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Conference registration fee__>"
            },
            {
              "id": "id-6",
              "name": "flightQuote1",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Flight quotation 1__>"
            },
            {
              "id": "id-7",
              "name": "flightQuote2",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Flight quotation 2__>"
            },
            {
              "id": "id-8",
              "name": "flightQuote3",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Flight quotation 3__>"
            },
            {
              "id": "id-9",
              "name": "accommodationCost",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Accommodation cost estimate__>"
            },
            {
              "id": "id-10",
              "name": "visaCost",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Visa cost estimate__>"
            },
            {
              "id": "id-11",
              "name": "mealsCost",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Meals cost estimate__>"
            },
            {
              "id": "id-12",
              "name": "transportCost",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Local transport cost estimate__>"
            },
            {
              "id": "id-13",
              "name": "ceoEmail",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__CEO email address__>"
            },
            {
              "id": "id-14",
              "name": "yourName",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Your name__>"
            },
            {
              "id": "id-15",
              "name": "yourPosition",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Your position/title__>"
            },
            {
              "id": "id-16",
              "name": "conferenceUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Conference website URL__>"
            },
            {
              "id": "id-17",
              "name": "budgetLimit",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Budget limit for approval (e.g., 5000)__>"
            },
            {
              "id": "id-18",
              "name": "currency",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Currency code (e.g., USD, EUR, GBP)__>"
            },
            {
              "id": "id-19",
              "name": "exchangeRateApiKey",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Exchange rate API key (optional)__>"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "03741e53-ce18-43ac-9aab-041b53a30f2e",
      "name": "Récupérer les taux de change",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        928,
        512
      ],
      "parameters": {
        "url": "=https://api.exchangerate-api.com/v4/latest/{{ $('Workflow Configuration').item.json.currency }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "f61e2b68-430a-40aa-94a7-73f8963a14bc",
      "name": "Obtenir les détails de la conférence",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1072,
        1008
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').item.json.conferenceUrl }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "n8n-workflow"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "0cf985e3-08ef-4005-b746-fe3a5ffd914f",
      "name": "Calculer le total des dépenses",
      "type": "n8n-nodes-base.code",
      "position": [
        1456,
        944
      ],
      "parameters": {
        "jsCode": "// Calculate total expenses by summing all cost categories and converting to base currency\n\nconst config = $('Workflow Configuration').first().json;\nconst exchangeData = $('Extract Currency Data').first().json;\nconst flightOptions = $('Aggregate Flight Options').first().json;\nconst conferenceDetails = $('Get Conference Details').first().json;\n\n// Helper function to extract numeric value from string (handles currency symbols and formatting)\nfunction extractAmount(value) {\n  if (typeof value === 'number') return value;\n  if (!value) return 0;\n  \n  // Remove currency symbols, commas, and extract number\n  const cleaned = String(value).replace(/[^0-9.-]/g, '');\n  return parseFloat(cleaned) || 0;\n}\n\n// Extract all cost components\nconst registrationFee = extractAmount(config.registrationFee);\nconst accommodationCost = extractAmount(config.accommodationCost);\nconst visaCost = extractAmount(config.visaCost);\nconst mealsCost = extractAmount(config.mealsCost);\nconst transportCost = extractAmount(config.transportCost);\n\n// Parse flight quotations and find cheapest option\nconst flight1 = extractAmount(config.flightQuote1);\nconst flight2 = extractAmount(config.flightQuote2);\nconst flight3 = extractAmount(config.flightQuote3);\n\nconst flightQuotes = [\n  { option: 'A', amount: flight1, original: config.flightQuote1 },\n  { option: 'B', amount: flight2, original: config.flightQuote2 },\n  { option: 'C', amount: flight3, original: config.flightQuote3 }\n].filter(f => f.amount > 0);\n\n// Find cheapest flight\nconst cheapestFlight = flightQuotes.reduce((min, current) => \n  current.amount < min.amount ? current : min, \n  flightQuotes[0] || { option: 'N/A', amount: 0, original: '0' }\n);\n\n// Calculate total in local currency\nconst totalLocalCurrency = \n  registrationFee + \n  cheapestFlight.amount + \n  accommodationCost + \n  visaCost + \n  mealsCost + \n  transportCost;\n\n// Get exchange rate (default to 1 if not available)\nconst exchangeRate = exchangeData?.exchangeRate || 1;\nconst baseCurrency = exchangeData?.baseCurrency || 'USD';\nconst localCurrency = exchangeData?.localCurrency || 'USD';\n\n// Convert to USD\nconst totalInUSD = totalLocalCurrency * exchangeRate;\n\n// Create detailed breakdown\nconst breakdown = {\n  registrationFee: {\n    amount: registrationFee,\n    amountUSD: registrationFee * exchangeRate,\n    original: config.registrationFee\n  },\n  flight: {\n    amount: cheapestFlight.amount,\n    amountUSD: cheapestFlight.amount * exchangeRate,\n    original: cheapestFlight.original,\n    option: cheapestFlight.option\n  },\n  accommodation: {\n    amount: accommodationCost,\n    amountUSD: accommodationCost * exchangeRate,\n    original: config.accommodationCost\n  },\n  visa: {\n    amount: visaCost,\n    amountUSD: visaCost * exchangeRate,\n    original: config.visaCost\n  },\n  meals: {\n    amount: mealsCost,\n    amountUSD: mealsCost * exchangeRate,\n    original: config.mealsCost\n  },\n  transport: {\n    amount: transportCost,\n    amountUSD: transportCost * exchangeRate,\n    original: config.transportCost\n  }\n};\n\n// Currency conversion details\nconst currencyConversion = {\n  localCurrency: localCurrency,\n  baseCurrency: baseCurrency,\n  exchangeRate: exchangeRate,\n  totalLocal: totalLocalCurrency,\n  totalUSD: totalInUSD,\n  conversionDate: exchangeData?.date || new Date().toISOString().split('T')[0]\n};\n\n// Recommended flight details\nconst recommendedFlight = {\n  option: cheapestFlight.option,\n  amount: cheapestFlight.amount,\n  amountUSD: cheapestFlight.amount * exchangeRate,\n  original: cheapestFlight.original,\n  allOptions: flightQuotes.map(f => ({\n    option: f.option,\n    amount: f.amount,\n    amountUSD: f.amount * exchangeRate,\n    original: f.original\n  }))\n};\n\nreturn {\n  json: {\n    totalExpenses: totalLocalCurrency,\n    totalInUSD: totalInUSD,\n    breakdown: breakdown,\n    recommendedFlight: recommendedFlight,\n    currencyConversion: currencyConversion,\n    // Pass through original config for downstream nodes\n    conferenceName: config.conferenceName,\n    conferenceDuration: config.conferenceDuration,\n    hostCountry: config.hostCountry,\n    fundingSource: config.fundingSource,\n    ceoEmail: config.ceoEmail,\n    yourName: config.yourName,\n    yourPosition: config.yourPosition\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "11ef4ad2-f2f5-4016-9883-d6ecb5c718f3",
      "name": "Analyser les devis de vol",
      "type": "n8n-nodes-base.code",
      "position": [
        752,
        1024
      ],
      "parameters": {
        "jsCode": "// Parse three flight quotations from configuration and extract structured data\n\nconst config = $input.first().json;\n\n// Extract flight quotation data\nconst flightQuote1 = config.flightQuote1 || '';\nconst flightQuote2 = config.flightQuote2 || '';\nconst flightQuote3 = config.flightQuote3 || '';\n\n// Helper function to parse flight quote string\n// Expected format examples:\n// \"Airline Name - $1,200 - Route: City A to City B - Duration: 8h 30m\"\n// \"Airline: XYZ Airways, Price: $850, Route: NYC-LON, Duration: 7h\"\nfunction parseFlightQuote(quoteString, quoteNumber) {\n  if (!quoteString || quoteString.includes('<__PLACEHOLDER_VALUE__')) {\n    return {\n      quoteNumber: quoteNumber,\n      airline: `[Airline ${quoteNumber}]`,\n      price: '[Price]',\n      route: '[Route]',\n      duration: '[Duration]',\n      rawQuote: quoteString\n    };\n  }\n\n  // Initialize parsed data\n  let airline = '';\n  let price = '';\n  let route = '';\n  let duration = '';\n\n  // Try to extract airline (usually at the beginning)\n  const airlineMatch = quoteString.match(/^([^-$,]+?)(?:\\s*[-:,]|\\s+\\$)/i);\n  if (airlineMatch) {\n    airline = airlineMatch[1].trim();\n  }\n\n  // Try to extract price (look for currency symbols and numbers)\n  const priceMatch = quoteString.match(/(?:price[:\\s]*)?([\\$£€¥]?\\s*[\\d,]+(?:\\.\\d{2})?(?:\\s*[A-Z]{3})?)/i);\n  if (priceMatch) {\n    price = priceMatch[1].trim();\n  }\n\n  // Try to extract route\n  const routeMatch = quoteString.match(/route[:\\s]*([^-,]+?)(?:\\s*[-,]|\\s+duration|$)/i);\n  if (routeMatch) {\n    route = routeMatch[1].trim();\n  } else {\n    // Alternative: look for city codes or \"to\" pattern\n    const routeAltMatch = quoteString.match(/([A-Z]{3}\\s*-\\s*[A-Z]{3}|[A-Za-z\\s]+\\s+to\\s+[A-Za-z\\s]+)/i);\n    if (routeAltMatch) {\n      route = routeAltMatch[1].trim();\n    }\n  }\n\n  // Try to extract duration\n  const durationMatch = quoteString.match(/duration[:\\s]*([\\d]+h?\\s*[\\d]*m?|[\\d]+:[\\d]+)/i);\n  if (durationMatch) {\n    duration = durationMatch[1].trim();\n  } else {\n    // Alternative: look for time patterns\n    const durationAltMatch = quoteString.match(/([\\d]+h\\s*[\\d]*m?|[\\d]+:[\\d]+)/i);\n    if (durationAltMatch) {\n      duration = durationAltMatch[1].trim();\n    }\n  }\n\n  return {\n    quoteNumber: quoteNumber,\n    airline: airline || `[Airline ${quoteNumber}]`,\n    price: price || '[Price]',\n    route: route || '[Route]',\n    duration: duration || '[Duration]',\n    rawQuote: quoteString\n  };\n}\n\n// Parse all three flight quotes\nconst parsedQuotes = [\n  parseFlightQuote(flightQuote1, 1),\n  parseFlightQuote(flightQuote2, 2),\n  parseFlightQuote(flightQuote3, 3)\n];\n\n// Return structured data for each quote as separate items\nreturn parsedQuotes.map(quote => ({\n  json: quote\n}));"
      },
      "typeVersion": 2
    },
    {
      "id": "b49ca159-d67e-4616-8471-4d2117e63c09",
      "name": "Vérifier l'approbation budgétaire",
      "type": "n8n-nodes-base.if",
      "position": [
        1616,
        896
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "id-1",
              "operator": {
                "type": "number",
                "operation": "lte"
              },
              "leftValue": "={{ $('Calculate Total Expenses').item.json.totalExpenses }}",
              "rightValue": "={{ $('Workflow Configuration').item.json.budgetLimit }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1e851a62-a2c5-4705-9475-4b94884cbb7b",
      "name": "Formater l'email d'approbation",
      "type": "n8n-nodes-base.set",
      "position": [
        1808,
        800
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "approvalStatus",
              "type": "string",
              "value": "WITHIN BUDGET - APPROVED"
            },
            {
              "id": "id-2",
              "name": "budgetNote",
              "type": "string",
              "value": "Total expenses are within the approved budget limit"
            },
            {
              "id": "id-3",
              "name": "emailPriority",
              "type": "string",
              "value": "normal"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "ec6721fd-ce14-4f23-87b9-ffc261936041",
      "name": "Formater l'avertissement budgétaire",
      "type": "n8n-nodes-base.set",
      "position": [
        1808,
        992
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "approvalStatus",
              "type": "string",
              "value": "EXCEEDS BUDGET - REQUIRES SPECIAL APPROVAL"
            },
            {
              "id": "id-2",
              "name": "budgetNote",
              "type": "string",
              "value": "WARNING: Total expenses exceed the standard budget limit. Additional justification required."
            },
            {
              "id": "id-3",
              "name": "emailPriority",
              "type": "string",
              "value": "high"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "5132d897-9b2a-41a0-9e29-b369d5088781",
      "name": "Fusionner les versions d'email",
      "type": "n8n-nodes-base.merge",
      "position": [
        2000,
        896
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2
    },
    {
      "id": "cabe15e3-2646-421d-85d8-d6e93df6f5bc",
      "name": "Agréger les options de vol",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1072,
        1168
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "7cc4cbaa-1633-4979-a806-970facd09c5e",
      "name": "Envoyer l'email au PDG",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2320,
        896
      ],
      "webhookId": "ab5e44b5-36d9-4b92-aac6-e0faf24fe1f3",
      "parameters": {
        "sendTo": "={{ $('Workflow Configuration').item.json.ceoEmail }}",
        "message": "={{ $json.emailDraft }}",
        "options": {},
        "subject": "={{ $json.subject }} - {{ $json.approvalStatus }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "u1N5nBDvQ0AWhNnV",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "398626ee-0684-4f84-807b-cff1e9549649",
      "name": "Enregistrer dans le suivi des dépenses",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2480,
        896
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $now.toFormat('yyyy-MM-dd') }}",
            "Email Sent": "Yes",
            "Host Country": "={{ $('AI Email Composer Agent').item.json.hostCountry }}",
            "Employee Name": "={{ $('AI Email Composer Agent').item.json.employeeName }}",
            "Total Expenses": "={{ $('Calculate Total Expenses').item.json.totalExpenses }}",
            "Approval Status": "Pending",
            "Conference Name": "={{ $('AI Email Composer Agent').item.json.conferenceName }}"
          },
          "schema": [
            {
              "id": "Date",
              "type": "string",
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Employee Name",
              "type": "string",
              "required": false,
              "displayName": "Employee Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Conference Name",
              "type": "string",
              "required": false,
              "displayName": "Conference Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Host Country",
              "type": "string",
              "required": false,
              "displayName": "Host Country",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Total Expenses",
              "type": "string",
              "required": false,
              "displayName": "Total Expenses",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Approval Status",
              "type": "string",
              "required": false,
              "displayName": "Approval Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email Sent",
              "type": "string",
              "required": false,
              "displayName": "Email Sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Date",
            "Employee Name",
            "Conference Name",
            "Host Country",
            "Total Expenses",
            "Approval Status",
            "Email Sent"
          ]
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Conference Requests"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "<__PLACEHOLDER_VALUE__Google Sheets document ID__>"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "hQFe8XTqJEiHL03Z",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "0a7135cb-ce36-4563-a1c0-79b07d3c69ac",
      "name": "Générer la pièce jointe PDF",
      "type": "n8n-nodes-base.code",
      "position": [
        2160,
        896
      ],
      "parameters": {
        "jsCode": "// Generate comprehensive PDF-ready HTML document for CEO conference approval request\n\nconst input = $input.first().json;\n\n// Extract data from previous nodes\nconst emailDraft = input.emailDraft || '';\nconst conferenceName = input.conferenceName || '[Conference Name]';\nconst conferenceDuration = input.conferenceDuration || '[Conference Duration]';\nconst hostCountry = input.hostCountry || '[Host Country]';\nconst fundingSource = input.fundingSource || '[Funding Source]';\nconst employeeName = input.employeeName || '[Employee Name]';\nconst employeePosition = input.employeePosition || '[Employee Position]';\n\n// Extract expense data\nconst registrationFee = input.registrationFee || '[Registration Fee]';\nconst flightQuote1 = input.flightQuote1 || '[Flight Quote 1]';\nconst flightQuote2 = input.flightQuote2 || '[Flight Quote 2]';\nconst flightQuote3 = input.flightQuote3 || '[Flight Quote 3]';\nconst accommodationCost = input.accommodationCost || '[Accommodation Cost]';\nconst visaCost = input.visaCost || '[Visa Cost]';\nconst mealsCost = input.mealsCost || '[Meals Cost]';\nconst transportCost = input.transportCost || '[Transport Cost]';\nconst totalExpenses = input.totalExpenses || '[Total Expenses]';\nconst approvalStatus = input.approvalStatus || 'Pending Review';\n\n// Generate current date\nconst currentDate = new Date().toLocaleDateString('en-US', { \n  year: 'numeric', \n  month: 'long', \n  day: 'numeric' \n});\n\n// Build comprehensive PDF-ready HTML document\nconst pdfHtml = `\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Conference Approval Request - ${conferenceName}</title>\n    <style>\n        * {\n            margin: 0;\n            padding: 0;\n            box-sizing: border-box;\n        }\n        \n        body {\n            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n            line-height: 1.6;\n            color: #333;\n            background: #fff;\n            padding: 40px;\n            max-width: 1200px;\n            margin: 0 auto;\n        }\n        \n        .header {\n            border-bottom: 4px solid #2c3e50;\n            padding-bottom: 20px;\n            margin-bottom: 30px;\n        }\n        \n        .header h1 {\n            color: #2c3e50;\n            font-size: 28px;\n            margin-bottom: 10px;\n        }\n        \n        .header .meta {\n            color: #7f8c8d;\n            font-size: 14px;\n        }\n        \n        .section {\n            margin-bottom: 30px;\n            page-break-inside: avoid;\n        }\n        \n        .section-title {\n            background: #34495e;\n            color: white;\n            padding: 12px 20px;\n            font-size: 18px;\n            font-weight: bold;\n            margin-bottom: 15px;\n            border-radius: 4px;\n        }\n        \n        .info-grid {\n            display: grid;\n            grid-template-columns: 1fr 1fr;\n            gap: 15px;\n            margin-bottom: 20px;\n        }\n        \n        .info-item {\n            background: #ecf0f1;\n            padding: 15px;\n            border-radius: 4px;\n            border-left: 4px solid #3498db;\n        }\n        \n        .info-item label {\n            font-weight: bold;\n            color: #2c3e50;\n            display: block;\n            margin-bottom: 5px;\n            font-size: 12px;\n            text-transform: uppercase;\n        }\n        \n        .info-item .value {\n            color: #34495e;\n            font-size: 16px;\n        }\n        \n        table {\n            width: 100%;\n            border-collapse: collapse;\n            margin-bottom: 20px;\n            box-shadow: 0 2px 4px rgba(0,0,0,0.1);\n        }\n        \n        table thead {\n            background: #2c3e50;\n            color: white;\n        }\n        \n        table th {\n            padding: 12px;\n            text-align: left;\n            font-weight: bold;\n            font-size: 14px;\n        }\n        \n        table td {\n            padding: 12px;\n            border-bottom: 1px solid #ecf0f1;\n        }\n        \n        table tbody tr:nth-child(even) {\n            background: #f8f9fa;\n        }\n        \n        table tbody tr:hover {\n            background: #e8f4f8;\n        }\n        \n        .total-row {\n            background: #3498db !important;\n            color: white;\n            font-weight: bold;\n            font-size: 16px;\n        }\n        \n        .flight-comparison {\n            display: grid;\n            grid-template-columns: repeat(3, 1fr);\n            gap: 15px;\n            margin-bottom: 20px;\n        }\n        \n        .flight-option {\n            background: #fff;\n            border: 2px solid #ecf0f1;\n            border-radius: 8px;\n            padding: 15px;\n            text-align: center;\n            transition: all 0.3s;\n        }\n        \n        .flight-option:hover {\n            border-color: #3498db;\n            box-shadow: 0 4px 8px rgba(52, 152, 219, 0.2);\n        }\n        \n        .flight-option .option-label {\n            background: #3498db;\n            color: white;\n            padding: 8px;\n            border-radius: 4px;\n            font-weight: bold;\n            margin-bottom: 10px;\n        }\n        \n        .flight-option .price {\n            font-size: 24px;\n            color: #2c3e50;\n            font-weight: bold;\n            margin: 10px 0;\n        }\n        \n        .checklist {\n            background: #fff;\n            border: 1px solid #ecf0f1;\n            border-radius: 4px;\n            padding: 20px;\n        }\n        \n        .checklist-item {\n            padding: 12px;\n            border-bottom: 1px solid #ecf0f1;\n            display: flex;\n            align-items: flex-start;\n        }\n        \n        .checklist-item:last-child {\n            border-bottom: none;\n        }\n        \n        .checklist-item .checkbox {\n            width: 20px;\n            height: 20px;\n            border: 2px solid #3498db;\n            border-radius: 3px;\n            margin-right: 15px;\n            flex-shrink: 0;\n            margin-top: 2px;\n        }\n        \n        .checklist-item .text {\n            flex: 1;\n        }\n        \n        .checklist-item .text strong {\n            color: #2c3e50;\n            display: block;\n            margin-bottom: 5px;\n        }\n        \n        .checklist-item .text ul {\n            margin-left: 20px;\n            margin-top: 5px;\n        }\n        \n        .checklist-item .text li {\n            color: #7f8c8d;\n            font-size: 14px;\n            margin-bottom: 3px;\n        }\n        \n        .approval-status {\n            background: #f39c12;\n            color: white;\n            padding: 20px;\n            border-radius: 8px;\n            text-align: center;\n            font-size: 20px;\n            font-weight: bold;\n            margin-bottom: 20px;\n        }\n        \n        .approval-status.approved {\n            background: #27ae60;\n        }\n        \n        .approval-status.rejected {\n            background: #e74c3c;\n        }\n        \n        .footer {\n            margin-top: 40px;\n            padding-top: 20px;\n            border-top: 2px solid #ecf0f1;\n            text-align: center;\n            color: #7f8c8d;\n            font-size: 12px;\n        }\n        \n        .signature-section {\n            margin-top: 40px;\n            padding: 20px;\n            background: #f8f9fa;\n            border-radius: 4px;\n        }\n        \n        .signature-line {\n            margin-top: 50px;\n            border-top: 2px solid #2c3e50;\n            padding-top: 10px;\n            display: inline-block;\n            min-width: 300px;\n        }\n        \n        @media print {\n            body {\n                padding: 20px;\n            }\n            \n            .section {\n                page-break-inside: avoid;\n            }\n        }\n    </style>\n</head>\n<body>\n    <div class=\"header\">\n        <h1>Conference Attendance Approval Request</h1>\n        <div class=\"meta\">\n            <strong>Document Generated:</strong> ${currentDate} | \n            <strong>Request ID:</strong> ${Date.now()}\n        </div>\n    </div>\n    \n    <div class=\"approval-status\">\n        Status: ${approvalStatus}\n    </div>\n    \n    <div class=\"section\">\n        <div class=\"section-title\">Conference Information</div>\n        <div class=\"info-grid\">\n            <div class=\"info-item\">\n                <label>Conference Name</label>\n                <div class=\"value\">${conferenceName}</div>\n            </div>\n            <div class=\"info-item\">\n                <label>Duration</label>\n                <div class=\"value\">${conferenceDuration}</div>\n            </div>\n            <div class=\"info-item\">\n                <label>Host Country</label>\n                <div class=\"value\">${hostCountry}</div>\n            </div>\n            <div class=\"info-item\">\n                <label>Funding Source</label>\n                <div class=\"value\">${fundingSource}</div>\n            </div>\n            <div class=\"info-item\">\n                <label>Employee Name</label>\n                <div class=\"value\">${employeeName}</div>\n            </div>\n            <div class=\"info-item\">\n                <label>Position</label>\n                <div class=\"value\">${employeePosition}</div>\n            </div>\n        </div>\n    </div>\n    \n    <div class=\"section\">\n        <div class=\"section-title\">Detailed Expense Breakdown</div>\n        <table>\n            <thead>\n                <tr>\n                    <th>Expense Category</th>\n                    <th>Description</th>\n                    <th style=\"text-align: right;\">Amount</th>\n                </tr>\n            </thead>\n            <tbody>\n                <tr>\n                    <td><strong>Conference Registration</strong></td>\n                    <td>Official conference registration fee</td>\n                    <td style=\"text-align: right;\">${registrationFee}</td>\n                </tr>\n                <tr>\n                    <td><strong>Flight (Selected Option)</strong></td>\n                    <td>Airfare - see flight comparison below</td>\n                    <td style=\"text-align: right;\">${flightQuote1}</td>\n                </tr>\n                <tr>\n                    <td><strong>Accommodation</strong></td>\n                    <td>Hotel/lodging for conference duration</td>\n                    <td style=\"text-align: right;\">${accommodationCost}</td>\n                </tr>\n                <tr>\n                    <td><strong>Visa Fees</strong></td>\n                    <td>Visa application and processing fees</td>\n                    <td style=\"text-align: right;\">${visaCost}</td>\n                </tr>\n                <tr>\n                    <td><strong>Meals & Daily Expenses</strong></td>\n                    <td>Per diem for meals and incidentals</td>\n                    <td style=\"text-align: right;\">${mealsCost}</td>\n                </tr>\n                <tr>\n                    <td><strong>Local Transport</strong></td>\n                    <td>Airport transfers and local transportation</td>\n                    <td style=\"text-align: right;\">${transportCost}</td>\n                </tr>\n                <tr class=\"total-row\">\n                    <td colspan=\"2\"><strong>TOTAL ESTIMATED EXPENSES</strong></td>\n                    <td style=\"text-align: right;\"><strong>${totalExpenses}</strong></td>\n                </tr>\n            </tbody>\n        </table>\n    </div>\n    \n    <div class=\"section\">\n        <div class=\"section-title\">Flight Comparison Chart</div>\n        <div class=\"flight-comparison\">\n            <div class=\"flight-option\">\n                <div class=\"option-label\">Option A</div>\n                <div class=\"price\">${flightQuote1}</div>\n                <div>Standard routing</div>\n            </div>\n            <div class=\"flight-option\">\n                <div class=\"option-label\">Option B</div>\n                <div class=\"price\">${flightQuote2}</div>\n                <div>Alternative carrier</div>\n            </div>\n            <div class=\"flight-option\">\n                <div class=\"option-label\">Option C</div>\n                <div class=\"price\">${flightQuote3}</div>\n                <div>Budget option</div>\n            </div>\n        </div>\n    </div>\n    \n    <div class=\"section\">\n        <div class=\"section-title\">Administrative Procedures Checklist</div>\n        <div class=\"checklist\">\n            <div class=\"checklist-item\">\n                <div class=\"checkbox\"></div>\n                <div class=\"text\">\n                    <strong>1. Conference Registration</strong>\n                    <ul>\n                        <li>Request invoice from conference organizer</li>\n                        <li>Create Purchase Order (PO) if bank transfer accepted</li>\n                        <li>Submit cash claim if paid by personal credit card</li>\n                        <li>Attach registration confirmation and receipt</li>\n                    </ul>\n                </div>\n            </div>\n            <div class=\"checklist-item\">\n                <div class=\"checkbox\"></div>\n                <div class=\"text\">\n                    <strong>2. Flight Booking</strong>\n                    <ul>\n                        <li>Select optimal flight option from three quotations</li>\n                        <li>Generate PO if booking through travel agent</li>\n                        <li>Submit cash claim with all quotations if paid personally</li>\n                        <li>Include booking confirmation and e-ticket itinerary</li>\n                    </ul>\n                </div>\n            </div>\n            <div class=\"checklist-item\">\n                <div class=\"checkbox\"></div>\n                <div class=\"text\">\n                    <strong>3. Accommodation</strong>\n                    <ul>\n                        <li>Confirm costs within company policy limits</li>\n                        <li>Book conference hotel or nearby alternative</li>\n                        <li>Submit cash claim with booking confirmation</li>\n                        <li>Include itemized hotel invoice and proof of payment</li>\n                    </ul>\n                </div>\n            </div>\n            <div class=\"checklist-item\">\n                <div class=\"checkbox\"></div>\n                <div class=\"text\">\n                    <strong>4. Visa Application</strong>\n                    <ul>\n                        <li>Apply for visa as required for ${hostCountry}</li>\n                        <li>Submit cash claim for visa fees</li>\n                        <li>Include visa application receipt and approval documentation</li>\n                    </ul>\n                </div>\n            </div>\n            <div class=\"checklist-item\">\n                <div class=\"checkbox\"></div>\n                <div class=\"text\">\n                    <strong>5. Expense Reporting</strong>\n                    <ul>\n                        <li>Maintain all receipts and supporting documentation</li>\n                        <li>Submit comprehensive expense report within 5 business days of return</li>\n                        <li>Include all original receipts and this approval document</li>\n                        <li>Attach conference attendance certificate if provided</li>\n                    </ul>\n                </div>\n            </div>\n        </div>\n    </div>\n    \n    <div class=\"section\">\n        <div class=\"section-title\">Post-Conference Deliverables</div>\n        <div class=\"checklist\">\n            <div class=\"checklist-item\">\n                <div class=\"checkbox\"></div>\n                <div class=\"text\">\n                    <strong>Comprehensive Summary Report</strong>\n                    Key insights and takeaways from conference sessions\n                </div>\n            </div>\n            <div class=\"checklist-item\">\n                <div class=\"checkbox\"></div>\n                <div class=\"text\">\n                    <strong>Team Presentation</strong>\n                    Present relevant sessions and best practices to team\n                </div>\n            </div>\n            <div class=\"checklist-item\">\n                <div class=\"checkbox\"></div>\n                <div class=\"text\">\n                    <strong>Implementation Recommendations</strong>\n                    Actionable strategies applicable to our organization\n                </div>\n            </div>\n            <div class=\"checklist-item\">\n                <div class=\"checkbox\"></div>\n                <div class=\"text\">\n                    <strong>Knowledge Sharing Session</strong>\n                    Department-wide session to share learnings\n                </div>\n            </div>\n        </div>\n    </div>\n    \n    <div class=\"signature-section\">\n        <p><strong>Employee Signature:</strong></p>\n        <div class=\"signature-line\">\n            ${employeeName}, ${employeePosition}\n        </div>\n        \n        <p style=\"margin-top: 40px;\"><strong>CEO Approval:</strong></p>\n        <div class=\"signature-line\">\n            Date: _________________\n        </div>\n    </div>\n    \n    <div class=\"footer\">\n        <p>This document was automatically generated by the Conference Approval System</p>\n        <p>For questions or clarifications, please contact the Finance Department</p>\n    </div>\n</body>\n</html>\n`;\n\n// Generate PDF filename\nconst sanitizedConferenceName = conferenceName.replace(/[^a-z0-9]/gi, '_').toLowerCase();\nconst timestamp = new Date().toISOString().split('T')[0];\nconst pdfFileName = `conference_approval_${sanitizedConferenceName}_${timestamp}.pdf`;\n\nreturn {\n  json: {\n    pdfHtml: pdfHtml,\n    pdfFileName: pdfFileName,\n    attachmentReady: true,\n    emailDraft: emailDraft,\n    conferenceName: conferenceName,\n    totalExpenses: totalExpenses,\n    approvalStatus: approvalStatus,\n    generatedDate: currentDate\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "066eacb2-cded-432f-8445-eac669cea189",
      "name": "Extraire les données de devises",
      "type": "n8n-nodes-base.set",
      "position": [
        1120,
        512
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "exchangeRate",
              "type": "number",
              "value": "={{ $json.rates.USD }}"
            },
            {
              "id": "id-2",
              "name": "baseCurrency",
              "type": "string",
              "value": "={{ $json.base }}"
            },
            {
              "id": "id-3",
              "name": "lastUpdated",
              "type": "string",
              "value": "={{ $json.date }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "d4c07c73-432a-4f66-9b47-d711d7b79bbc",
      "name": "Note autocollante",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        304
      ],
      "parameters": {
        "width": 432,
        "height": 288,
        "content": "## Introduction\nAutomates overseas conference approval requests to CEO. Generates emails with conference details, flight quotes, accommodation, expense breakdown, and admin procedures. Ensures consistency and saves time.\n\n## How It Works\nManual trigger initiates: fetches exchange rates/conference details, parses flight quotes, uses AI to calculate expenses and generate draft, checks budget, formats messages, merges versions, creates PDF, sends to CEO, logs to tracker.\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6622524c-a263-4550-8632-ae8af04b5b9c",
      "name": "Agent IA de composition d'email",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1024,
        656
      ],
      "parameters": {
        "text": "You are an expert business email composer specializing in conference approval requests. Generate a comprehensive, professional email to the CEO requesting approval to attend an overseas conference. Include: 1) Conference details (name, duration, host country), 2) Funding source, 3) Detailed expense breakdown with registration fee, three flight quotations, accommodation, visa, meals, and transport costs, 4) Administrative procedures covering: registration (request invoice and create PO if bank transfer accepted, otherwise pay with personal card and submit cash claim with email approval), flights (include 3 quotes, if through travel agent generate and approve PO before booking, if direct use personal card and attach approval plus quotations), accommodation (confirm within limits, prefer conference rates, if paid personally submit cash claim with approval), 5) Post-conference deliverables. Use the input data to fill in all details. Output should include fields: emailDraft (full email text), subject, recipient, conferenceName, conferenceDuration, hostCountry, fundingSource, employeeName, employeePosition.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 3
    },
    {
      "id": "af94a729-823f-4b1d-8bdd-41f5b63038ca",
      "name": "Outil de calcul",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        1024,
        864
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ef466e89-8b96-4eac-a797-556f385df2e8",
      "name": "Outil d'analyse des dépenses",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "position": [
        1152,
        864
      ],
      "parameters": {
        "jsCode": "// Analyze expense breakdown and calculate totals, percentages, and budget compliance\n\n// Parse the input query to extract expense data\nconst expenseData = typeof query === 'string' ? JSON.parse(query) : query;\n\n// Extract expense categories\nconst categories = {\n  registrationFee: parseFloat(expenseData.registrationFee || 0),\n  flight: parseFloat(expenseData.flight || 0),\n  accommodation: parseFloat(expenseData.accommodation || 0),\n  visa: parseFloat(expenseData.visa || 0),\n  meals: parseFloat(expenseData.meals || 0),\n  transport: parseFloat(expenseData.transport || 0)\n};\n\n// Calculate total expenses\nconst totalExpenses = Object.values(categories).reduce((sum, amount) => sum + amount, 0);\n\n// Calculate percentage distribution\nconst percentageBreakdown = {};\nfor (const [category, amount] of Object.entries(categories)) {\n  percentageBreakdown[category] = totalExpenses > 0 ? ((amount / totalExpenses) * 100).toFixed(2) + '%' : '0%';\n}\n\n// Budget compliance check\nconst budgetLimit = parseFloat(expenseData.budgetLimit || 0);\nconst isWithinBudget = totalExpenses <= budgetLimit;\nconst budgetVariance = budgetLimit - totalExpenses;\nconst budgetVariancePercentage = budgetLimit > 0 ? ((budgetVariance / budgetLimit) * 100).toFixed(2) + '%' : '0%';\n\n// Generate recommendations\nconst recommendations = [];\nif (!isWithinBudget) {\n  recommendations.push('Total expenses exceed budget limit. Consider reducing costs.');\n  \n  // Identify highest expense categories\n  const sortedCategories = Object.entries(categories)\n    .sort((a, b) => b[1] - a[1])\n    .slice(0, 3);\n  \n  recommendations.push(`Highest expenses: ${sortedCategories.map(([cat, amt]) => `${cat} ($${amt})`).join(', ')}`);\n} else {\n  recommendations.push('Expenses are within budget.');\n  recommendations.push(`Budget remaining: $${budgetVariance.toFixed(2)} (${budgetVariancePercentage})`);\n}\n\n// Return structured analysis\nconst analysis = {\n  totalExpenses: totalExpenses.toFixed(2),\n  breakdown: categories,\n  percentageDistribution: percentageBreakdown,\n  budgetCompliance: {\n    budgetLimit: budgetLimit.toFixed(2),\n    isWithinBudget: isWithinBudget,\n    variance: budgetVariance.toFixed(2),\n    variancePercentage: budgetVariancePercentage\n  },\n  recommendations: recommendations\n};\n\nreturn JSON.stringify(analysis, null, 2);",
        "description": "Analyzes expense breakdown and calculates totals, percentages, and budget compliance"
      },
      "typeVersion": 1.3
    },
    {
      "id": "e9d19ed2-312a-45a9-93e9-cc32eafb1359",
      "name": "Outil de comparaison de vols",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "position": [
        1280,
        864
      ],
      "parameters": {
        "jsCode": "// Compare three flight quotations and recommend the best option\n// Input: query should contain flight quote data from the workflow\n\nconst config = $('Workflow Configuration').first().json;\n\n// Helper function to extract numeric value from string\nfunction extractAmount(value) {\n  if (typeof value === 'number') return value;\n  if (!value) return 0;\n  const cleaned = String(value).replace(/[^0-9.-]/g, '');\n  return parseFloat(cleaned) || 0;\n}\n\n// Helper function to extract duration in minutes\nfunction extractDurationMinutes(durationStr) {\n  if (!durationStr) return 0;\n  \n  // Match patterns like \"8h 30m\", \"8h\", \"30m\", \"8:30\"\n  const hoursMatch = durationStr.match(/(\\d+)\\s*h/);\n  const minutesMatch = durationStr.match(/(\\d+)\\s*m/);\n  const colonMatch = durationStr.match(/(\\d+):(\\d+)/);\n  \n  let totalMinutes = 0;\n  \n  if (colonMatch) {\n    totalMinutes = parseInt(colonMatch[1]) * 60 + parseInt(colonMatch[2]);\n  } else {\n    if (hoursMatch) totalMinutes += parseInt(hoursMatch[1]) * 60;\n    if (minutesMatch) totalMinutes += parseInt(minutesMatch[1]);\n  }\n  \n  return totalMinutes;\n}\n\n// Parse flight quotations\nconst flights = [\n  {\n    option: 'A',\n    price: extractAmount(config.flightQuote1),\n    duration: extractDurationMinutes(config.flightQuote1),\n    raw: config.flightQuote1\n  },\n  {\n    option: 'B',\n    price: extractAmount(config.flightQuote2),\n    duration: extractDurationMinutes(config.flightQuote2),\n    raw: config.flightQuote2\n  },\n  {\n    option: 'C',\n    price: extractAmount(config.flightQuote3),\n    duration: extractDurationMinutes(config.flightQuote3),\n    raw: config.flightQuote3\n  }\n].filter(f => f.price > 0);\n\nif (flights.length === 0) {\n  return 'No valid flight quotations available for comparison.';\n}\n\n// Find cheapest and fastest options\nconst cheapest = flights.reduce((min, f) => f.price < min.price ? f : min, flights[0]);\nconst fastest = flights.reduce((min, f) => f.duration < min.duration ? f : min, flights[0]);\n\n// Calculate savings\nconst maxPrice = Math.max(...flights.map(f => f.price));\nconst savings = maxPrice - cheapest.price;\nconst savingsPercent = ((savings / maxPrice) * 100).toFixed(1);\n\n// Format duration for display\nfunction formatDuration(minutes) {\n  const hours = Math.floor(minutes / 60);\n  const mins = minutes % 60;\n  return mins > 0 ? `${hours}h ${mins}m` : `${hours}h`;\n}\n\n// Build comparison table\nlet comparison = '\\n=== FLIGHT COMPARISON ===\\n\\n';\n\nflights.forEach(f => {\n  comparison += `Option ${f.option}: $${f.price.toFixed(2)} - ${formatDuration(f.duration)}`;\n  if (f.option === cheapest.option) comparison += ' ✓ CHEAPEST';\n  if (f.option === fastest.option) comparison += ' ⚡ FASTEST';\n  comparison += '\\n';\n});\n\ncomparison += `\\n--- RECOMMENDATION ---\\n`;\ncomparison += `Best Value: Option ${cheapest.option} at $${cheapest.price.toFixed(2)}\\n`;\ncomparison += `Savings: $${savings.toFixed(2)} (${savingsPercent}% less than most expensive)\\n`;\n\nif (cheapest.option === fastest.option) {\n  comparison += `\\n⭐ Option ${cheapest.option} is both the cheapest AND fastest - HIGHLY RECOMMENDED\\n`;\n} else {\n  const timeDiff = fastest.duration - cheapest.duration;\n  comparison += `\\nNote: Option ${fastest.option} is ${formatDuration(Math.abs(timeDiff))} faster but costs $${(fastest.price - cheapest.price).toFixed(2)} more.\\n`;\n}\n\nreturn comparison;",
        "description": "Compares three flight quotations and recommends the best option based on price, duration, and value"
      },
      "typeVersion": 1.3
    },
    {
      "id": "8f22dc11-0b4d-4efe-b3c3-45a8b219ddc0",
      "name": "Modèle de chat OpenRouter",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        896,
        832
      ],
      "parameters": {
        "model": "tngtech/deepseek-r1t-chimera:free",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "fKnn6LL7cRFqNHDX",
          "name": "OpenRouter account2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e5599b51-e9a4-432e-87cc-0f139c495c64",
      "name": "Note autocollante 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2000,
        304
      ],
      "parameters": {
        "color": 4,
        "width": 544,
        "height": 496,
        "content": "## Prerequisites\nn8n instance, Currency API, Conference API, OpenAI GPT-4 key, Gmail with OAuth, Google Sheets, PDF generator, Travel agent API\n\n## Use Cases\n**Academic:** Staff requests conference with grant, registration, 3 quotes, hotel, visa. AI generates email with PO/card procedures. **Sales:** Manager seeks client meeting approval with comparisons, per diem. **Training:** Employee requests certification with fees, accommodation, transport.\n\n## Customization\nModify thresholds by department. Add categories (insurance, baggage). Customize AI prompts for tone/branding. Integrate flight sources. Extend approval chain. Add travel restrictions.  \n\n## Benefits\n**Time Efficient:** Reduces prep from 60+ to 5 minutes. **AI-Powered:** Intelligent analysis and generation. **Consistent:** Ensures completeness. **Accurate:** Eliminates errors. "
      },
      "typeVersion": 1
    },
    {
      "id": "4f076598-cc6b-4642-aca6-2dadf1d03da7",
      "name": "Note autocollante 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1376,
        304
      ],
      "parameters": {
        "color": 6,
        "width": 608,
        "height": 480,
        "content": "## Workflow Steps\n1. **Initialization:** Manual trigger with conference parameters, sets variables (name, dates, location, funding)\n2. **Data Collection:** Fetches/parses exchange rates, conference details via HTTP, aggregates 3 flight quotations\n3. **AI Processing:** AI Agent orchestrates GPT-4 with Calculate, Extract, Generate tools for expense analysis and email drafting\n4. **Validation:** Calculates total expenses, validates against budget threshold\n5. **Formatting:** Customizes approval/warning messages by status, merges content versions\n6. **Delivery:** Generates PDF breakdown, dispatches via Gmail to CEO, logs to Google Sheets tracker\n\n## Setup Instructions\n1. **APIs:** Configure currency/conference endpoints with credentials\n2. **OpenAI:** Add GPT-4 API key in AI Agent\n3. **AI Tools:** Set Calculate, Extract, Generate parameters\n4. **Gmail:** Connect account, set CEO recipient\n5. **Sheets:** Link tracker with write permissions\n6. **Budget:** Set threshold (default: $5000)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6fda8224-afd3-43fd-9fea-05e5ebeeae89",
      "name": "Note autocollante 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        304
      ],
      "parameters": {
        "color": 2,
        "width": 448,
        "content": "## Workflow Template\nManual Trigger → Configuration → [Exchange Rates + Conference Details + Flight Quotes] → AI Agent → [GPT-4 + Calculate + Extract + Generate Tools] → Total Expenses → Budget Check → [Format Approved + Warning] → Merge → PDF → Send CEO → Log Tracker\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f7945aad-2194-42f9-8600-203d6e3aead9",
  "connections": {
    "0d8d20d1-ebfd-48d5-a0f7-69df51d4dd87": {
      "main": [
        [
          {
            "node": "ef08d98d-ba47-4d3f-acdf-c6940156c21e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "af94a729-823f-4b1d-8bdd-41f5b63038ca": {
      "ai_tool": [
        [
          {
            "node": "6622524c-a263-4550-8632-ae8af04b5b9c",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "7cc4cbaa-1633-4979-a806-970facd09c5e": {
      "main": [
        [
          {
            "node": "398626ee-0684-4f84-807b-cff1e9549649",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "11ef4ad2-f2f5-4016-9883-d6ecb5c718f3": {
      "main": [
        [
          {
            "node": "cabe15e3-2646-421d-85d8-d6e93df6f5bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "03741e53-ce18-43ac-9aab-041b53a30f2e": {
      "main": [
        [
          {
            "node": "066eacb2-cded-432f-8445-eac669cea189",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5132d897-9b2a-41a0-9e29-b369d5088781": {
      "main": [
        [
          {
            "node": "0a7135cb-ce36-4563-a1c0-79b07d3c69ac",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b49ca159-d67e-4616-8471-4d2117e63c09": {
      "main": [
        [
          {
            "node": "1e851a62-a2c5-4705-9475-4b94884cbb7b",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ec6721fd-ce14-4f23-87b9-ffc261936041",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ef466e89-8b96-4eac-a797-556f385df2e8": {
      "ai_tool": [
        [
          {
            "node": "6622524c-a263-4550-8632-ae8af04b5b9c",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "066eacb2-cded-432f-8445-eac669cea189": {
      "main": [
        [
          {
            "node": "0cf985e3-08ef-4005-b746-fe3a5ffd914f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1e851a62-a2c5-4705-9475-4b94884cbb7b": {
      "main": [
        [
          {
            "node": "5132d897-9b2a-41a0-9e29-b369d5088781",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ec6721fd-ce14-4f23-87b9-ffc261936041": {
      "main": [
        [
          {
            "node": "5132d897-9b2a-41a0-9e29-b369d5088781",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8f22dc11-0b4d-4efe-b3c3-45a8b219ddc0": {
      "ai_languageModel": [
        [
          {
            "node": "6622524c-a263-4550-8632-ae8af04b5b9c",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "e9d19ed2-312a-45a9-93e9-cc32eafb1359": {
      "ai_tool": [
        [
          {
            "node": "6622524c-a263-4550-8632-ae8af04b5b9c",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "f61e2b68-430a-40aa-94a7-73f8963a14bc": {
      "main": [
        [
          {
            "node": "0cf985e3-08ef-4005-b746-fe3a5ffd914f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ef08d98d-ba47-4d3f-acdf-c6940156c21e": {
      "main": [
        [
          {
            "node": "03741e53-ce18-43ac-9aab-041b53a30f2e",
            "type": "main",
            "index": 0
          },
          {
            "node": "f61e2b68-430a-40aa-94a7-73f8963a14bc",
            "type": "main",
            "index": 0
          },
          {
            "node": "11ef4ad2-f2f5-4016-9883-d6ecb5c718f3",
            "type": "main",
            "index": 0
          },
          {
            "node": "6622524c-a263-4550-8632-ae8af04b5b9c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6622524c-a263-4550-8632-ae8af04b5b9c": {
      "main": [
        [
          {
            "node": "0cf985e3-08ef-4005-b746-fe3a5ffd914f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0a7135cb-ce36-4563-a1c0-79b07d3c69ac": {
      "main": [
        [
          {
            "node": "7cc4cbaa-1633-4979-a806-970facd09c5e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cabe15e3-2646-421d-85d8-d6e93df6f5bc": {
      "main": [
        [
          {
            "node": "0cf985e3-08ef-4005-b746-fe3a5ffd914f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0cf985e3-08ef-4005-b746-fe3a5ffd914f": {
      "main": [
        [
          {
            "node": "b49ca159-d67e-4616-8471-4d2117e63c09",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - Extraction de documents, IA Multimodale

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds24
Catégorie2
Types de nœuds14
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Auteur
Cheng Siong Chin

Cheng Siong Chin

@cschin

Dr. Cheng Siong CHIN serves as a Professor in Intelligent Systems Modelling and Simulation in Newcastle University, Singapore. His academic credentials include an M.Sc. in Advanced Control and Systems Engineering from The University of Manchester and a Ph.D. in Robotics from Nanyang Technological University.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34