InfoGrab DocsInfoGrab Docs

워크플로 2 - 보고서 생성

요약

이 워크플로에서는 다양한 소스의 데이터를 병합하고, 바이너리 데이터를 변환하고, 파일을 생성하며, 파일에 대한 알림을 전송합니다. 작업을 쉽게 하기 위해 워크플로를 세 부분으로 나눠 보겠습니다. 워크플로의 첫 번째 부분은 다섯 개의 노드로 구성됩니다:

이 워크플로에서는 다양한 소스의 데이터를 병합하고, 바이너리 데이터를 변환하고, 파일을 생성하며, 파일에 대한 알림을 전송합니다. 최종 워크플로는 다음과 같아야 합니다:

데이터 집계 및 파일 생성을 위한 워크플로 2
데이터 집계 및 파일 생성을 위한 워크플로 2

작업을 쉽게 하기 위해 워크플로를 세 부분으로 나눠 보겠습니다.

파트 1: 다양한 소스에서 데이터 가져오기#

워크플로의 첫 번째 부분은 다섯 개의 노드로 구성됩니다:

워크플로 1: 다양한 소스에서 데이터 가져오기
워크플로 1: 다양한 소스에서 데이터 가져오기
  1. HTTP Request node를 사용하여 회사 데이터를 저장하는 API 엔드포인트에서 데이터를 가져옵니다. 다음 노드 파라미터를 구성합니다:

    • Method: Get
    • URL: 이 코스에 등록할 때 이메일로 받은 Dataset URL.
    • Authentication: Generic Credential Type
      • Generic Auth Type: Header Auth
      • Credentials for Header Auth: 이 코스에 등록할 때 이메일로 받은 Header Auth 이름과 Header Auth 값.
    • Send Headers: true로 토글
      • Specify Headers: Using Fields Below 선택
      • Name: unique_id
      • Value: 이 코스에 등록할 때 이메일로 받은 고유 ID.
  2. Airtable node를 사용하여 customers 테이블(regionsubregion 필드를 업데이트한 테이블)에서 데이터를 나열합니다.

  3. Merge node를 사용하여 customerID 입력 필드를 매칭하여 Airtable과 HTTP Request node의 데이터를 병합합니다.

  4. Sort node를 사용하여 orderPrice를 내림차순으로 데이터를 정렬합니다.

/// question | 퀴즈 문제

  • 고객 1에 할당된 직원의 이름은 무엇입니까?
  • 고객 2의 주문 상태는 무엇입니까?
  • 가장 높은 주문 금액은 얼마입니까? ///

파트 2: 지역별 영업 파일 생성#

워크플로의 두 번째 부분은 네 개의 노드로 구성됩니다:

워크플로 2: 지역별 영업 파일 생성
워크플로 2: 지역별 영업 파일 생성
  1. If node를 사용하여 Americas 지역의 주문만 표시하도록 필터링합니다.
  2. Convert to File를 사용하여 수신 데이터를 JSON에서 바이너리 형식으로 변환합니다. 각 항목을 별도의 파일로 변환합니다. (orderID를 기반으로 각 보고서 이름을 지정하는 방법을 알아낼 수 있다면 보너스 점수가 있습니다!)
  3. Gmail node (또는 다른 이메일 노드)를 사용하여 접근 가능한 주소로 이메일을 통해 파일을 전송합니다. 데이터 프로퍼티와 함께 첨부 파일을 추가해야 합니다.
  4. Discord node를 사용하여 n8n Discord 채널 #course-level-two에 메시지를 전송합니다. 노드에서 다음 파라미터를 구성합니다:
    • Webhook URL: 이 코스에 등록할 때 이메일로 받은 Discord URL.
    • Text: "I sent the file using email with the label ID {label ID}. My ID: " 다음에 이 코스에 등록할 때 이메일로 받은 고유 ID.
      중괄호 {} 안의 텍스트는 노드의 데이터를 참조하는 표현식으로 교체해야 합니다.

/// question | 퀴즈 문제

  • Americas 지역에 할당된 주문은 몇 개입니까?
  • Americas 지역 주문의 총 금액은 얼마입니까?
  • Write Binary File node는 몇 개의 항목을 반환합니까? ///

파트 3: 총 영업 파일 생성#

워크플로의 세 번째 부분은 다섯 개의 노드로 구성됩니다:

워크플로 3: 총 영업 파일 생성
워크플로 3: 총 영업 파일 생성
  1. Loop Over Items node를 사용하여 Item Lists node의 데이터를 5개씩 배치로 분할합니다.
  2. Set node를 사용하여 이전 노드의 표현식으로 참조된 네 가지 값을 설정합니다: customerEmail, customerRegion, customerSince, orderPrice.
  3. Date & Time node를 사용하여 customerSince 필드의 날짜 형식을 MM/DD/YYYY 형식으로 변경합니다.
    • 모든 데이터를 함께 유지하려면 Include Input Fields 옵션을 설정합니다.
  4. Convert to File node를 사용하여 파일 이름이 표현식 {{$runIndex > 0 ? 'file_low_orders':'file_high_orders'}}으로 설정된 CSV 스프레드시트를 만듭니다.
  5. Discord node를 사용하여 n8n Discord 채널 #course-level-two에 메시지를 전송합니다. 노드에서 다음 파라미터를 구성합니다:
    • Webhook URL: 이 코스에 등록할 때 이메일로 받은 Discord URL.
    • Text: "I created the spreadsheet {file name}. My ID:" 다음에 이 코스에 등록할 때 이메일로 받은 고유 ID.
      {file name}은 이전 Convert to File node의 데이터를 참조하는 표현식으로 교체해야 합니다.

/// question | 퀴즈 문제

  • 첫 번째 배치 항목에서 가장 낮은 주문 금액은 얼마입니까?
  • 고객 7의 형식이 지정된 날짜는 무엇입니까?
  • Convert to File node는 몇 개의 항목을 반환합니까? ///
솔루션 보기
노드 구성을 확인하려면 아래 JSON 워크플로 코드를 복사하여 편집기 UI에 붙여넣을 수 있습니다:

```json
{
"meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "cb484ba7b742928a2048bf8829668bed5b5ad9787579adea888f05980292a4a7"
},
"nodes": [
    {
    "parameters": {
        "sendTo": "bart@n8n.io",
        "subject": "Your TPS Reports",
        "emailType": "text",
        "message": "Please find your TPS report attached.",
        "options": {
        "attachmentsUi": {
            "attachmentsBinary": [
            {}
            ]
        }
        }
    },
    "id": "d889eb42-8b34-4718-b961-38c8e7839ea6",
    "name": "Gmail",
    "type": "n8n-nodes-base.gmail",
    "typeVersion": 2.1,
    "position": [
        2100,
        500
    ],
    "credentials": {
        "gmailOAuth2": {
        "id": "HFesCcFcn1NW81yu",
        "name": "Gmail account 7"
        }
    }
    },
    {
    "parameters": {},
    "id": "c0236456-40be-4f8f-a730-e56cb62b7b5c",
    "name": "When clicking \"Execute workflow\"",
    "type": "n8n-nodes-base.manualTrigger",
    "typeVersion": 1,
    "position": [
        780,
        600
    ]
    },
    {
    "parameters": {
        "url": "https://internal.users.n8n.cloud/webhook/level2-erp",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
        "parameters": [
            {
            "name": "unique_id",
            "value": "recFIcD6UlSyxaVMQ"
            }
        ]
        },
        "options": {}
    },
    "id": "cc106fa0-6630-4c84-aea4-a4c7a3c149e9",
    "name": "HTTP Request",
    "type": "n8n-nodes-base.httpRequest",
    "typeVersion": 4.1,
    "position": [
        1000,
        500
    ],
    "credentials": {
        "httpHeaderAuth": {
        "id": "qeHdJdqqqaTC69cm",
        "name": "Course L2 Credentials"
        }
    }
    },
    {
    "parameters": {
        "operation": "search",
        "base": {
        "__rl": true,
        "value": "apprtKkVasbQDbFa1",
        "mode": "list",
        "cachedResultName": "All your base",
        "cachedResultUrl": "https://airtable.com/apprtKkVasbQDbFa1"
        },
        "table": {
        "__rl": true,
        "value": "tblInZ7jeNdlUOvxZ",
        "mode": "list",
        "cachedResultName": "Course L2, Workflow 1",
        "cachedResultUrl": "https://airtable.com/apprtKkVasbQDbFa1/tblInZ7jeNdlUOvxZ"
        },
        "options": {}
    },
    "id": "e5ae1927-b531-401c-9cb2-ecf1f2836ba6",
    "name": "Airtable",
    "type": "n8n-nodes-base.airtable",
    "typeVersion": 2,
    "position": [
        1000,
        700
    ],
    "credentials": {
        "airtableTokenApi": {
        "id": "MIplo6lY3AEsdf7L",
        "name": "Airtable Personal Access Token account 4"
        }
    }
    },
    {
    "parameters": {
        "mode": "combine",
        "mergeByFields": {
        "values": [
            {
            "field1": "customerID",
            "field2": "customerID"
            }
        ]
        },
        "options": {}
    },
    "id": "1cddc984-7fca-45e0-83b8-0c502cb4c78c",
    "name": "Merge",
    "type": "n8n-nodes-base.merge",
    "typeVersion": 2.1,
    "position": [
        1220,
        600
    ]
    },
    {
    "parameters": {
        "sortFieldsUi": {
        "sortField": [
            {
            "fieldName": "orderPrice",
            "order": "descending"
            }
        ]
        },
        "options": {}
    },
    "id": "2f55af2e-f69b-4f61-a9e5-c7eefaad93ba",
    "name": "Sort",
    "type": "n8n-nodes-base.sort",
    "typeVersion": 1,
    "position": [
        1440,
        600
    ]
    },
    {
    "parameters": {
        "conditions": {
        "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
        },
        "conditions": [
            {
            "id": "d3afe65c-7c80-4caa-9d1c-33c62fbc2197",
            "leftValue": "={{ $json.region }}",
            "rightValue": "Americas",
            "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
            }
            }
        ],
        "combinator": "and"
        },
        "options": {}
    },
    "id": "2ed874a9-5bcf-4cc9-9b52-ea503a562892",
    "name": "If",
    "type": "n8n-nodes-base.if",
    "typeVersion": 2,
    "position": [
        1660,
        500
    ]
    },
    {
    "parameters": {
        "operation": "toJson",
        "mode": "each",
        "options": {
        "fileName": "=report_orderID_{{ $('If').item.json.orderID }}.json"
        }
    },
    "id": "d93b4429-2200-4a84-8505-16266fedfccd",
    "name": "Convert to File",
    "type": "n8n-nodes-base.convertToFile",
    "typeVersion": 1.1,
    "position": [
        1880,
        500
    ]
    },
    {
    "parameters": {
        "authentication": "webhook",
        "content": "I sent the file using email with the label ID  and wrote the binary file {file name}. My ID: 123",
        "options": {}
    },
    "id": "26f43f2c-1422-40de-9f40-dd2d80926b1c",
    "name": "Discord",
    "type": "n8n-nodes-base.discord",
    "typeVersion": 2,
    "position": [
        2320,
        500
    ],
    "credentials": {
        "discordWebhookApi": {
        "id": "WEBrtPdoLrhlDYKr",
        "name": "L2 Course Discord Webhook account"
        }
    }
    },
    {
    "parameters": {
        "batchSize": 5,
        "options": {}
    },
    "id": "0fa1fbf6-fe77-4044-a445-c49a1db37dec",
    "name": "Loop Over Items",
    "type": "n8n-nodes-base.splitInBatches",
    "typeVersion": 3,
    "position": [
        1660,
        700
    ]
    },
    {
    "parameters": {
        "assignments": {
        "assignments": [
            {
            "id": "ce839b80-c50d-48f5-9a24-bb2df6fdd2ff",
            "name": "customerEmail",
            "value": "={{ $json.customerEmail }}",
            "type": "string"
            },
            {
            "id": "0c613366-3808-45a2-89cc-b34c7b9f3fb7",
            "name": "region",
            "value": "={{ $json.region }}",
            "type": "string"
            },
            {
            "id": "0f19a88c-deb0-4119-8965-06ed62a840b2",
            "name": "customerSince",
            "value": "={{ $json.customerSince }}",
            "type": "string"
            },
            {
            "id": "a7e890d6-86af-4839-b5df-d2a4efe923f7",
            "name": "orderPrice",
            "value": "={{ $json.orderPrice }}",
            "type": "number"
            }
        ]
        },
        "options": {}
    },
    "id": "09b8584c-4ead-4007-a6cd-edaa4669a757",
    "name": "Edit Fields",
    "type": "n8n-nodes-base.set",
    "typeVersion": 3.3,
    "position": [
        1880,
        700
    ]
    },
    {
    "parameters": {
        "operation": "formatDate",
        "date": "={{ $json.customerSince }}",
        "options": {
        "includeInputFields": true
        }
    },
    "id": "c96fae90-e080-48dd-9bff-3e4506aafb86",
    "name": "Date & Time",
    "type": "n8n-nodes-base.dateTime",
    "typeVersion": 2,
    "position": [
        2100,
        700
    ]
    },
    {
    "parameters": {
        "options": {
        "fileName": "={{$runIndex > 0 ? 'file_low_orders':'file_high_orders'}}"
        }
    },
    "id": "43dc8634-2f16-442b-a754-89f47c51c591",
    "name": "Convert to File1",
    "type": "n8n-nodes-base.convertToFile",
    "typeVersion": 1.1,
    "position": [
        2320,
        700
    ]
    },
    {
    "parameters": {
        "authentication": "webhook",
        "content": "I created the spreadsheet {file name}. My ID: 123",
        "options": {}
    },
    "id": "05da1c22-d1f6-4ea6-9102-f74f9ae2e9d3",
    "name": "Discord1",
    "type": "n8n-nodes-base.discord",
    "typeVersion": 2,
    "position": [
        2540,
        700
    ],
    "credentials": {
        "discordWebhookApi": {
        "id": "WEBrtPdoLrhlDYKr",
        "name": "L2 Course Discord Webhook account"
        }
    }
    }
],
"connections": {
    "Gmail": {
    "main": [
        [
        {
            "node": "Discord",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "When clicking \"Execute workflow\"": {
    "main": [
        [
        {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
        },
        {
            "node": "Airtable",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "HTTP Request": {
    "main": [
        [
        {
            "node": "Merge",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Airtable": {
    "main": [
        [
        {
            "node": "Merge",
            "type": "main",
            "index": 1
        }
        ]
    ]
    },
    "Merge": {
    "main": [
        [
        {
            "node": "Sort",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Sort": {
    "main": [
        [
        {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
        },
        {
            "node": "If",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "If": {
    "main": [
        [
        {
            "node": "Convert to File",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Convert to File": {
    "main": [
        [
        {
            "node": "Gmail",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Loop Over Items": {
    "main": [
        null,
        [
        {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Edit Fields": {
    "main": [
        [
        {
            "node": "Date & Time",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Date & Time": {
    "main": [
        [
        {
            "node": "Convert to File1",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Convert to File1": {
    "main": [
        [
        {
            "node": "Discord1",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Discord1": {
    "main": [
        [
        {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
        }
        ]
    ]
    }
},
"pinData": {}
}
```

워크플로 2 - 보고서 생성

n8n v2.20
원문 보기
요약

이 워크플로에서는 다양한 소스의 데이터를 병합하고, 바이너리 데이터를 변환하고, 파일을 생성하며, 파일에 대한 알림을 전송합니다. 작업을 쉽게 하기 위해 워크플로를 세 부분으로 나눠 보겠습니다. 워크플로의 첫 번째 부분은 다섯 개의 노드로 구성됩니다:

이 워크플로에서는 다양한 소스의 데이터를 병합하고, 바이너리 데이터를 변환하고, 파일을 생성하며, 파일에 대한 알림을 전송합니다. 최종 워크플로는 다음과 같아야 합니다:

데이터 집계 및 파일 생성을 위한 워크플로 2
데이터 집계 및 파일 생성을 위한 워크플로 2

작업을 쉽게 하기 위해 워크플로를 세 부분으로 나눠 보겠습니다.

파트 1: 다양한 소스에서 데이터 가져오기#

워크플로의 첫 번째 부분은 다섯 개의 노드로 구성됩니다:

워크플로 1: 다양한 소스에서 데이터 가져오기
워크플로 1: 다양한 소스에서 데이터 가져오기
  1. HTTP Request node를 사용하여 회사 데이터를 저장하는 API 엔드포인트에서 데이터를 가져옵니다. 다음 노드 파라미터를 구성합니다:

    • Method: Get
    • URL: 이 코스에 등록할 때 이메일로 받은 Dataset URL.
    • Authentication: Generic Credential Type
      • Generic Auth Type: Header Auth
      • Credentials for Header Auth: 이 코스에 등록할 때 이메일로 받은 Header Auth 이름과 Header Auth 값.
    • Send Headers: true로 토글
      • Specify Headers: Using Fields Below 선택
      • Name: unique_id
      • Value: 이 코스에 등록할 때 이메일로 받은 고유 ID.
  2. Airtable node를 사용하여 customers 테이블(regionsubregion 필드를 업데이트한 테이블)에서 데이터를 나열합니다.

  3. Merge node를 사용하여 customerID 입력 필드를 매칭하여 Airtable과 HTTP Request node의 데이터를 병합합니다.

  4. Sort node를 사용하여 orderPrice를 내림차순으로 데이터를 정렬합니다.

/// question | 퀴즈 문제

  • 고객 1에 할당된 직원의 이름은 무엇입니까?
  • 고객 2의 주문 상태는 무엇입니까?
  • 가장 높은 주문 금액은 얼마입니까? ///

파트 2: 지역별 영업 파일 생성#

워크플로의 두 번째 부분은 네 개의 노드로 구성됩니다:

워크플로 2: 지역별 영업 파일 생성
워크플로 2: 지역별 영업 파일 생성
  1. If node를 사용하여 Americas 지역의 주문만 표시하도록 필터링합니다.
  2. Convert to File를 사용하여 수신 데이터를 JSON에서 바이너리 형식으로 변환합니다. 각 항목을 별도의 파일로 변환합니다. (orderID를 기반으로 각 보고서 이름을 지정하는 방법을 알아낼 수 있다면 보너스 점수가 있습니다!)
  3. Gmail node (또는 다른 이메일 노드)를 사용하여 접근 가능한 주소로 이메일을 통해 파일을 전송합니다. 데이터 프로퍼티와 함께 첨부 파일을 추가해야 합니다.
  4. Discord node를 사용하여 n8n Discord 채널 #course-level-two에 메시지를 전송합니다. 노드에서 다음 파라미터를 구성합니다:
    • Webhook URL: 이 코스에 등록할 때 이메일로 받은 Discord URL.
    • Text: "I sent the file using email with the label ID {label ID}. My ID: " 다음에 이 코스에 등록할 때 이메일로 받은 고유 ID.
      중괄호 {} 안의 텍스트는 노드의 데이터를 참조하는 표현식으로 교체해야 합니다.

/// question | 퀴즈 문제

  • Americas 지역에 할당된 주문은 몇 개입니까?
  • Americas 지역 주문의 총 금액은 얼마입니까?
  • Write Binary File node는 몇 개의 항목을 반환합니까? ///

파트 3: 총 영업 파일 생성#

워크플로의 세 번째 부분은 다섯 개의 노드로 구성됩니다:

워크플로 3: 총 영업 파일 생성
워크플로 3: 총 영업 파일 생성
  1. Loop Over Items node를 사용하여 Item Lists node의 데이터를 5개씩 배치로 분할합니다.
  2. Set node를 사용하여 이전 노드의 표현식으로 참조된 네 가지 값을 설정합니다: customerEmail, customerRegion, customerSince, orderPrice.
  3. Date & Time node를 사용하여 customerSince 필드의 날짜 형식을 MM/DD/YYYY 형식으로 변경합니다.
    • 모든 데이터를 함께 유지하려면 Include Input Fields 옵션을 설정합니다.
  4. Convert to File node를 사용하여 파일 이름이 표현식 {{$runIndex > 0 ? 'file_low_orders':'file_high_orders'}}으로 설정된 CSV 스프레드시트를 만듭니다.
  5. Discord node를 사용하여 n8n Discord 채널 #course-level-two에 메시지를 전송합니다. 노드에서 다음 파라미터를 구성합니다:
    • Webhook URL: 이 코스에 등록할 때 이메일로 받은 Discord URL.
    • Text: "I created the spreadsheet {file name}. My ID:" 다음에 이 코스에 등록할 때 이메일로 받은 고유 ID.
      {file name}은 이전 Convert to File node의 데이터를 참조하는 표현식으로 교체해야 합니다.

/// question | 퀴즈 문제

  • 첫 번째 배치 항목에서 가장 낮은 주문 금액은 얼마입니까?
  • 고객 7의 형식이 지정된 날짜는 무엇입니까?
  • Convert to File node는 몇 개의 항목을 반환합니까? ///
솔루션 보기
노드 구성을 확인하려면 아래 JSON 워크플로 코드를 복사하여 편집기 UI에 붙여넣을 수 있습니다:

```json
{
"meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "cb484ba7b742928a2048bf8829668bed5b5ad9787579adea888f05980292a4a7"
},
"nodes": [
    {
    "parameters": {
        "sendTo": "bart@n8n.io",
        "subject": "Your TPS Reports",
        "emailType": "text",
        "message": "Please find your TPS report attached.",
        "options": {
        "attachmentsUi": {
            "attachmentsBinary": [
            {}
            ]
        }
        }
    },
    "id": "d889eb42-8b34-4718-b961-38c8e7839ea6",
    "name": "Gmail",
    "type": "n8n-nodes-base.gmail",
    "typeVersion": 2.1,
    "position": [
        2100,
        500
    ],
    "credentials": {
        "gmailOAuth2": {
        "id": "HFesCcFcn1NW81yu",
        "name": "Gmail account 7"
        }
    }
    },
    {
    "parameters": {},
    "id": "c0236456-40be-4f8f-a730-e56cb62b7b5c",
    "name": "When clicking \"Execute workflow\"",
    "type": "n8n-nodes-base.manualTrigger",
    "typeVersion": 1,
    "position": [
        780,
        600
    ]
    },
    {
    "parameters": {
        "url": "https://internal.users.n8n.cloud/webhook/level2-erp",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
        "parameters": [
            {
            "name": "unique_id",
            "value": "recFIcD6UlSyxaVMQ"
            }
        ]
        },
        "options": {}
    },
    "id": "cc106fa0-6630-4c84-aea4-a4c7a3c149e9",
    "name": "HTTP Request",
    "type": "n8n-nodes-base.httpRequest",
    "typeVersion": 4.1,
    "position": [
        1000,
        500
    ],
    "credentials": {
        "httpHeaderAuth": {
        "id": "qeHdJdqqqaTC69cm",
        "name": "Course L2 Credentials"
        }
    }
    },
    {
    "parameters": {
        "operation": "search",
        "base": {
        "__rl": true,
        "value": "apprtKkVasbQDbFa1",
        "mode": "list",
        "cachedResultName": "All your base",
        "cachedResultUrl": "https://airtable.com/apprtKkVasbQDbFa1"
        },
        "table": {
        "__rl": true,
        "value": "tblInZ7jeNdlUOvxZ",
        "mode": "list",
        "cachedResultName": "Course L2, Workflow 1",
        "cachedResultUrl": "https://airtable.com/apprtKkVasbQDbFa1/tblInZ7jeNdlUOvxZ"
        },
        "options": {}
    },
    "id": "e5ae1927-b531-401c-9cb2-ecf1f2836ba6",
    "name": "Airtable",
    "type": "n8n-nodes-base.airtable",
    "typeVersion": 2,
    "position": [
        1000,
        700
    ],
    "credentials": {
        "airtableTokenApi": {
        "id": "MIplo6lY3AEsdf7L",
        "name": "Airtable Personal Access Token account 4"
        }
    }
    },
    {
    "parameters": {
        "mode": "combine",
        "mergeByFields": {
        "values": [
            {
            "field1": "customerID",
            "field2": "customerID"
            }
        ]
        },
        "options": {}
    },
    "id": "1cddc984-7fca-45e0-83b8-0c502cb4c78c",
    "name": "Merge",
    "type": "n8n-nodes-base.merge",
    "typeVersion": 2.1,
    "position": [
        1220,
        600
    ]
    },
    {
    "parameters": {
        "sortFieldsUi": {
        "sortField": [
            {
            "fieldName": "orderPrice",
            "order": "descending"
            }
        ]
        },
        "options": {}
    },
    "id": "2f55af2e-f69b-4f61-a9e5-c7eefaad93ba",
    "name": "Sort",
    "type": "n8n-nodes-base.sort",
    "typeVersion": 1,
    "position": [
        1440,
        600
    ]
    },
    {
    "parameters": {
        "conditions": {
        "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
        },
        "conditions": [
            {
            "id": "d3afe65c-7c80-4caa-9d1c-33c62fbc2197",
            "leftValue": "={{ $json.region }}",
            "rightValue": "Americas",
            "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
            }
            }
        ],
        "combinator": "and"
        },
        "options": {}
    },
    "id": "2ed874a9-5bcf-4cc9-9b52-ea503a562892",
    "name": "If",
    "type": "n8n-nodes-base.if",
    "typeVersion": 2,
    "position": [
        1660,
        500
    ]
    },
    {
    "parameters": {
        "operation": "toJson",
        "mode": "each",
        "options": {
        "fileName": "=report_orderID_{{ $('If').item.json.orderID }}.json"
        }
    },
    "id": "d93b4429-2200-4a84-8505-16266fedfccd",
    "name": "Convert to File",
    "type": "n8n-nodes-base.convertToFile",
    "typeVersion": 1.1,
    "position": [
        1880,
        500
    ]
    },
    {
    "parameters": {
        "authentication": "webhook",
        "content": "I sent the file using email with the label ID  and wrote the binary file {file name}. My ID: 123",
        "options": {}
    },
    "id": "26f43f2c-1422-40de-9f40-dd2d80926b1c",
    "name": "Discord",
    "type": "n8n-nodes-base.discord",
    "typeVersion": 2,
    "position": [
        2320,
        500
    ],
    "credentials": {
        "discordWebhookApi": {
        "id": "WEBrtPdoLrhlDYKr",
        "name": "L2 Course Discord Webhook account"
        }
    }
    },
    {
    "parameters": {
        "batchSize": 5,
        "options": {}
    },
    "id": "0fa1fbf6-fe77-4044-a445-c49a1db37dec",
    "name": "Loop Over Items",
    "type": "n8n-nodes-base.splitInBatches",
    "typeVersion": 3,
    "position": [
        1660,
        700
    ]
    },
    {
    "parameters": {
        "assignments": {
        "assignments": [
            {
            "id": "ce839b80-c50d-48f5-9a24-bb2df6fdd2ff",
            "name": "customerEmail",
            "value": "={{ $json.customerEmail }}",
            "type": "string"
            },
            {
            "id": "0c613366-3808-45a2-89cc-b34c7b9f3fb7",
            "name": "region",
            "value": "={{ $json.region }}",
            "type": "string"
            },
            {
            "id": "0f19a88c-deb0-4119-8965-06ed62a840b2",
            "name": "customerSince",
            "value": "={{ $json.customerSince }}",
            "type": "string"
            },
            {
            "id": "a7e890d6-86af-4839-b5df-d2a4efe923f7",
            "name": "orderPrice",
            "value": "={{ $json.orderPrice }}",
            "type": "number"
            }
        ]
        },
        "options": {}
    },
    "id": "09b8584c-4ead-4007-a6cd-edaa4669a757",
    "name": "Edit Fields",
    "type": "n8n-nodes-base.set",
    "typeVersion": 3.3,
    "position": [
        1880,
        700
    ]
    },
    {
    "parameters": {
        "operation": "formatDate",
        "date": "={{ $json.customerSince }}",
        "options": {
        "includeInputFields": true
        }
    },
    "id": "c96fae90-e080-48dd-9bff-3e4506aafb86",
    "name": "Date & Time",
    "type": "n8n-nodes-base.dateTime",
    "typeVersion": 2,
    "position": [
        2100,
        700
    ]
    },
    {
    "parameters": {
        "options": {
        "fileName": "={{$runIndex > 0 ? 'file_low_orders':'file_high_orders'}}"
        }
    },
    "id": "43dc8634-2f16-442b-a754-89f47c51c591",
    "name": "Convert to File1",
    "type": "n8n-nodes-base.convertToFile",
    "typeVersion": 1.1,
    "position": [
        2320,
        700
    ]
    },
    {
    "parameters": {
        "authentication": "webhook",
        "content": "I created the spreadsheet {file name}. My ID: 123",
        "options": {}
    },
    "id": "05da1c22-d1f6-4ea6-9102-f74f9ae2e9d3",
    "name": "Discord1",
    "type": "n8n-nodes-base.discord",
    "typeVersion": 2,
    "position": [
        2540,
        700
    ],
    "credentials": {
        "discordWebhookApi": {
        "id": "WEBrtPdoLrhlDYKr",
        "name": "L2 Course Discord Webhook account"
        }
    }
    }
],
"connections": {
    "Gmail": {
    "main": [
        [
        {
            "node": "Discord",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "When clicking \"Execute workflow\"": {
    "main": [
        [
        {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
        },
        {
            "node": "Airtable",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "HTTP Request": {
    "main": [
        [
        {
            "node": "Merge",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Airtable": {
    "main": [
        [
        {
            "node": "Merge",
            "type": "main",
            "index": 1
        }
        ]
    ]
    },
    "Merge": {
    "main": [
        [
        {
            "node": "Sort",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Sort": {
    "main": [
        [
        {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
        },
        {
            "node": "If",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "If": {
    "main": [
        [
        {
            "node": "Convert to File",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Convert to File": {
    "main": [
        [
        {
            "node": "Gmail",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Loop Over Items": {
    "main": [
        null,
        [
        {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Edit Fields": {
    "main": [
        [
        {
            "node": "Date & Time",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Date & Time": {
    "main": [
        [
        {
            "node": "Convert to File1",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Convert to File1": {
    "main": [
        [
        {
            "node": "Discord1",
            "type": "main",
            "index": 0
        }
        ]
    ]
    },
    "Discord1": {
    "main": [
        [
        {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
        }
        ]
    ]
    }
},
"pinData": {}
}
```