🤖🚚 基于GPT-4o和Open Route API的运输订单管理AI代理
高级
这是一个AI, IT Ops领域的自动化工作流,包含 26 个节点。主要使用 Set, Wait, Gmail, HttpRequest, GmailTrigger 等节点,结合人工智能技术实现智能自动化。 🤖🚚 基于GPT-4o和Open Route API的运输订单管理AI代理
前置要求
- •Google 账号和 Gmail API 凭证
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
- •OpenAI API Key
使用的节点 (26)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 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": "AI 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": "Record Email Content",
"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": "Collect Addresses",
"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 sec",
"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": "Save Pickup GPS",
"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": "Save Delivery GPS",
"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": "Collect Coordinates",
"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": "Save Results",
"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": "Collect Shipment Information",
"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": "Driving Time & Distance",
"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 Model",
"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": "AI Agent Reply",
"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": "Reply",
"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": "Sticky Note",
"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": "Sticky Note1",
"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": "Sticky Note2",
"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 Model2",
"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": "Sticky Note3",
"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": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
720
],
"parameters": {
"width": 580,
"height": 380,
"content": "### [Check the Tutorial](https://youtu.be/0InkUBOUMQQ)\n"
},
"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
}
]
]
},
"f24429ab-1276-4655-a3ef-1fbbb6d80602": {
"main": [
[
{
"node": "767ee78a-d0ff-4399-bea1-4310aff116f7",
"type": "main",
"index": 0
}
]
]
},
"a73dfa1c-4f4e-4cab-950d-91021fc28c5d": {
"main": [
[
{
"node": "4d83c51c-b124-4732-9757-6b5490002425",
"type": "main",
"index": 0
}
]
]
},
"767ee78a-d0ff-4399-bea1-4310aff116f7": {
"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
}
]
]
},
"aad7e5f3-5eae-4be1-beb5-e57f7723086f": {
"ai_languageModel": [
[
{
"node": "a73dfa1c-4f4e-4cab-950d-91021fc28c5d",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"80ed9218-8c59-4b1b-b3a6-f97f2ece11c8": {
"ai_languageModel": [
[
{
"node": "767ee78a-d0ff-4399-bea1-4310aff116f7",
"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": "767ee78a-d0ff-4399-bea1-4310aff116f7",
"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
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 人工智能, IT 运维
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
✈️ 使用CarbonInterface API和GPT-4o计算商务旅行二氧化碳排放量
✈️ 通过Carbon Interface API和GPT-4o计算商务旅行二氧化碳排放
Split Out
Http Request
Gmail Trigger
+
Split Out
Http Request
Gmail Trigger
12 节点Samir Saci
其他
🚚 使用 Carbon Interface API 和 GPT-4o 计算货运的 CO2
🚚 使用 Carbon Interface API 和 GPT-4o 计算货运的 CO2 排放量
Http Request
Gmail Trigger
Google Sheets
+
Http Request
Gmail Trigger
Google Sheets
10 节点Samir Saci
人工智能
🗞️ AI驱动的可持续性营销简报(使用Gmail、GPT-4o)
🗞️ AI驱动的可持续性营销简报(使用Gmail、GPT-4o)
If
Set
Code
+
If
Set
Code
21 节点Samir Saci
人工智能
AI邮件分诊与GPT-4警报系统及Telegram通知
AI邮件分诊与GPT-4警报系统及Telegram通知
If
Set
Gmail
+
If
Set
Gmail
104 节点Peter Joslyn
客户支持
🉑 使用Google Translate和GPT-4o生成语言学习Anki闪卡
🉑 使用Google Translate和GPT-4o生成语言学习Anki闪卡
If
Set
Merge
+
If
Set
Merge
21 节点Samir Saci
其他
使用AI、ElevenLabs、PIAPI
使用AI、ElevenLabs、PIAPI Shotstack/Creatomate生成视频并发布到YouTube
If
Set
Code
+
If
Set
Code
79 节点Immanuel
人工智能
工作流信息
难度等级
高级
节点数量26
分类2
节点类型10
作者
Samir Saci
@samirsaciAutomation, 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
外部链接
在 n8n.io 查看 →
分享此工作流