8
n8n 한국어amn8n.com

화물을 이용하여 Carbon Interface API와 GPT-4o를 통해 CO2 배출량을 계산합니다.

중급

이것은AI, IT Ops분야의자동화 워크플로우로, 10개의 노드를 포함합니다.주로 HttpRequest, GmailTrigger, GoogleSheets, Agent, LmChatOpenAi 등의 노드를 사용하며인공지능 기술을 결합하여 스마트 자동화를 구현합니다. 화물 배송량의 CO2 배출량을 Carbon Interface API와 GPT-4o를 사용하여 계산합니다.

사전 요구사항
  • 대상 API의 인증 정보가 필요할 수 있음
  • Google 계정 및 Gmail API 인증 정보
  • Google Sheets API 인증 정보
  • OpenAI API Key
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "id": "umOZqpde6cAUTL8F",
  "meta": {
    "instanceId": "",
    "templateCredsSetupCompleted": true
  },
  "name": "🚚 CO2 Emissions of Freight Shipments with Carbon Interface API and GPT-4o",
  "tags": [],
  "nodes": [
    {
      "id": "dc20a34f-90ff-4f4e-a2f7-7b77abb92f4c",
      "name": "Gmail 트리거",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -320,
        415
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {
          "downloadAttachments": false
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "",
          "name": ""
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "984a0707-919c-4c67-b070-6b1caaea2946",
      "name": "구조화 출력 파서",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        140,
        600
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"shipment_number\": \"7894-PCB-654\",\n  \"pickup_location\": \"Centre de Distribution Auchan\",\n  \"pickup_address\": \"77 Rue Albert Garry, 94450 Limeil-Brévannes\",\n  \"expected_pickup_time\": \"2024-09-24T09:00:00\",\n  \"temperature_control\": \"Frozen\",\n  \"destination_store_name\": \"Auchan Store 124\",\n  \"destination_address\": \"43-45 Quai Jules Guesde, 94405 Vitry-sur-Seine\",\n  \"expected_delivery_time\": \"2024-09-24T18:00:00\",\n  \"driving_distance_km\": 9.61,\n  \"estimated_transit_min\": 16.9,\n  \"cargo_quantity\": 12,\n  \"cargo_weight_tons\": 2.79\n}\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "de58b711-25ef-42f7-a5ab-4bc1d20fd1fc",
      "name": "AI 에이전트 파서",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -100,
        415
      ],
      "parameters": {
        "text": "=Extract the structured shipment details from the following email:\n\n{{ $json.text }}\n",
        "options": {
          "systemMessage": "=You are a logistics assistant. When provided with the body of a shipment confirmation email, extract the following structured JSON object:\n\n{\n  \"shipment_number\": string,\n  \"pickup_location\": string,\n  \"pickup_address\": string,\n  \"expected_pickup_time\": string (ISO 8601, e.g. \"2024-09-24T09:00:00\"),\n  \"temperature_control\": string,\n  \"destination_store_name\": string,\n  \"destination_address\": string,\n  \"expected_delivery_time\": string (ISO 8601, e.g. \"2024-09-24T18:00:00\"),\n  \"driving_distance_km\": number,\n  \"estimated_transit_min\": number,\n  \"cargo_quantity\": number,\n  \"cargo_weight_tons\": number\n}\n\n- Extract **only** what’s listed.\n- Normalize dates and times to ISO 8601 format.\n- Remove units from numbers (e.g. 9.61 km → 9.61, 2.79 tons → 2.79).\n- Return only the JSON object. No additional explanation or text."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.9
    },
    {
      "id": "05ca643f-774c-40a5-843f-76790c42d433",
      "name": "OpenAI 채팅 모델2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -100,
        620
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "",
          "name": ""
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "fb16f384-e73f-4c3f-be72-24fede7b2760",
      "name": "CO2 배출량 수집",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        680,
        420
      ],
      "parameters": {
        "url": "https://www.carboninterface.com/api/v1/estimates",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"type\": \"shipping\",\n  \"weight_value\": {{ $('AI Agent Parser').item.json.output.cargo_weight_tons * 1000000 }},\n  \"weight_unit\": \"g\",\n  \"distance_value\": {{ $('AI Agent Parser').item.json.output.driving_distance_km }},\n  \"distance_unit\": \"km\",\n  \"transport_method\": \"truck\"\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_API_KEY"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.2
    },
    {
      "id": "82c2db80-9a3a-421b-ad27-097a713fc3c2",
      "name": "결과 로드",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        920,
        420
      ],
      "parameters": {
        "columns": {
          "value": {
            "co2_kg": "={{ $json.data.attributes.carbon_kg }}",
            "shipment_number": "={{ $('AI Agent Parser').item.json.output.shipment_number }}",
            "co2_estimation_time": "={{ $json.data.attributes.estimated_at }}"
          },
          "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": "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": "expected_delivery_time",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "expected_delivery_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "driving_distance_km",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "driving_distance_km",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "estimated_transit_min",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "estimated_transit_min",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cargo_quantity",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "cargo_quantity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cargo_weight_tons",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "cargo_weight_tons",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "co2_kg",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "co2_kg",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "co2_estimation_time",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "co2_estimation_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "shipment_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 877993777,
          "cachedResultUrl": "",
          "cachedResultName": "CO2 emissions"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1NLNviRoVMEj2z78KiueruB5sd2CnvAb80DS7J2melVs",
          "cachedResultUrl": "",
          "cachedResultName": "Open Route Service"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": ""
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.6
    },
    {
      "id": "94cd225d-1bc0-42b5-a466-7fad8b445e94",
      "name": "스티키 노트1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -60
      ],
      "parameters": {
        "color": 7,
        "width": 180,
        "height": 820,
        "content": "### 1. Workflow Trigger with Gmail Trigger\nThe workflow is triggered by a new email received in your Gmail mailbox dedicated to process **shipment records**.\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": "3e4989f9-2ef4-4c60-98cc-d8b988162e54",
      "name": "스티키 노트2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -60
      ],
      "parameters": {
        "color": 7,
        "width": 440,
        "height": 820,
        "content": "### 2. AI Agent to trip schedule report\nThis node will analyze the content of an email to extract structured information about a **shipment**, including **pickup/delivery times**, **addresses**, **cargo weight**, and **driving distance**.\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": "7dc4dab6-2536-4373-b058-7487fc968c33",
      "name": "스티키 노트",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        -60
      ],
      "parameters": {
        "color": 7,
        "width": 1180,
        "height": 820,
        "content": "### 3. Record Shipment Request Information and fetch emissions using the Carbon Interface API  \nThis starts by recording all the structured shipment information parsed by the AI Agent node. Then, we use the **Carbon Interface API** to estimate **CO₂ emissions** based on cargo weight, distance, and transportation method.\n\n#### How to setup?\n\n- **Setup Carbon Interface API Credentials**  \n  1. Get your free API key: [Carbon Interface API Documentation](https://docs.carboninterface.com/#/)  \n  2. Fill the API key in the HTTP Request node headers (`Bearer YOUR_API_KEY`)\n\n- **Load records into the Google Sheet Node**  \n  1. Add your Google Sheets API credentials to access your sheet  \n  2. Select the file using the list, a URL, or its ID  \n  3. Select the sheet where you want to log your shipping emissions  \n  4. Map the fields:  \n     **shipment_number**, **pickup_location**, **pickup_address**, **expected_pickup_time**, **temperature_control**, **destination_store_name**, **destination_address**, **expected_delivery_time**, **driving_distance_km**, **estimated_transit_min**, **cargo_quantity**, **cargo_weight_tons**, **weight_value_g**, **co2_kg**, **co2_estimation_time**\n\n> Distance and weight values will be used to calculate carbon emissions via the Carbon Interface API.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a51645cd-d3fe-4c3f-a7af-9bdd31eb9242",
      "name": "운송 정보 기록",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        420,
        420
      ],
      "parameters": {
        "columns": {
          "value": {
            "cargo_quantity": "={{ $json.output.cargo_quantity }}",
            "pickup_address": "={{ $json.output.pickup_address }}",
            "pickup_location": "={{ $json.output.pickup_location }}",
            "shipment_number": "={{ $json.output.shipment_number }}",
            "cargo_weight_tons": "={{ $json.output.cargo_weight_tons }}",
            "destination_address": "={{ $json.output.destination_address }}",
            "driving_distance_km": "={{ $json.output.driving_distance_km }}",
            "temperature_control": "={{ $json.output.temperature_control }}",
            "expected_pickup_time": "={{ $json.output.expected_pickup_time }}",
            "estimated_transit_min": "={{ $json.output.estimated_transit_min }}",
            "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,
              "removed": false,
              "required": false,
              "displayName": "pickup_location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_address",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "pickup_address",
              "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,
              "removed": false,
              "required": false,
              "displayName": "temperature_control",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_store_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "destination_store_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "destination_address",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "destination_address",
              "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_km",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "driving_distance_km",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "estimated_transit_min",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "estimated_transit_min",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cargo_quantity",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "cargo_quantity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cargo_weight_tons",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "cargo_weight_tons",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "co2_kg",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "co2_kg",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "co2_estimation_time",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "co2_estimation_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "shipment_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 877993777,
          "cachedResultUrl": "",
          "cachedResultName": "CO2 emissions"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "",
          "cachedResultName": "Open Route Service"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": ""
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.6
    }
  ],
  "active": false,
  "pinData": {
    "AI Agent Parser": [
      {
        "json": {
          "output": {
            "cargo_quantity": 12,
            "pickup_address": "77 Rue Albert Garry, 94450 Limeil-Brévannes",
            "pickup_location": "Centre de Distribution Auchan",
            "shipment_number": "7894-PCB-654",
            "cargo_weight_tons": 3.79,
            "destination_address": "43-45 Quai Jules Guesde, 94405 Vitry-sur-Seine",
            "driving_distance_km": 9.61,
            "temperature_control": "Frozen",
            "expected_pickup_time": "2024-09-24T09:00:00",
            "estimated_transit_min": 16.9,
            "destination_store_name": "Auchan Store 124",
            "expected_delivery_time": "2024-09-24T18:00:00"
          }
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "844e09c0-2706-43da-bd53-6c211b68aafc",
  "connections": {
    "82c2db80-9a3a-421b-ad27-097a713fc3c2": {
      "main": [
        []
      ]
    },
    "dc20a34f-90ff-4f4e-a2f7-7b77abb92f4c": {
      "main": [
        [
          {
            "node": "de58b711-25ef-42f7-a5ab-4bc1d20fd1fc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "de58b711-25ef-42f7-a5ab-4bc1d20fd1fc": {
      "main": [
        [
          {
            "node": "a51645cd-d3fe-4c3f-a7af-9bdd31eb9242",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "05ca643f-774c-40a5-843f-76790c42d433": {
      "ai_languageModel": [
        [
          {
            "node": "de58b711-25ef-42f7-a5ab-4bc1d20fd1fc",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "fb16f384-e73f-4c3f-be72-24fede7b2760": {
      "main": [
        [
          {
            "node": "82c2db80-9a3a-421b-ad27-097a713fc3c2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "984a0707-919c-4c67-b070-6b1caaea2946": {
      "ai_outputParser": [
        [
          {
            "node": "de58b711-25ef-42f7-a5ab-4bc1d20fd1fc",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "a51645cd-d3fe-4c3f-a7af-9bdd31eb9242": {
      "main": [
        [
          {
            "node": "fb16f384-e73f-4c3f-be72-24fede7b2760",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

이 워크플로우를 어떻게 사용하나요?

위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.

이 워크플로우는 어떤 시나리오에 적합한가요?

중급 - 인공지능, IT 운영

유료인가요?

이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.

워크플로우 정보
난이도
중급
노드 수10
카테고리2
노드 유형7
난이도 설명

일정 경험을 가진 사용자를 위한 6-15개 노드의 중간 복잡도 워크플로우

저자
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

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34