{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "6B976227-5476-4B7C-A462-3B551A72D304",
    "name": "McLeod: carrier invoice to QuickBooks bill"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -43.33333333333333,
        "y": 9.696969696969695,
        "zoom": 0.76
      },
      "autoSave": false,
      "descriptions": {
        "flow": "When a carrier emails an invoice, reads it, finds the load in McLeod LoadMaster and checks every line against the agreed carrier pay and extra pay. A match to the cent becomes a QuickBooks Online bill with the PDF attached and a copy filed on the movement; any variance goes to the AP lead in Slack.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "When a carrier emails an invoice, reads it, finds the load in McLeod LoadMaster and checks every line against the agreed carrier pay and extra pay. A match to the cent becomes a QuickBooks Online bill with the PDF attached and a copy filed on the movement; any variance goes to the AP lead in Slack.",
    "elements": [
      {
        "clientMetadata": {
          "notes": "Attaches a file, such as the vendor's PDF invoice or a scanned receipt, to an existing bill in QuickBooks Online. The file is downloaded from the given URL (for example a FlowRunner file URL from an earlier step) and uploaded as an attachment linked to the bill. Returns the created attachment.",
          "elementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::attachFileToBill",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Attach the invoice to the bill Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::attachFileToBill",
          "legacyElementId": "JS###v1###QuickBooksOnlineService###attachFileToBill",
          "methodName": "attachFileToBill",
          "position": {
            "x": 526,
            "y": 810
          }
        },
        "flowElementId": "E1519878-2F83-4A29-9835-6BD83D25E960",
        "groupId": null,
        "id": "E153FAB0-F429-4592-A805-8566CAB3E84F",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "billId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Bill",
                    "subPathSegments": [
                      {
                        "key": "Bill",
                        "optional": false
                      },
                      {
                        "key": "Id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B9C1D041-2C4D-4287-8ED3-54AADA9EAFB5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice file",
                    "subPathSegments": [
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "944CA909-0F53-4BED-9ACC-6C67A8FD6947"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Carrier invoice email",
                    "subPathSegments": [
                      {
                        "key": "attachments",
                        "optional": false
                      },
                      {
                        "index": 0,
                        "last": false
                      },
                      {
                        "key": "filename",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "3BF6BC0D-2A79-4E61-931F-64125AC985E3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "contentType",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "note",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "Carrier invoice for McLeod load "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", from "
                  },
                  {
                    "id": "RESULT",
                    "label": "Carrier invoice email",
                    "subPathSegments": [
                      {
                        "key": "fromAddress",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "3BF6BC0D-2A79-4E61-931F-64125AC985E3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Attach the invoice to the bill', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "attachFileToBill",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Invoice attachment",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "quickbooks-online",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Attach the invoice to the bill",
        "nextElementIds": [
          "180D05FA-D3BB-4175-AF18-AA46B64AEFB4"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Compare with the agreed carrier pay Result"
          },
          "position": {
            "x": 110,
            "y": 519
          }
        },
        "flowElementId": "4691432F-D8F8-4D9B-95C4-F48E0F14FFC6",
        "groupId": null,
        "id": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'Compare with the agreed carrier pay', Error: The placeholder \"Answer link\" has no value",
            "valid": false
          },
          "codeArguments": [
            {
              "name": "invoice",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDE3B65-01A3-4514-A652-C3573F04A366"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "match",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "McLeod match",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "DCE7BCBE-289F-43DA-ACEB-17FFE10035BB"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "vendors",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "QuickBooks carrier",
                    "subPathSegments": [
                      {
                        "key": "QueryResponse",
                        "optional": false
                      },
                      {
                        "key": "Vendor",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "23E3E35E-A317-49D7-8162-0A5D930463AF"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "accounts",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Carrier pay accounts",
                    "subPathSegments": [
                      {
                        "key": "QueryResponse",
                        "optional": false
                      },
                      {
                        "key": "Account",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E0381734-DCE7-45BB-AFAF-E99B53562CD2"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "bills",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Existing bills",
                    "subPathSegments": [
                      {
                        "key": "QueryResponse",
                        "optional": false
                      },
                      {
                        "key": "Bill",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9C58D370-C5FD-43DD-9733-C1B91F49F3D1"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "accountName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Carrier pay account",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Carrier pay account"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice file",
                    "subPathSegments": [
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "944CA909-0F53-4BED-9ACC-6C67A8FD6947"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "answerLink",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Answer link",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Answer link"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "executionId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_ID",
                    "label": null,
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.executionId",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "executionId",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const num = (v) => { const n = Number(v); return Number.isFinite(n) ? n : 0; };\nconst cents = (n) => Math.round(num(n) * 100) / 100;\nconst money = (n) => (n < 0 ? '-$' : '$') + Math.abs(num(n)).toFixed(2);\nconst same = (a, b) => Math.abs(num(a) - num(b)) < 0.005;\nconst categoryOf = (text) => {\n  const t = String(text || '').toLowerCase();\n  if (/deten|\\bdet\\b/.test(t)) return 'detention';\n  if (/lumper|\\blum\\b|unload/.test(t)) return 'lumper';\n  if (/layover|\\blay\\b/.test(t)) return 'layover';\n  if (/tonu|truck order not used/.test(t)) return 'tonu';\n  if (/fuel|\\bfsc\\b/.test(t)) return 'fuel';\n  if (/line ?haul|freight|flat rate|\\brate\\b/.test(t)) return 'linehaul';\n  return 'other';\n};\nconst clean = (s) => String(s || '').toLowerCase().replace(/[^a-z0-9 ]/g, ' ').replace(/\\b(inc|llc|ltd|co|corp|company|trucking|transport|transportation|logistics|express|freight|lines?)\\b/g, ' ').replace(/\\s+/g, ' ').trim();\n\nconst inv = invoice && typeof invoice === 'object' ? invoice : {};\nconst load = match && match.load ? match.load : {};\nconst moves = Array.isArray(load.movements) ? load.movements : [];\nconst movement = moves.find((m) => String(m.movementId) === String(load.currentMovementId)) || moves[moves.length - 1] || {};\nconst carrierName = (movement.carrier && movement.carrier.name) || (load.carrier && load.carrier.name) || '';\nconst pay = movement.carrierPay || load.carrierPay || {};\nconst extraPay = Array.isArray(movement.extraPay) && movement.extraPay.length ? movement.extraPay : (Array.isArray(load.carrierExtraPay) ? load.carrierExtraPay : []);\nconst orderId = String(load.orderId || '');\nconst proNumber = String(movement.proNumber || inv.proNumber || '');\nconst invoiceNumber = String(inv.invoiceNumber || '').trim();\n\nconst lines = (Array.isArray(inv.lines) ? inv.lines : []).filter((l) => l && num(l.amount) !== 0)\n  .map((l) => ({ description: String(l.description || ''), amount: cents(l.amount), category: ['linehaul', 'fuel', 'detention', 'lumper', 'layover', 'tonu', 'other'].includes(l.category) ? l.category : categoryOf(l.description) }));\nconst lineSum = cents(lines.reduce((s, l) => s + l.amount, 0));\nconst invoiceTotal = cents(num(inv.total) || lineSum);\nconst agreedLinehaul = cents(pay.amount);\nconst agreedTotal = cents(pay.totalPay != null ? pay.totalPay : num(pay.amount) + num(pay.otherPay));\n\nconst extras = extraPay.map((e) => ({ label: e.description || e.shortDescription || e.deductCodeId || 'Extra pay', amount: cents(e.amount), category: categoryOf(`${e.description || ''} ${e.shortDescription || ''} ${e.deductCodeId || ''}`), used: false }));\nlet linehaulBilled = 0;\nconst checked = lines.map((l) => {\n  if (l.category === 'linehaul') { linehaulBilled += l.amount; return Object.assign({ status: 'linehaul' }, l); }\n  const hit = extras.find((e) => !e.used && e.category === l.category && same(e.amount, l.amount));\n  if (hit) { hit.used = true; return Object.assign({ status: `matches extra pay \"${hit.label}\"` }, l); }\n  if (l.category === 'fuel') { linehaulBilled += l.amount; return Object.assign({ status: 'counted with the linehaul' }, l); }\n  return Object.assign({ status: 'no matching extra pay in McLeod', unmatched: true }, l);\n});\nlinehaulBilled = cents(linehaulBilled);\nconst unmatched = checked.filter((l) => l.unmatched);\nconst totalOk = invoiceTotal > 0 && same(invoiceTotal, agreedTotal);\nconst linehaulOk = same(linehaulBilled, agreedLinehaul);\nconst a = clean(inv.carrierName);\nconst b = clean(carrierName);\nconst carrierOk = !a || !b || a.includes(b) || b.includes(a);\nconst matches = totalOk && linehaulOk && unmatched.length === 0 && carrierOk;\n\nconst vendorList = Array.isArray(vendors) ? vendors : [];\nconst vendor = vendorList.find((v) => String(v.DisplayName || '').trim().toLowerCase() === carrierName.trim().toLowerCase()) || vendorList[0];\nconst vendorId = vendor ? String(vendor.Id) : '';\nconst accountList = Array.isArray(accounts) ? accounts : [];\nconst account = accountList.find((x) => String(x.Name || '').trim().toLowerCase() === String(accountName || '').trim().toLowerCase()) || accountList[0];\nconst accountId = account ? String(account.Id) : '';\nconst billList = Array.isArray(bills) ? bills : [];\nconst alreadyBooked = invoiceNumber !== '' && billList.some((x) => String(x.DocNumber || '').trim() === invoiceNumber && (!vendorId || !x.VendorRef || String(x.VendorRef.value) === vendorId));\n\nlet outcome = 'ask';\nif (alreadyBooked) outcome = 'already booked';\nelse if (!vendorId || !accountId) outcome = 'not set up';\nelse if (matches) outcome = 'book';\n\nconst hours = (from, to) => { const ms = new Date(to) - new Date(from); return Number.isFinite(ms) ? (ms / 3600000).toFixed(1) : null; };\nconst stops = Array.isArray(load.stops) ? load.stops : [];\nconst stopRows = stops.map((s) => {\n  const where = `${s.stopTypeDescription || s.stopType || 'Stop'} at ${s.locationName || s.city || ''}`;\n  if (!s.actualArrival) return `${where}: no actual arrival in McLeod`;\n  const late = s.scheduledArriveLate && new Date(s.actualArrival) > new Date(s.scheduledArriveLate) ? ', after the appointment window' : '';\n  const onSite = s.actualDeparture ? hours(s.actualArrival, s.actualDeparture) : null;\n  return `${where}: window ${s.scheduledArriveEarly || '?'} to ${s.scheduledArriveLate || '?'}, arrived ${s.actualArrival}${late}` + (onSite ? `, ${onSite} hours on site` : ', no departure recorded');\n});\n\nconst where = `load ${orderId}` + (proNumber ? `, PRO ${proNumber}` : '');\nconst head = `Carrier invoice ${invoiceNumber || '(no number)'} from ${inv.carrierName || carrierName || 'the carrier'} on ${where}`;\nconst comparison = [\n  `Billed ${money(invoiceTotal)}. Agreed carrier pay in McLeod ${money(agreedTotal)} (linehaul ${money(agreedLinehaul)}, extra pay ${money(agreedTotal - agreedLinehaul)}).`,\n  carrierOk ? null : `McLeod has ${carrierName || 'no carrier'} on this load, not ${inv.carrierName}.`,\n  linehaulOk ? null : `Linehaul billed ${money(linehaulBilled)}, agreed ${money(agreedLinehaul)}.`,\n  ...checked.map((l) => `${l.description || l.category}: ${money(l.amount)}, ${l.status}`),\n  ...(extras.length ? ['', '*Extra pay in McLeod*', ...extras.map((e) => `${e.label}: ${money(e.amount)}${e.used ? '' : ', not billed'}`)] : []),\n  ...(stopRows.length ? ['', '*Stop times in McLeod*', ...stopRows] : []),\n  '',\n  `<${fileUrl}|Open the invoice>`,\n].filter((x) => x !== null);\n\nconst link = (decision) => `${answerLink}?execution=${encodeURIComponent(executionId)}&decision=${decision}`;\nconst askText = `${head} does not match the agreed carrier pay`;\nconst askBlocks = [\n  { type: 'section', text: { type: 'mrkdwn', text: [`*${askText}*`, ...comparison].join('\\n') } },\n  { type: 'actions', elements: [\n    { type: 'button', style: 'primary', text: { type: 'plain_text', text: 'Book it' }, url: link('book') },\n    { type: 'button', text: { type: 'plain_text', text: 'Hold it' }, url: link('hold') },\n  ] },\n];\nconst reason = alreadyBooked\n  ? `a bill with number ${invoiceNumber} is already in QuickBooks Online, so it was skipped`\n  : [!vendorId ? `${carrierName || inv.carrierName || 'the carrier'} is not a vendor in QuickBooks Online` : null, !accountId ? `no QuickBooks account matches \"${accountName}\"` : null].filter(Boolean).join(', and ') + '. Set it up and book this invoice by hand';\nconst noticeText = [`*${head} was not booked:* ${reason}.`, ...comparison].join('\\n');\n\nlet billLines = lines.map((l) => ({\n  DetailType: 'AccountBasedExpenseLineDetail',\n  Amount: l.amount,\n  Description: `${l.description || l.category} (${where})`,\n  AccountBasedExpenseLineDetail: { AccountRef: { value: accountId } },\n}));\nif (!billLines.length || !same(lineSum, invoiceTotal)) {\n  billLines = [{ DetailType: 'AccountBasedExpenseLineDetail', Amount: invoiceTotal, Description: `Carrier invoice ${invoiceNumber} (${where})`, AccountBasedExpenseLineDetail: { AccountRef: { value: accountId } } }];\n}\nconst isDate = (d) => /^\\d{4}-\\d{2}-\\d{2}$/.test(String(d || ''));\nconst billDate = isDate(inv.invoiceDate) ? inv.invoiceDate : new Date().toISOString().slice(0, 10);\nconst dueDate = isDate(inv.dueDate) ? inv.dueDate : '';\nconst note = `McLeod ${where}. Agreed carrier pay ${money(agreedTotal)}, invoice ${money(invoiceTotal)}.` + (matches ? ' Matches McLeod.' : ' Booked after the AP lead approved it in Slack.');\n\nreturn { outcome, matches, orderId, movementId: String(movement.movementId || ''), carrierName, invoiceNumber, invoiceTotal, agreedTotal, vendorId, accountId, billLines, billDate, dueDate, note, askText, askBlocks, noticeText };\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Pay check",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Compare with the agreed carrier pay",
        "nextElementIds": [
          "4098578A-0702-4450-8731-3C10B9D13094"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Queries bills in QuickBooks Online with optional filtering. You can filter by vendor, bill number (exact or containing a text) and total amount range. Results are paginated and sorted by transaction date in descending order.",
          "elementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listBills",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Check for a duplicate bill Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listBills",
          "legacyElementId": "JS###v1###QuickBooksOnlineService###listBills",
          "methodName": "listBills",
          "position": {
            "x": 536,
            "y": 210
          }
        },
        "flowElementId": "A6D8747E-DF47-4187-8FD4-959C5B428691",
        "groupId": null,
        "id": "9C58D370-C5FD-43DD-9733-C1B91F49F3D1",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "vendorId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "maxResults",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "10"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "startPosition",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "docNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "invoiceNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDE3B65-01A3-4514-A652-C3573F04A366"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "search",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "minAmount",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "maxAmount",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Check for a duplicate bill', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "listBills",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Existing bills",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "quickbooks-online",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Check for a duplicate bill",
        "nextElementIds": [
          "E0381734-DCE7-45BB-AFAF-E99B53562CD2"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Triggers when an email with a new attachment is received. Polling interval can be customized (minimum 30 seconds).",
          "elementId": "EXTENSION:::SHARED:::default:::gmail-service:::onNewAttachment",
          "isFirstElement": true,
          "blockDefinitionId": "EXTENSION:::SHARED:::default:::gmail-service:::onNewAttachment",
          "newElementId": "EXTENSION:::SHARED:::default:::gmail-service:::onNewAttachment",
          "legacyElementId": "JS###v1###GmailService###onNewAttachment",
          "methodName": "onNewAttachment",
          "position": {
            "x": 149,
            "y": 40
          }
        },
        "flowElementId": "18B0D762-1F4B-4F28-B8BD-F8E2A7B11DAC",
        "groupId": null,
        "id": "3BF6BC0D-2A79-4E61-931F-64125AC985E3",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "connectionId": null,
          "dynamicData": [],
          "eventName": "onNewAttachment",
          "frequency": {
            "repeat": {
              "every": 300
            },
            "schedule": "custom"
          },
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Carrier invoice email",
          "serviceId": "gmail-service",
          "slaConditions": [],
          "staticData": {
            "query": "subject:invoice -in:sent"
          },
          "storeResult": true,
          "subtype": "POLLING",
          "type": "CUSTOM"
        },
        "name": "New carrier invoice email",
        "nextElementIds": [
          "944CA909-0F53-4BED-9ACC-6C67A8FD6947"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "notes": "Queries the chart of accounts in QuickBooks Online with optional filtering by name and account type. Results are paginated and sorted by name.",
          "elementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listAccounts",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the carrier pay account Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listAccounts",
          "legacyElementId": "JS###v1###QuickBooksOnlineService###listAccounts",
          "methodName": "listAccounts",
          "position": {
            "x": 139,
            "y": 210
          }
        },
        "flowElementId": "1480FD4B-55EB-4623-94A2-EF4B73092555",
        "groupId": null,
        "id": "E0381734-DCE7-45BB-AFAF-E99B53562CD2",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "search",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Carrier pay account",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Carrier pay account"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "accountType",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "maxResults",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "20"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "startPosition",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Find the carrier pay account', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "listAccounts",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Carrier pay accounts",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "quickbooks-online",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the carrier pay account",
        "nextElementIds": [
          "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends messages to Slack channels with optional Block Kit rich layouts. Supports plain text with Slack formatting, or advanced Block Kit JSON for buttons, menus, and interactive elements. Returns the message timestamp and channel ID for later updates or tracking.",
          "elementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "isFirstElement": false,
          "dynamicOptionLabels": {
            "channelId": {}
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Confirm the invoice is held Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 898,
            "y": 940
          }
        },
        "flowElementId": "0BB5B040-34A9-4048-B35D-F496028547CC",
        "groupId": null,
        "id": "167F6CE9-6CCA-4C6E-B061-824EC79BF271",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "Carrier invoice "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "invoiceNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " for load "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " is on hold. Nothing was entered in QuickBooks Online."
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Question to AP lead",
                    "subPathSegments": [
                      {
                        "key": "messageId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8FAB2BA8-B949-4536-A549-AD3EF8317EFA"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sendAsBot",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botIcon",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyBroadcast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageURL",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "blocks",
              "type": "COMPLEX_LIST",
              "value": []
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Held note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Confirm the invoice is held",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends messages to Slack channels with optional Block Kit rich layouts. Supports plain text with Slack formatting, or advanced Block Kit JSON for buttons, menus, and interactive elements. Returns the message timestamp and channel ID for later updates or tracking.",
          "elementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "isFirstElement": false,
          "dynamicOptionLabels": {
            "channelId": {}
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell AP why it wasn't booked Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 891,
            "y": 640
          }
        },
        "flowElementId": "5D95FE72-0356-49BF-A714-1B8BBB587E68",
        "groupId": null,
        "id": "46B1752F-3153-4B2A-A73E-487AF28D11D8",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "noticeText",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sendAsBot",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botIcon",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyBroadcast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageURL",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "blocks",
              "type": "COMPLEX_LIST",
              "value": []
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Not booked note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell AP why it wasn't booked",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends messages to Slack channels with optional Block Kit rich layouts. Supports plain text with Slack formatting, or advanced Block Kit JSON for buttons, menus, and interactive elements. Returns the message timestamp and channel ID for later updates or tracking.",
          "elementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "isFirstElement": false,
          "dynamicOptionLabels": {
            "channelId": {}
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Ask the AP lead Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 919,
            "y": 510
          }
        },
        "flowElementId": "00A05817-B945-45EB-A1AD-26EEB2126E98",
        "groupId": null,
        "id": "8FAB2BA8-B949-4536-A549-AD3EF8317EFA",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "askText",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sendAsBot",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botIcon",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyBroadcast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageURL",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "blocks",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "askBlocks",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Question to AP lead",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Ask the AP lead",
        "nextElementIds": [
          "6B4D8BE9-8005-4506-8495-784943CC2000"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Queries vendors in QuickBooks Online with optional search filtering. Search matches against the DisplayName field. Results are paginated and sorted by DisplayName.",
          "elementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listVendors",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the carrier in QuickBooks Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listVendors",
          "legacyElementId": "JS###v1###QuickBooksOnlineService###listVendors",
          "methodName": "listVendors",
          "position": {
            "x": 887,
            "y": 210
          }
        },
        "flowElementId": "FB464936-D1D1-4BA7-B725-53EE7A9D6008",
        "groupId": null,
        "id": "23E3E35E-A317-49D7-8162-0A5D930463AF",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "search",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "McLeod match",
                    "subPathSegments": [
                      {
                        "key": "load",
                        "optional": false
                      },
                      {
                        "key": "carrier",
                        "optional": false
                      },
                      {
                        "key": "name",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "DCE7BCBE-289F-43DA-ACEB-17FFE10035BB"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "maxResults",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "startPosition",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Find the carrier in QuickBooks', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "listVendors",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "QuickBooks carrier",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "quickbooks-online",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the carrier in QuickBooks",
        "nextElementIds": [
          "9C58D370-C5FD-43DD-9733-C1B91F49F3D1"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Creates a new bill in QuickBooks Online to record an amount owed to a vendor. Line items define the expenses or items being billed. Each line item should specify a DetailType and the corresponding detail object.",
          "elementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::createBill",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Create the bill Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::createBill",
          "legacyElementId": "JS###v1###QuickBooksOnlineService###createBill",
          "methodName": "createBill",
          "position": {
            "x": 919,
            "y": 810
          }
        },
        "flowElementId": "6657AB12-D463-4D1C-B4BE-88475683FE33",
        "groupId": null,
        "id": "B9C1D041-2C4D-4287-8ED3-54AADA9EAFB5",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "vendorId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "vendorId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lineItems",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "billLines",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dueDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "dueDate",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "txnDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "billDate",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "privateNote",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "note",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "docNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "invoiceNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Create the bill', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "createBill",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Bill",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "quickbooks-online",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Create the bill",
        "nextElementIds": [
          "E153FAB0-F429-4592-A805-8566CAB3E84F"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "ai-agent",
          "isFirstElement": false,
          "blockDefinitionId": "ai-agent",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Read the carrier invoice Result"
          },
          "tools": {},
          "position": {
            "x": 908,
            "y": 49
          }
        },
        "flowElementId": "1E7AD7DE-54A0-40E9-9B84-7318233CC1CD",
        "groupId": null,
        "id": "8BDE3B65-01A3-4514-A652-C3573F04A366",
        "metaInfo": {
          "aiApiKey": null,
          "aiModel": "claude-sonnet-5",
          "aiProvider": "ANTHROPIC",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "dynamicAiApiKey": {
            "expression": [
              {
                "id": "PLACEHOLDER_DATA",
                "label": "Anthropic key",
                "subPathSegments": null,
                "type": "EXECUTION_CONTEXT_STATIC_DATA",
                "value": "Anthropic key"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "files": [
            {
              "mimeType": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Carrier invoice email",
                    "subPathSegments": [
                      {
                        "key": "attachments",
                        "optional": false
                      },
                      {
                        "index": 0,
                        "last": false
                      },
                      {
                        "key": "mimetype",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "3BF6BC0D-2A79-4E61-931F-64125AC985E3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": "STRING"
              },
              "url": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice file",
                    "subPathSegments": [
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "944CA909-0F53-4BED-9ACC-6C67A8FD6947"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": "STRING"
              }
            }
          ],
          "forceParsedOutput": true,
          "langSmithSettings": {
            "enabled": false,
            "apiKey": null,
            "projectName": null,
            "label": "FlowRunner AI-Agent",
            "accountCluster": "US"
          },
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "messagesHistoryEnabled": false,
          "messagesHistoryLimit": 15,
          "onFailElemId": null,
          "resultAlias": "Invoice reading",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "systemPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "You read carrier invoices that trucking companies email to a freight broker's accounts payable inbox. From the attached invoice, reply with JSON only, with these fields:\ncarrierName: the carrier's company name as printed on the invoice\ninvoiceNumber: the carrier's invoice number\norderNumber: the broker's load or order number the invoice refers to (often labeled load #, order #, reference or broker ref), or empty text\nproNumber: the PRO number, or empty text\nbolNumber: the bill of lading number, or empty text\nlookup: an object with three fields, orderNumber, proNumber and billOfLading. Fill only the first of these that the invoice has, in this order: order number, then PRO number, then bill of lading number. Leave the other two as empty text.\ninvoiceDate: the invoice date as YYYY-MM-DD, or empty text\ndueDate: the due date as YYYY-MM-DD, or empty text\ntotal: the invoice total as a number\nlines: every charge on the invoice as a list of objects with description (as printed), category (one of linehaul, fuel, detention, lumper, layover, tonu, other) and amount (a number)"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "tools": [],
          "type": "AI_AGENT",
          "userPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "Email from "
              },
              {
                "id": "RESULT",
                "label": "Carrier invoice email",
                "subPathSegments": [
                  {
                    "key": "fromName",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "3BF6BC0D-2A79-4E61-931F-64125AC985E3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": " <"
              },
              {
                "id": "RESULT",
                "label": "Carrier invoice email",
                "subPathSegments": [
                  {
                    "key": "fromAddress",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "3BF6BC0D-2A79-4E61-931F-64125AC985E3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ">\nSubject: "
              },
              {
                "id": "RESULT",
                "label": "Carrier invoice email",
                "subPathSegments": [
                  {
                    "key": "subject",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "3BF6BC0D-2A79-4E61-931F-64125AC985E3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\n\n"
              },
              {
                "id": "RESULT",
                "label": "Carrier invoice email",
                "subPathSegments": [
                  {
                    "key": "snippet",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "3BF6BC0D-2A79-4E61-931F-64125AC985E3"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          }
        },
        "name": "Read the carrier invoice",
        "nextElementIds": [
          "DCE7BCBE-289F-43DA-ACEB-17FFE10035BB"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Finds a load by its order number, PRO number, bill of lading, consignee reference or a stop reference number (McLeod order tracking search) and returns the first match in full, as Get Load does, with every match listed. Returns found: false instead of failing when nothing matches.",
          "elementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::findLoadByNumber",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the load in McLeod Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::findLoadByNumber",
          "legacyElementId": null,
          "methodName": "findLoadByNumber",
          "position": {
            "x": 1275,
            "y": 40
          }
        },
        "flowElementId": "88D99927-DDCA-4E1A-AC07-29D2755DF8E2",
        "groupId": null,
        "id": "DCE7BCBE-289F-43DA-ACEB-17FFE10035BB",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "loadNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "lookup",
                        "optional": false
                      },
                      {
                        "key": "orderNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDE3B65-01A3-4514-A652-C3573F04A366"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "proNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "lookup",
                        "optional": false
                      },
                      {
                        "key": "proNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDE3B65-01A3-4514-A652-C3573F04A366"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "billOfLading",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "lookup",
                        "optional": false
                      },
                      {
                        "key": "billOfLading",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDE3B65-01A3-4514-A652-C3573F04A366"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "consigneeReference",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "referenceNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "findLoadByNumber",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "McLeod match",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "mcleod-loadmaster",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the load in McLeod",
        "nextElementIds": [
          "7ED4B6DB-58C9-4C87-AEB6-47869CD031BF"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends messages to Slack channels with optional Block Kit rich layouts. Supports plain text with Slack formatting, or advanced Block Kit JSON for buttons, menus, and interactive elements. Returns the message timestamp and channel ID for later updates or tracking.",
          "elementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "isFirstElement": false,
          "dynamicOptionLabels": {
            "channelId": {}
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell AP the load isn't in McLeod Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 882,
            "y": 340
          }
        },
        "flowElementId": "3110B0F4-F1C4-4E74-A1D4-1E47F6DC220F",
        "groupId": null,
        "id": "64D0E540-D2CD-4579-878E-7089FC07D398",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "*Carrier invoice "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "invoiceNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDE3B65-01A3-4514-A652-C3573F04A366"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " from "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "carrierName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDE3B65-01A3-4514-A652-C3573F04A366"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " matches no load in McLeod.* Order "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "orderNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDE3B65-01A3-4514-A652-C3573F04A366"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", PRO "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "proNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDE3B65-01A3-4514-A652-C3573F04A366"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", BOL "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "bolNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDE3B65-01A3-4514-A652-C3573F04A366"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", total "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "total",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDE3B65-01A3-4514-A652-C3573F04A366"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". Nothing was booked. <"
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice file",
                    "subPathSegments": [
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "944CA909-0F53-4BED-9ACC-6C67A8FD6947"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "|Open the invoice>"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sendAsBot",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botIcon",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyBroadcast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageURL",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "blocks",
              "type": "COMPLEX_LIST",
              "value": []
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "No load note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell AP the load isn't in McLeod",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "external-callback",
          "isFirstElement": false,
          "blockDefinitionId": "external-callback",
          "position": {
            "x": 1256,
            "y": 519
          }
        },
        "flowElementId": "1256D4A3-98DB-46CB-B069-49521101B9C6",
        "groupId": null,
        "id": "6B4D8BE9-8005-4506-8495-784943CC2000",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "resultAlias": "AP decision",
          "slaConditions": [],
          "storeResult": true,
          "type": "CALLBACK"
        },
        "name": "Wait for the AP lead's answer",
        "nextElementIds": [
          "AC1AE618-803A-465C-A691-5AEA83502850"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1287,
            "y": 819
          }
        },
        "flowElementId": "144A687D-FA1F-4A41-A043-8CADDFD027CE",
        "groupId": null,
        "id": "AC1AE618-803A-465C-A691-5AEA83502850",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "7d9898cc-8f17-4e3f-a2d0-e6083553d395",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "AP decision",
                      "subPathSegments": [
                        {
                          "key": "decision",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "6B4D8BE9-8005-4506-8495-784943CC2000"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "book"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "7d9898cc-8f17-4e3f-a2d0-e6083553d395"
            ]
          },
          "elseComponent": {
            "componentId": "167F6CE9-6CCA-4C6E-B061-824EC79BF271",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Book it",
          "storeResult": false,
          "thenComponent": {
            "componentId": "B9C1D041-2C4D-4287-8ED3-54AADA9EAFB5",
            "componentType": "ELEMENT"
          }
        },
        "name": "Book it?",
        "nextElementIds": [
          "167F6CE9-6CCA-4C6E-B061-824EC79BF271",
          "B9C1D041-2C4D-4287-8ED3-54AADA9EAFB5"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "router",
          "isFirstElement": false,
          "blockDefinitionId": "router",
          "casesViewMode": {
            "38df2608-5af0-4e98-8105-5bf50367f8df": "SIMPLE",
            "417f8883-c45b-4619-898d-3619206a35f3": "SIMPLE"
          },
          "position": {
            "x": 520,
            "y": 519
          }
        },
        "flowElementId": "1C3B807B-EDEA-4951-8B30-344A0078E028",
        "groupId": null,
        "id": "4098578A-0702-4450-8731-3C10B9D13094",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Invoice outcome",
          "storeResult": true,
          "switchCases": [
            {
              "defaultCase": false,
              "id": "38df2608-5af0-4e98-8105-5bf50367f8df",
              "label": "Matches McLeod: book it",
              "nextComponents": [
                {
                  "componentId": "B9C1D041-2C4D-4287-8ED3-54AADA9EAFB5",
                  "componentType": "ELEMENT"
                }
              ],
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "book"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "defaultCase": false,
              "id": "417f8883-c45b-4619-898d-3619206a35f3",
              "label": "Variance: ask the AP lead",
              "nextComponents": [
                {
                  "componentId": "8FAB2BA8-B949-4536-A549-AD3EF8317EFA",
                  "componentType": "ELEMENT"
                }
              ],
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "ask"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "defaultCase": true,
              "id": "de0d2963-d07d-4aed-b19e-0c4c0879ee93",
              "label": "Everything Else",
              "nextComponents": [
                {
                  "componentId": "46B1752F-3153-4B2A-A73E-487AF28D11D8",
                  "componentType": "ELEMENT"
                }
              ],
              "type": "SIMPLE",
              "value": null
            }
          ],
          "switchExpression": {
            "expression": [
              {
                "id": "ELEMENT_RESULT",
                "label": "Pay check",
                "subPathSegments": [
                  {
                    "key": "outcome",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          }
        },
        "name": "What happens to the invoice?",
        "nextElementIds": [
          "46B1752F-3153-4B2A-A73E-487AF28D11D8",
          "8FAB2BA8-B949-4536-A549-AD3EF8317EFA",
          "B9C1D041-2C4D-4287-8ED3-54AADA9EAFB5"
        ],
        "nextGroupIds": [],
        "type": "VALUE_ROUTER"
      },
      {
        "clientMetadata": {
          "notes": "Saves a Gmail attachment to FlowRunner Files and returns the file URL.",
          "elementId": "EXTENSION:::SHARED:::default:::gmail-service:::saveAttachment",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Save the carrier invoice Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::gmail-service:::saveAttachment",
          "legacyElementId": "JS###v1###GmailService###saveAttachment",
          "methodName": "saveAttachment",
          "position": {
            "x": 541,
            "y": 40
          }
        },
        "flowElementId": "12C597DE-3E40-4B31-B0B8-80002A4EB982",
        "groupId": null,
        "id": "944CA909-0F53-4BED-9ACC-6C67A8FD6947",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "messageId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Carrier invoice email",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "3BF6BC0D-2A79-4E61-931F-64125AC985E3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "attachmentId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Carrier invoice email",
                    "subPathSegments": [
                      {
                        "key": "attachments",
                        "optional": false
                      },
                      {
                        "index": 0,
                        "last": false
                      },
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "3BF6BC0D-2A79-4E61-931F-64125AC985E3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Carrier invoice email",
                    "subPathSegments": [
                      {
                        "key": "attachments",
                        "optional": false
                      },
                      {
                        "index": 0,
                        "last": false
                      },
                      {
                        "key": "filename",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "3BF6BC0D-2A79-4E61-931F-64125AC985E3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "saveAttachment",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Invoice file",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "gmail-service",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Save the carrier invoice",
        "nextElementIds": [
          "8BDE3B65-01A3-4514-A652-C3573F04A366"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1287,
            "y": 219
          }
        },
        "flowElementId": "D42AFCBB-E484-41F8-9857-6CE35B1B2B6F",
        "groupId": null,
        "id": "7ED4B6DB-58C9-4C87-AEB6-47869CD031BF",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "ac8d184c-6746-40e6-b957-50e681a91704",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "McLeod match",
                      "subPathSegments": [
                        {
                          "key": "found",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "DCE7BCBE-289F-43DA-ACEB-17FFE10035BB"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "ac8d184c-6746-40e6-b957-50e681a91704"
            ]
          },
          "elseComponent": {
            "componentId": "64D0E540-D2CD-4579-878E-7089FC07D398",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Load found",
          "storeResult": false,
          "thenComponent": {
            "componentId": "23E3E35E-A317-49D7-8162-0A5D930463AF",
            "componentType": "ELEMENT"
          }
        },
        "name": "Load found?",
        "nextElementIds": [
          "64D0E540-D2CD-4579-878E-7089FC07D398",
          "23E3E35E-A317-49D7-8162-0A5D930463AF"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Adds a document (rate confirmation, BOL, POD, invoice) to a load in McLeod Imaging, from a file URL such as a FlowRunner stored file or an email attachment. PDF, TIFF, PNG, JPEG, GIF and BMP are accepted. Some imaging setups stage uploads for a batch job, so the document may appear in McLeod later.",
          "elementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::uploadDocument",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "File the invoice on the movement Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::uploadDocument",
          "legacyElementId": null,
          "methodName": "uploadDocument",
          "position": {
            "x": 123,
            "y": 810
          }
        },
        "flowElementId": "A418875A-D1B5-4A8E-A7C1-2FF62BB3F9C8",
        "groupId": null,
        "id": "180D05FA-D3BB-4175-AF18-AA46B64AEFB4",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "orderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "attachTo",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "M"
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "movementId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Pay check",
                    "subPathSegments": [
                      {
                        "key": "movementId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D31E91CC-8110-43F9-A717-0BAB2DDF0A9B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "documentTypeId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Carrier invoice document type",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Carrier invoice document type"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice file",
                    "subPathSegments": [
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "944CA909-0F53-4BED-9ACC-6C67A8FD6947"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileType",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "uploadDocument",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Filed invoice",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "mcleod-loadmaster",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "File the invoice on the movement",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "3BF6BC0D-2A79-4E61-931F-64125AC985E3",
    "groups": [],
    "id": "1A74A43F-DE8C-4551-97EC-2B3F7B41F4E4",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
        "valid": false
      },
      "errorMessage": "Block 'Compare with the agreed carrier pay' has an invalid configuration. Code Argument 'answerLink' has invalid value. Placeholder Data 'Answer link': value is required",
      "executionStaticData": [
        {
          "description": "",
          "error": null,
          "name": "Anthropic key",
          "type": "API_KEY",
          "value": null
        },
        {
          "description": "The URL of the block Wait for the AP lead's answer. The Slack buttons open it.",
          "error": "Placeholder Data 'Answer link': value is required",
          "name": "Answer link",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "The QuickBooks Online account carrier bills are booked to.",
          "error": null,
          "name": "Carrier pay account",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "The McLeod Imaging document type your team files carrier invoices under on the movement.",
          "error": null,
          "name": "Carrier invoice document type",
          "type": "STRING",
          "value": ""
        }
      ],
      "initialData": null,
      "initialDataDefaultValues": {},
      "ownerFlowVersionId": null,
      "schedule": null,
      "sharedMemory": {
        "anchor": {
          "missingAnchorPolicy": null,
          "path": null,
          "type": "FLOW_MEMORY"
        },
        "expirationInSec": null
      },
      "wasLive": false
    }
  },
  "slaCalendars": [],
  "slaGoals": [],
  "subFlows": [],
  "exportDate": "2026-11-26T05:20:37.135Z"
}
