🤖🚚 KI-Agent zur Verwaltung von Transportaufträgen basierend auf GPT-4o und Open Route API

Experte

Dies ist ein AI, IT Ops-Bereich Automatisierungsworkflow mit 26 Nodes. Hauptsächlich werden Set, Wait, Gmail, HttpRequest, GmailTrigger und andere Nodes verwendet, kombiniert mit KI-Technologie für intelligente Automatisierung. 🤖🚚 KI-Agent zur Verwaltung von Transportaufträgen basierend auf GPT-4o und Open Route API

Voraussetzungen
  • Google-Konto + Gmail API-Anmeldedaten
  • Möglicherweise sind Ziel-API-Anmeldedaten erforderlich
  • Google Sheets API-Anmeldedaten
  • OpenAI API Key
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "meta": {
    "instanceId": ""
  },
  "nodes": [
    {
      "id": "f24429ab-1276-4655-a3ef-1fbbb6d80602",
      "name": "Gmail-Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        20,
        400
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {
          "downloadAttachments": false
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "62ced604-4de3-4a6d-bbfe-b1c2f985117f",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        560,
        560
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"shipment_number\": \"15487-PLO\",\n  \"pickup_location\": \"Centre de Distribution Leclerc\",\n  \"pickup_address\": \"77 Rue Albert Garry, 94450 Limeil-Brévannes\",\n  \"expected_pickup_time\": \"24-09-2024, 09:00:00\",\n  \"temperature_control\": \"Chilled\",\n  \"quantity\": \"12 pallets\",\n  \"destination_store_name\": \"E.Leclerc Store 124\",\n  \"destination_address\": \"43-45 Quai Jules Guesde, 94405 Vitry-sur-Seine\",\n  \"expected_delivery_time\": \"24-09-2024, 18:00:00\",\n  \"sender_name\":\"Jacques Chirac\",\n  \"sender_company\": \"RPR\"\n}\n\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "767ee78a-d0ff-4399-bea1-4310aff116f7",
      "name": "KI-Agent Parser",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        320,
        400
      ],
      "parameters": {
        "text": "=Here is an email from a customer requesting a shipment:\n\nSubject: {{ $json.subject }}\nBody: {{ $json.text }}\n\nPlease extract all the structured logistics data based on the format provided.",
        "options": {
          "systemMessage": "=You are a logistics assistant for a transportation company. \n\nYour job is to extract all structured data from shipping request emails sent by customers (typically retail chains like E.Leclerc). These emails contain information about the sender, shipment pickup and delivery details.\n\nReturn the result as a JSON object with the following fields:\n\n{\n  \"shipment_number\": \"\",\n  \"pickup_location\": \"\",\n  \"pickup_address\": \"\",\n  \"expected_pickup_time\": \"\",\n  \"temperature_control\": \"\",\n  \"quantity\": \"\",\n  \"destination_store_name\": \"\",\n  \"destination_address\": \"\",\n  \"expected_delivery_time\": \"\",\n  \"sender_name\": \"\",\n  \"sender_company\": \"\"\n}\n\nOnly include values mentioned explicitly in the email. Do not infer or guess. If a field is missing, set its value to `null`.\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.9
    },
    {
      "id": "8a0c7eb8-322b-47c1-8547-2afe0370f3fc",
      "name": "E-Mail-Inhalt erfassen",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        820,
        440
      ],
      "parameters": {
        "columns": {
          "value": {
            "pickup_address": "={{ $json.output.pickup_address }}",
            "pickup_location": "={{ $json.output.pickup_location }}",
            "shipment_number": "={{ $json.output.shipment_number }}",
            "destination_address": "={{ $json.output.destination_address }}",
            "temperature_control": "={{ $json.output.temperature_control }}",
            "expected_pickup_time": "={{ $json.output.expected_pickup_time }}",
            "destination_store_name": "={{ $json.output.destination_store_name }}",
            "expected_delivery_time": "={{ $json.output.expected_delivery_time}}"
          },
          "schema": [
            {
              "id": "shipment_number",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "shipment_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_location",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "pickup_location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "pickup_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_longitude",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "pickup_longitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_latitude",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "pickup_latitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "expected_pickup_time",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "expected_pickup_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "temperature_control",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "temperature_control",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_store_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "destination_store_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "destination_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_longitude",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "destination_longitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_latitude",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "destination_latitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "expected_delivery_time",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "expected_delivery_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "driving_distance",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "driving_distance",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "driving_time",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "driving_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "shipment_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Orders"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "",
          "cachedResultName": "Transportation Orders"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.6
    },
    {
      "id": "b2c5c252-c464-4094-93c0-9c94ccd82b14",
      "name": "Adressen sammeln",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        820,
        640
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.output.shipment_number }}",
              "lookupColumn": "shipment_number"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Orders"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "",
          "cachedResultName": "Transportation Orders"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "ePnaAS4PG1sN2E50",
          "name": "Google Sheets LogiGreenBot"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.6
    },
    {
      "id": "840698a1-2f87-43d1-a6d3-27a107d4038b",
      "name": "5 Sekunden",
      "type": "n8n-nodes-base.wait",
      "position": [
        1700,
        540
      ],
      "webhookId": "6ecebf96-14ed-4c7b-b467-eb48c143408e",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "82cc284e-14a4-45de-a463-511e2a70e182",
      "name": "Query Open Route API Pickup",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1040,
        540
      ],
      "parameters": {
        "url": "https://api.openrouteservice.org/geocode/search",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "api_key"
            },
            {
              "name": "text",
              "value": "={{ $json.pickup_address }}"
            },
            {
              "name": "boundary.country",
              "value": "=FR"
            },
            {
              "name": "sources",
              "value": "openstreetmap"
            },
            {
              "name": "size",
              "value": "1"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json; charset=utf-8"
            },
            {
              "name": "Accept",
              "value": "application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.2
    },
    {
      "id": "ba4f843c-f922-486d-944c-d9ea6655ccda",
      "name": "Pickup-GPS speichern",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1480,
        540
      ],
      "parameters": {
        "columns": {
          "value": {
            "pickup_latitude": "={{ $json.latitude }}",
            "shipment_number": "={{ $('AI Agent Parser').item.json.output.shipment_number }}",
            "pickup_longitude": "={{ $json.longitude }}"
          },
          "schema": [
            {
              "id": "shipment_number",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "shipment_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_location",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickup_location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickup_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_longitude",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "pickup_longitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_latitude",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "pickup_latitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "expected_pickup_time",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "expected_pickup_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "temperature_control",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "temperature_control",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_store_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "destination_store_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "destination_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_longitude",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "destination_longitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_latitude",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "destination_latitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "expected_delivery_time",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "expected_delivery_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "driving_distance",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "driving_distance",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "driving_time",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "driving_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "shipment_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Orders"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "",
          "cachedResultName": "Transportation Orders"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.6
    },
    {
      "id": "e87c8abb-34b4-41c2-8c4a-139248d41a20",
      "name": "GPS Pickup",
      "type": "n8n-nodes-base.set",
      "position": [
        1260,
        540
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e4c92077-f294-4e49-8276-20d1441c0c2c",
              "name": "longitude",
              "type": "string",
              "value": "={{ $json.features[0].geometry.coordinates[0] }}"
            },
            {
              "id": "899e5304-e7a1-4ce1-bf9a-f403d74934fb",
              "name": "latitude",
              "type": "string",
              "value": "={{ $json.features[0].geometry.coordinates[1] }}"
            },
            {
              "id": "5b35642b-dda4-42b8-b7bb-1275616bfb59",
              "name": "borough",
              "type": "string",
              "value": "={{ $json.features[0].properties.borough }}"
            },
            {
              "id": "aa74bd9a-f543-48e1-a69b-0e6472bda053",
              "name": "neighbourhood",
              "type": "string",
              "value": "={{ $json.features[0].properties.neighbourhood }}"
            },
            {
              "id": "7f303dc8-4e28-4d46-8e3e-9db00dbcac3a",
              "name": "localadmin",
              "type": "string",
              "value": "={{ $json.features[0].properties.localadmin }}"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "556c1a60-e086-47a2-bafe-2aa3646c7846",
      "name": "Query Open Route API Delivery",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1040,
        740
      ],
      "parameters": {
        "url": "https://api.openrouteservice.org/geocode/search",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "api_key"
            },
            {
              "name": "text",
              "value": "={{ $json.destination_address }}"
            },
            {
              "name": "boundary.country",
              "value": "=FR"
            },
            {
              "name": "sources",
              "value": "openstreetmap"
            },
            {
              "name": "size",
              "value": "1"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json; charset=utf-8"
            },
            {
              "name": "Accept",
              "value": "application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.2
    },
    {
      "id": "dd81a2cb-fe60-4e3c-95c7-08b89b111ad8",
      "name": "GPS Delivery",
      "type": "n8n-nodes-base.set",
      "position": [
        1260,
        740
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e4c92077-f294-4e49-8276-20d1441c0c2c",
              "name": "longitude",
              "type": "string",
              "value": "={{ $json.features[0].geometry.coordinates[0] }}"
            },
            {
              "id": "899e5304-e7a1-4ce1-bf9a-f403d74934fb",
              "name": "latitude",
              "type": "string",
              "value": "={{ $json.features[0].geometry.coordinates[1] }}"
            },
            {
              "id": "5b35642b-dda4-42b8-b7bb-1275616bfb59",
              "name": "borough",
              "type": "string",
              "value": "={{ $json.features[0].properties.borough }}"
            },
            {
              "id": "aa74bd9a-f543-48e1-a69b-0e6472bda053",
              "name": "neighbourhood",
              "type": "string",
              "value": "={{ $json.features[0].properties.neighbourhood }}"
            },
            {
              "id": "7f303dc8-4e28-4d46-8e3e-9db00dbcac3a",
              "name": "localadmin",
              "type": "string",
              "value": "={{ $json.features[0].properties.localadmin }}"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "652c3a8f-9e47-4386-a932-be99a94e72bd",
      "name": "Delivery-GPS speichern",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1480,
        740
      ],
      "parameters": {
        "columns": {
          "value": {
            "shipment_number": "={{ $('AI Agent Parser').item.json.output.shipment_number }}",
            "destination_latitude": "={{ $json.latitude }}",
            "destination_longitude": "={{ $json.longitude }}"
          },
          "schema": [
            {
              "id": "shipment_number",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "shipment_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_location",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickup_location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickup_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_longitude",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickup_longitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_latitude",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickup_latitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "expected_pickup_time",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "expected_pickup_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "temperature_control",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "temperature_control",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_store_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "destination_store_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "destination_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_longitude",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "destination_longitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_latitude",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "destination_latitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "expected_delivery_time",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "expected_delivery_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "driving_distance",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "driving_distance",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "driving_time",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "driving_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "shipment_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Orders"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "",
          "cachedResultName": "Transportation Orders"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.6
    },
    {
      "id": "0d31ad24-c3b3-42bb-b98a-ad443005341a",
      "name": "Koordinaten sammeln",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        820,
        940
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.output.shipment_number }}",
              "lookupColumn": "shipment_number"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Orders"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "",
          "cachedResultName": "Transportation Orders"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "ePnaAS4PG1sN2E50",
          "name": "Google Sheets LogiGreenBot"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.6
    },
    {
      "id": "f813ecde-ea6e-4780-9bae-2be7e171419d",
      "name": "Request Open Route API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1040,
        940
      ],
      "parameters": {
        "url": "https://api.openrouteservice.org/v2/directions/driving-hgv",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        },
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "api_key"
            },
            {
              "name": "start",
              "value": "={{ $json.pickup_longitude }}, {{ $json.pickup_latitude }}"
            },
            {
              "name": "end",
              "value": "={{ $json.destination_longitude }}, {{ $json.destination_latitude }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json; charset=utf-8"
            },
            {
              "name": "Accept",
              "value": "application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.2
    },
    {
      "id": "f9fb4321-398f-439e-832a-531245cad968",
      "name": "Ergebnisse speichern",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1480,
        940
      ],
      "parameters": {
        "columns": {
          "value": {
            "driving_time": "={{ $json.duration }}",
            "shipment_number": "={{ $('AI Agent Parser').item.json.output.shipment_number }}",
            "driving_distance": "={{ $json.distance }}"
          },
          "schema": [
            {
              "id": "shipment_number",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "shipment_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_location",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickup_location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickup_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_longitude",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickup_longitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_latitude",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickup_latitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "expected_pickup_time",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "expected_pickup_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "temperature_control",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "temperature_control",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_store_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "destination_store_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "destination_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_longitude",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "destination_longitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_latitude",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "destination_latitude",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "expected_delivery_time",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "expected_delivery_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "driving_distance",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "driving_distance",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "driving_time",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "driving_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "shipment_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Orders"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "17wbroY0w6xmw8AT-p2c_n1WbHzmfesz6d1DJbp39fn8",
          "cachedResultUrl": "",
          "cachedResultName": "Transportation Orders"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "ePnaAS4PG1sN2E50",
          "name": "Google Sheets LogiGreenBot"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.6
    },
    {
      "id": "ac878430-fe68-42ee-9b0b-20ad9a245d9b",
      "name": "Sendungsinformationen sammeln",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        800,
        1520
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.output.shipment_number }}",
              "lookupColumn": "shipment_number"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Orders"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "",
          "cachedResultName": "Transportation Orders"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.6
    },
    {
      "id": "21631974-c8a7-4b0c-a19b-3edcf2682200",
      "name": "Fahrzeit & Entfernung",
      "type": "n8n-nodes-base.set",
      "position": [
        1260,
        940
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4d0acd1a-c049-4353-9fb7-8eb08c138b9c",
              "name": "distance",
              "type": "string",
              "value": "={{ ($json.features[0].properties.segments[0].distance.round()/1000).toFixed(2) }}"
            },
            {
              "id": "2a6ff46a-f620-4dad-a60a-018b8add76d5",
              "name": "duration",
              "type": "string",
              "value": "={{ ($json.features[0].properties.segments[0].duration/60).toFixed(2) }}"
            },
            {
              "id": "de20932f-4eb5-4372-ad6d-64679df104cb",
              "name": "n_steps",
              "type": "number",
              "value": "={{ $json.features[0].properties.segments[0].steps.length }}"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "aad7e5f3-5eae-4be1-beb5-e57f7723086f",
      "name": "OpenAI-Chat-Modell",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        940,
        1660
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "a73dfa1c-4f4e-4cab-950d-91021fc28c5d",
      "name": "KI-Agent-Antwort",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1000,
        1520
      ],
      "parameters": {
        "text": "=Here is the output:\n\n- Shipment Number: {{ $json.shipment_number }}\n- Pickup Location: {{ $json.pickup_location }}\n- Pickup Address: {{ $json.pickup_address }}  \n- Expected Pickup Time: {{ $json.expected_pickup_time }}  \n- Temperature Control: {{ $json.temperature_control }}  \n- Destination: {{ $json.destination_store_name }} \n- Destination Address: {{ $json.destination_address }}\n- Expected Delivery Time: {{ $json.expected_delivery_time }} \n- Driving Distance: {{ $json.driving_distance }} km\n- Estimated Transit Time: {{ $json.driving_time }} min\n- Contact Name: {{ $('AI Agent Parser').item.json.output.sender_name }}\n- Contact Company: {{ $('AI Agent Parser').item.json.output.sender_company }}\n",
        "options": {
          "systemMessage": "=You are a logistics assistant working for a transportation company. Your job is to write polite and professional response confirming shipment planification to retail customers.\n\nYour tone should be clear, efficient, and customer-friendly. Keep it concise and formal.\n\nThe confirmation must repeat the key shipment details to avoid confusion and should reassure the customer that the transport has been scheduled.\n\nDo not invent details — only use the provided data. The email must be in **English**.\n\n⚠️ Always format the result in **HTML**, not plain text or Markdown. Use proper HTML tags like `<p>`, `<strong>`, `<br>`, and `<ul><li>` where needed.\n\nYou do not need to add a subject, just the body.\n\nAbout you\n[Name]: LogiGreen Bot\n[Position]: Transportation Planner\n[Company]: LogiGreen Transportation\n[Contact]: logigreenbot@gmail.com\n\n"
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "4d83c51c-b124-4732-9757-6b5490002425",
      "name": "Antwort",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1340,
        1520
      ],
      "webhookId": "2b6b8447-1f25-4ceb-8c5f-e14f6b6f425a",
      "parameters": {
        "message": "={{ $json.output }}",
        "options": {},
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "reply"
      },
      "notesInFlow": true,
      "typeVersion": 2.1
    },
    {
      "id": "958e7446-0078-4823-a696-eca00fa6c3fb",
      "name": "Notiz",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 1040,
        "height": 1100,
        "content": "### 3. Record Shipment Request Information and fetch distance and driving time using Open Route API\nThis starts by recording all the information parsed by the AI node. Then, we use the **Open Route API** to complete with **geocoding data** *(GPS Coordinates)* that will be used to fetch **driving distance and time**.\n\n#### How to setup?\n- **Setup API Credentials**\n  1. Get your free API key: [Open Route API Documentation](https://openrouteservice.org/dev/#/api-docs)\n  2. Fill the API key in the HTTP request node\n  3. Select the driving mode (**driving-car**: individual truck) or (**driving-hgv**: commercial truck)\n- **Load records in the Google Sheet Node**:\n   1. Add your Google Sheet API credentials to access the Google Sheet file\n   2. Select the file using the list, an URL or an ID\n   3. Select the sheet in which you want to record your working sessions\n   4. Map the fields: **shipment_number**, **pickup_location**, **pickup_address**, **pickup_longitude**, **pickup_latitude**, **expected_pickup_time**,\t**temperature_control**, **destination_store_name**, **destination_address**, **destination_longitude**, **destination_latitude**, **expected_delivery_time**, **driving_distance**, **driving_time**\t\t\t\t\t\t\t\t\t\t\t\t\t\n  [Learn more about the Google Sheet Node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets)\n\nLongitudes, latitudes, distance and time will be fetched from the **Open Route API**.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1ef6e4fd-67a2-4d07-a6a8-294456fc3fad",
      "name": "Notiz1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 180,
        "height": 700,
        "content": "### 1. Workflow Trigger with Gmail Trigger\nThe workflow is triggered by a new email received in your Gmail mailbox dedicated to process **shipment request**.\n\n#### How to setup?\n- **Gmail Trigger Node:** set up your Gmail API credentials\n[Learn more about the Gmail Trigger Node](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.gmailtrigger)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c470fc5f-b74b-4b3f-b9bd-6e52220f9159",
      "name": "Notiz2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 700,
        "content": "### 2. AI Agent to parse shipment information from email\nThis node will analyze the content of the email to extract information about the **sender** *(name, company)* and the **shipment** *(departure, arrival, timing and locations)*.\n\n#### How to setup?\n- **AI Agent with the Chat Model**:\n   1. Add a **chat model** with the required credentials *(Example: Open AI 4o-mini)*\n   2. Adapt the system prompt to the format of emails you expect to receive *(type of information included)*\n  [Learn more about the AI Agent Node](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "80ed9218-8c59-4b1b-b3a6-f97f2ece11c8",
      "name": "OpenAI-Chat-Modell2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        240,
        560
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "30592283-3d1e-4f41-b18f-55e4dd87457e",
      "name": "Notiz3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        1120
      ],
      "parameters": {
        "color": 7,
        "width": 680,
        "height": 720,
        "content": "### 4. Reply with a confirmation of shipment allocation\nWe first collect all the information from the **Google Sheets** that will be used by the AI Agent to generate a reply by email.\n#### How to setup?\n- **Load records in the Google Sheet Node**:\n   1. Add your Google Sheet API credentials to access the Google Sheet file\n   2. Select the file using the list, an URL or an ID\n   3. Select the sheet in which you want to record your working sessions\t\t\t\t\t\t\t\t\t\t\t\n  [Learn more about the Google Sheet Node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets)\n- **AI Agent with the Chat Model**:\n   1. Add a **chat model** with the required credentials *(Example: Open AI 4o-mini)*\n   2. Adapt the system prompt with your company information **(name, contact, position)**\n  [Learn more about the AI Agent Node](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent)\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7cce6421-6771-4cdf-a8aa-6454c6a4e27f",
      "name": "Notiz4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        720
      ],
      "parameters": {
        "width": 580,
        "height": 380,
        "content": "### [Check the Tutorial](https://youtu.be/0InkUBOUMQQ)\n![Thumbnail](https://www.samirsaci.com/content/images/2025/06/temp.png)"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "e87c8abb-34b4-41c2-8c4a-139248d41a20": {
      "main": [
        [
          {
            "node": "ba4f843c-f922-486d-944c-d9ea6655ccda",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dd81a2cb-fe60-4e3c-95c7-08b89b111ad8": {
      "main": [
        [
          {
            "node": "652c3a8f-9e47-4386-a932-be99a94e72bd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "AI Agent Parser",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a73dfa1c-4f4e-4cab-950d-91021fc28c5d": {
      "main": [
        [
          {
            "node": "4d83c51c-b124-4732-9757-6b5490002425",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent Parser": {
      "main": [
        [
          {
            "node": "0d31ad24-c3b3-42bb-b98a-ad443005341a",
            "type": "main",
            "index": 0
          },
          {
            "node": "8a0c7eb8-322b-47c1-8547-2afe0370f3fc",
            "type": "main",
            "index": 0
          },
          {
            "node": "b2c5c252-c464-4094-93c0-9c94ccd82b14",
            "type": "main",
            "index": 0
          },
          {
            "node": "ac878430-fe68-42ee-9b0b-20ad9a245d9b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ba4f843c-f922-486d-944c-d9ea6655ccda": {
      "main": [
        [
          {
            "node": "840698a1-2f87-43d1-a6d3-27a107d4038b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b2c5c252-c464-4094-93c0-9c94ccd82b14": {
      "main": [
        [
          {
            "node": "82cc284e-14a4-45de-a463-511e2a70e182",
            "type": "main",
            "index": 0
          },
          {
            "node": "556c1a60-e086-47a2-bafe-2aa3646c7846",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "a73dfa1c-4f4e-4cab-950d-91021fc28c5d",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "0d31ad24-c3b3-42bb-b98a-ad443005341a": {
      "main": [
        [
          {
            "node": "f813ecde-ea6e-4780-9bae-2be7e171419d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f813ecde-ea6e-4780-9bae-2be7e171419d": {
      "main": [
        [
          {
            "node": "21631974-c8a7-4b0c-a19b-3edcf2682200",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "21631974-c8a7-4b0c-a19b-3edcf2682200": {
      "main": [
        [
          {
            "node": "f9fb4321-398f-439e-832a-531245cad968",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "62ced604-4de3-4a6d-bbfe-b1c2f985117f": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent Parser",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "82cc284e-14a4-45de-a463-511e2a70e182": {
      "main": [
        [
          {
            "node": "e87c8abb-34b4-41c2-8c4a-139248d41a20",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ac878430-fe68-42ee-9b0b-20ad9a245d9b": {
      "main": [
        [
          {
            "node": "a73dfa1c-4f4e-4cab-950d-91021fc28c5d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "556c1a60-e086-47a2-bafe-2aa3646c7846": {
      "main": [
        [
          {
            "node": "dd81a2cb-fe60-4e3c-95c7-08b89b111ad8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Experte - Künstliche Intelligenz, IT-Betrieb

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Experte
Anzahl der Nodes26
Kategorie2
Node-Typen10
Schwierigkeitsbeschreibung

Für fortgeschrittene Benutzer, komplexe Workflows mit 16+ Nodes

Autor
Samir Saci

Samir Saci

@samirsaci

Automation, AI and Analytics for Supply Chain & Business Optimization Helping businesses streamline operations using n8n, AI agents, and data science to enhance efficiency and sustainability. Linkedin: www.linkedin.com/in/samir-saci

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34