{
  "name": "Nathan's workflow",
  "nodes": [
    {
      "parameters": {
        "operation": "create",
        "base": {
          "__rl": true,
          "value": "appiIPF9XQ89DsLIJ",
          "mode": "list",
          "cachedResultName": "orders",
          "cachedResultUrl": "https://airtable.com/appiIPF9XQ89DsLIJ"
        },
        "table": {
          "__rl": true,
          "value": "tbleyrel9rqkh0jsG",
          "mode": "list",
          "cachedResultName": "ProcessingOrders",
          "cachedResultUrl": "https://airtable.com/appiIPF9XQ89DsLIJ/tbleyrel9rqkh0jsG"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "orderID": "={{ $json.orderID }}",
            "employeeName": "={{ $json.employeeName }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "orderID",
              "displayName": "orderID",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "number",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "customerID",
              "displayName": "customerID",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "number",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "employeeName",
              "displayName": "employeeName",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "orderPrice",
              "displayName": "orderPrice",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "number",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "orderStatus",
              "displayName": "orderStatus",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.2,
      "position": [
        240,
        -240
      ],
      "id": "29cbc74b-1862-4e74-8c64-898eef912cd5",
      "name": "Create a record",
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "https://internal.users.n8n.cloud/webhook/custom-erp",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "unique_id",
              "value": "21da1492a7db4c4d69ba4e70c0d68434"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        -304,
        -96
      ],
      "id": "e334eee6-6805-409a-876d-7b21283eb8c5",
      "name": "HTTP Request",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "83440bd9-b559-4d80-aae4-9cbf952b2583",
              "leftValue": "={{ $json.orderStatus }}",
              "rightValue": "=processing",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            },
            {
              "id": "82250ccf-4620-4d04-b95c-b982559bf742",
              "leftValue": "={{ $json.employeeName }}",
              "rightValue": "Mario",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        -128,
        -96
      ],
      "id": "aafc1f65-a53a-4997-a2c8-402147e7b780",
      "name": "If"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "821cbed0-872e-4bed-98e0-7ea49eb5c9a1",
              "name": "orderID",
              "value": "={{ $json.orderID }}",
              "type": "number"
            },
            {
              "id": "d3ad42ab-5ba5-43b8-91ef-1bac492c8445",
              "name": "employeeName",
              "value": "={{ $json.employeeName }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        48,
        -240
      ],
      "id": "7455ee4b-c515-45d0-909b-7d1bedf3d8c4",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "jsCode": "let items = $input.all();\nlet totalBooked = items.length;\nlet bookedSum = 0;\n\nfor (let i=0; i < items.length; i++) {\n  bookedSum = bookedSum + items[i].json.orderPrice;\n}\n\nreturn [{ json: {totalBooked, bookedSum} }];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        48,
        16
      ],
      "id": "c3b9162a-71a8-4349-b7cf-d4307f065dc9",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "authentication": "webhook",
        "content": "=This week we've {{ $json.totalBooked }} booked orders with a total value of {{$json[\"bookedSum\"]}}. My Unique ID: {{ $('HTTP Request').params[\"headerParameters\"][\"parameters\"][0][\"value\"] }}",
        "options": {}
      },
      "type": "n8n-nodes-base.discord",
      "typeVersion": 2,
      "position": [
        240,
        16
      ],
      "id": "c8acfe45-2f7d-47ce-84ca-5787aee728af",
      "name": "Discord",
      "credentials": {
        "discordWebhookApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 9
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        -512,
        -96
      ],
      "id": "588e87ac-0f90-4b1d-bd63-9497834dcbe7",
      "name": "Schedule Trigger"
    }
  ],
  "connections": {
    "HTTP Request": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Create a record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Discord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "timeSavedMode": "fixed",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false
  },
  "versionId": "c51867a2-7de3-456b-80ed-ec3a071cca96",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "MlUchRlpMFOcg4On",
  "tags": []
}