{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "4AAF9938-AB58-4263-A6E9-871A72C8B6AE",
    "name": "AWS Textract: new driver's CDL expiry logged"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -50.111176126389694,
        "y": 7.232299590403748,
        "zoom": 0.82
      },
      "autoSave": false,
      "descriptions": {
        "flow": "When a driver's CDL is emailed in, Textract reads the name, license number, class and expiry, and the license is logged in a Google Sheet. A license that is expired, expires soon, is the wrong class or reads poorly goes to the safety manager in Slack first.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "When a driver's CDL is emailed in, Textract reads the name, license number, class and expiry, and the license is logged in a Google Sheet. A license that is expired, expires soon, is the wrong class or reads poorly goes to the safety manager in Slack first.",
    "elements": [
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Check the license Result"
          },
          "position": {
            "x": 860,
            "y": 219
          }
        },
        "flowElementId": "FA0D6056-F50F-4837-9ABB-520CE23C4D84",
        "groupId": null,
        "id": "228B9B5F-10DD-49A0-BD69-A6739822B52F",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'Check the license', Error: The placeholder \"Answer link\" has no value",
            "valid": false
          },
          "codeArguments": [
            {
              "name": "id",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "CDL reading",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "4B8EA2D4-65FE-43E1-8C26-5B1CEE795780"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sender",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "CDL email",
                    "subPathSegments": [
                      {
                        "key": "fromAddress",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "1FA020A4-7D0A-424A-90A1-53565F2773E4"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "CDL file",
                    "subPathSegments": [
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "2C0EA26A-4ECB-43CA-82A7-353FB716EAB2"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "windowDays",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Days before expiry to flag",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Days before expiry to flag"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "classes",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "CDL classes accepted",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "CDL classes accepted"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "minConfidence",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Minimum read confidence",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Minimum read confidence"
                  }
                ],
                "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 fields = (id && id.fields) || {};\nconst docs = id && Array.isArray(id.identityDocuments) ? id.identityDocuments : [];\nconst raw = {};\nfor (const doc of docs) {\n  for (const f of doc.IdentityDocumentFields || []) {\n    const key = f.Type && f.Type.Text;\n    if (key) raw[key] = f;\n  }\n}\nconst val = (k) => (fields[k] && fields[k].value ? String(fields[k].value).trim() : '');\nconst conf = (k) => (fields[k] && fields[k].confidence != null ? Math.round(fields[k].confidence) : 0);\nconst parseDate = (k) => {\n  const det = raw[k] && raw[k].ValueDetection;\n  const norm = det && det.NormalizedValue && det.NormalizedValue.Value;\n  if (norm) {\n    const d = new Date(`${String(norm).slice(0, 10)}T00:00:00Z`);\n    if (!isNaN(d)) return d;\n  }\n  const m = val(k).match(/(\\d{1,2})[\\/\\-.](\\d{1,2})[\\/\\-.](\\d{2,4})/);\n  if (!m) return null;\n  const year = m[3].length === 2 ? 2000 + Number(m[3]) : Number(m[3]);\n  const d = new Date(Date.UTC(year, Number(m[1]) - 1, Number(m[2])));\n  return isNaN(d) ? null : d;\n};\nconst name = [val('FIRST_NAME'), val('MIDDLE_NAME'), val('LAST_NAME'), val('SUFFIX')].filter(Boolean).join(' ');\nconst number = val('DOCUMENT_NUMBER').replace(/\\s+/g, '');\nconst state = val('STATE_NAME') || val('STATE_IN_ADDRESS');\nconst licenseClass = val('CLASS').toUpperCase();\nconst expires = parseDate('EXPIRATION_DATE');\nconst today = new Date();\ntoday.setUTCHours(0, 0, 0, 0);\nconst daysLeft = expires ? Math.round((expires - today) / 86400000) : null;\nconst accepted = String(classes || '').toUpperCase().split(/[^A-Z]+/).filter(Boolean);\nconst classOk = !accepted.length || accepted.includes(licenseClass);\nconst minConf = Number(minConfidence || 0);\nconst lowRead = ['DOCUMENT_NUMBER', 'EXPIRATION_DATE', 'LAST_NAME'].some((k) => val(k) && conf(k) < minConf);\nconst flagDays = Number(windowDays || 0);\nconst problems = [\n  !number ? 'No license number could be read' : null,\n  !expires ? 'No expiry date could be read' : null,\n  daysLeft != null && daysLeft < 0 ? `Expired ${-daysLeft} days ago` : null,\n  daysLeft != null && daysLeft >= 0 && daysLeft <= flagDays ? `Expires in ${daysLeft} days` : null,\n  !classOk ? `Class ${licenseClass || 'not read'}, not ${accepted.join(' or ')}` : null,\n  lowRead ? `Textract is under ${minConf}% sure of the name, number or expiry` : null,\n].filter(Boolean);\nconst ok = problems.length === 0;\nconst iso = (d) => (d ? d.toISOString().slice(0, 10) : '');\nconst link = (decision) => `${answerLink}?execution=${encodeURIComponent(executionId)}&decision=${decision}`;\nconst button = (text, decision, primary) => Object.assign({ type: 'button', text: { type: 'plain_text', text }, url: link(decision) }, primary ? { style: 'primary' } : {});\nconst askText = `CDL for ${name || 'a new driver'} needs a look`;\nconst lines = [\n  `*${askText}*`,\n  `License ${number || '(no number read)'}${state ? `, ${state}` : ''}. Class ${licenseClass || 'not read'}${val('ENDORSEMENTS') ? `, endorsements ${val('ENDORSEMENTS')}` : ''}${val('RESTRICTIONS') ? `, restrictions ${val('RESTRICTIONS')}` : ''}`,\n  `Expires: ${iso(expires) || 'not read'}`,\n  ...problems.map((p) => `• ${p}`),\n  `Emailed by ${sender}. <${fileUrl}|Open the license>`,\n];\nreturn {\n  name,\n  number,\n  searchNumber: number || `not-read-${executionId}`,\n  state,\n  licenseClass,\n  endorsements: val('ENDORSEMENTS'),\n  restrictions: val('RESTRICTIONS'),\n  expires: iso(expires),\n  daysLeft,\n  ok,\n  problems,\n  askText,\n  askBlocks: [\n    { type: 'section', text: { type: 'mrkdwn', text: lines.join('\\n') } },\n    { type: 'actions', elements: [button('Cleared to drive', 'cleared', true), button('Hold off dispatch', 'hold')] },\n  ],\n};\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "License check",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Check the license",
        "nextElementIds": [
          "005A0C12-16BC-4858-9F8D-6015F5D83B80"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Finds a specific row in a specified sheet within a spreadsheet based on a column and value.",
          "elementId": "EXTENSION:::SHARED:::default:::google-sheets:::findSheetRows",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the driver in the log Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::google-sheets:::findSheetRows",
          "legacyElementId": "JS###v1###GoogleSheets###findSheetRows",
          "methodName": "findSheetRows",
          "position": {
            "x": 526,
            "y": 380
          }
        },
        "flowElementId": "433FA2E9-1288-41C3-8410-1B09066D8B7F",
        "groupId": null,
        "id": "CD88662E-7D9E-4B52-9F9C-B035069BC7BD",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "documentId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Driver license sheet",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Driver license sheet"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sheetId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 0
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "column",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "License number"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "value",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "License check",
                    "subPathSegments": [
                      {
                        "key": "searchNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "228B9B5F-10DD-49A0-BD69-A6739822B52F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "withRowNumbers",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Find the driver in the log', Error: The placeholder \"Driver license sheet\" has no value",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "findSheetRows",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Driver rows",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "google-sheets",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the driver in the log",
        "nextElementIds": [
          "B8DC9307-C09C-47D2-B966-AB634CEAAF9E"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "external-callback",
          "isFirstElement": false,
          "blockDefinitionId": "external-callback",
          "position": {
            "x": 110,
            "y": 389
          }
        },
        "flowElementId": "353DC1CD-BF2B-48AA-9482-A7A130293D5D",
        "groupId": null,
        "id": "2F642F5F-C2A2-4FF5-9A2D-A0CFB86DFDFA",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "resultAlias": "Safety decision",
          "slaConditions": [],
          "storeResult": true,
          "type": "CALLBACK"
        },
        "name": "Wait for the safety manager's answer",
        "nextElementIds": [
          "CD88662E-7D9E-4B52-9F9C-B035069BC7BD"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "notes": "Synchronously analyzes identity documents such as U.S. driver's licenses and passports and extracts identity fields. Supply the document as a FlowRunner file URL (single page, up to ~5 MB) or an S3 object. Returns a convenience \"fields\" map keyed by the normalized field type (e.g. FIRST_NAME, LAST_NAME, DATE_OF_BIRTH), each with its detected value and confidence, plus the raw IdentityDocuments array.",
          "elementId": "EXTENSION:::SHARED:::default:::aws-textract:::analyzeId",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Read the CDL Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::aws-textract:::analyzeId",
          "legacyElementId": "JS###v1###Textract###analyzeId",
          "methodName": "analyzeId",
          "position": {
            "x": 860,
            "y": 40
          }
        },
        "flowElementId": "EDFA021F-CCCC-4EE9-AD45-EE0801271F28",
        "groupId": null,
        "id": "4B8EA2D4-65FE-43E1-8C26-5B1CEE795780",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "CDL file",
                    "subPathSegments": [
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "2C0EA26A-4ECB-43CA-82A7-353FB716EAB2"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "s3Bucket",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "s3Name",
              "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": "analyzeId",
          "onFailElemId": "E9E5FEF9-6E3E-43C9-87B1-2FE271270533",
          "packageId": "default",
          "resultAlias": "CDL reading",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "aws-textract",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Read the CDL",
        "nextElementIds": [
          "228B9B5F-10DD-49A0-BD69-A6739822B52F"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "CDL not read Result"
          },
          "position": {
            "x": 1167,
            "y": 49
          }
        },
        "flowElementId": "3B4FAA93-19C8-40D1-8581-9E50AD21CFB1",
        "groupId": null,
        "id": "E9E5FEF9-6E3E-43C9-87B1-2FE271270533",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "CDL error",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "CDL not read",
        "nextElementIds": [
          "6DC3AF85-EC6C-4112-A915-D91FCAABC819"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 538,
            "y": 219
          }
        },
        "flowElementId": "ED862C67-EA7E-4259-94FF-6F280BD23B84",
        "groupId": null,
        "id": "005A0C12-16BC-4858-9F8D-6015F5D83B80",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "9f2c9af1-13fc-4e3b-9996-6bf06bc1ea00",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "License check",
                      "subPathSegments": [
                        {
                          "key": "ok",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "228B9B5F-10DD-49A0-BD69-A6739822B52F"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "9f2c9af1-13fc-4e3b-9996-6bf06bc1ea00"
            ]
          },
          "elseComponent": {
            "componentId": "476ED396-4297-467C-8B18-1A6F249A5584",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "License good",
          "storeResult": false,
          "thenComponent": {
            "componentId": "CD88662E-7D9E-4B52-9F9C-B035069BC7BD",
            "componentType": "ELEMENT"
          }
        },
        "name": "License good to log?",
        "nextElementIds": [
          "CD88662E-7D9E-4B52-9F9C-B035069BC7BD",
          "476ED396-4297-467C-8B18-1A6F249A5584"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "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,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Ask the safety manager Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 157,
            "y": 210
          }
        },
        "flowElementId": "79F999F7-AB99-48D9-9B1A-89DC17071384",
        "groupId": null,
        "id": "476ED396-4297-467C-8B18-1A6F249A5584",
        "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": "License check",
                    "subPathSegments": [
                      {
                        "key": "askText",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "228B9B5F-10DD-49A0-BD69-A6739822B52F"
                  }
                ],
                "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": "EXPRESSION",
                "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": "EXPRESSION",
                "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": "License check",
                    "subPathSegments": [
                      {
                        "key": "askBlocks",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "228B9B5F-10DD-49A0-BD69-A6739822B52F"
                  }
                ],
                "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 safety",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Ask the safety manager",
        "nextElementIds": [
          "2F642F5F-C2A2-4FF5-9A2D-A0CFB86DFDFA"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 852,
            "y": 559
          }
        },
        "flowElementId": "3D254CA6-83D4-441D-BE57-AD1BB85C9B83",
        "groupId": null,
        "id": "219DEDD6-95B0-458A-8C47-04CF8D7A2853",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "ff11dab4-b969-4500-8373-b50f309b20e6",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Log row",
                      "subPathSegments": [
                        {
                          "key": "exists",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "B8DC9307-C09C-47D2-B966-AB634CEAAF9E"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "ff11dab4-b969-4500-8373-b50f309b20e6"
            ]
          },
          "elseComponent": {
            "componentId": "F91B6E61-D39D-4B84-B572-47A28CAD2B20",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Already logged",
          "storeResult": false,
          "thenComponent": {
            "componentId": "90B94E66-AA22-483D-ACB0-42E9889DB2E1",
            "componentType": "ELEMENT"
          }
        },
        "name": "Driver already logged?",
        "nextElementIds": [
          "F91B6E61-D39D-4B84-B572-47A28CAD2B20",
          "90B94E66-AA22-483D-ACB0-42E9889DB2E1"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Adds new data rows to Google Sheets for AI agents to store processed results, log user interactions, or collect data from automated workflows. Perfect for building databases, tracking metrics, saving form submissions, or creating data collection pipelines.",
          "elementId": "EXTENSION:::SHARED:::default:::google-sheets:::addRow",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Add the driver to the log Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::google-sheets:::addRow",
          "legacyElementId": "JS###v1###GoogleSheets###addRow",
          "methodName": "addRow",
          "position": {
            "x": 525,
            "y": 680
          }
        },
        "flowElementId": "4B7245F0-ECC3-46EB-B6C5-AEC514E4F8E4",
        "groupId": null,
        "id": "F91B6E61-D39D-4B84-B572-47A28CAD2B20",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "documentId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Driver license sheet",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Driver license sheet"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sheetId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 0
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "row",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Log row",
                    "subPathSegments": [
                      {
                        "key": "row",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B8DC9307-C09C-47D2-B966-AB634CEAAF9E"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Add the driver to the log', Error: The placeholder \"Driver license sheet\" has no value",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "addRow",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Added row",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "google-sheets",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Add the driver to the log",
        "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,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Send unreadable CDL to safety Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 1467,
            "y": 40
          }
        },
        "flowElementId": "3C376932-3120-4613-A4EF-1CD531E3DC04",
        "groupId": null,
        "id": "6DC3AF85-EC6C-4112-A915-D91FCAABC819",
        "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": "Couldn't read the CDL "
                  },
                  {
                    "id": "RESULT",
                    "label": "CDL email",
                    "subPathSegments": [
                      {
                        "key": "attachments",
                        "optional": false
                      },
                      {
                        "index": 0,
                        "last": false
                      },
                      {
                        "key": "filename",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "1FA020A4-7D0A-424A-90A1-53565F2773E4"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " from "
                  },
                  {
                    "id": "RESULT",
                    "label": "CDL email",
                    "subPathSegments": [
                      {
                        "key": "fromAddress",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "1FA020A4-7D0A-424A-90A1-53565F2773E4"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " (subject: "
                  },
                  {
                    "id": "RESULT",
                    "label": "CDL email",
                    "subPathSegments": [
                      {
                        "key": "subject",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "1FA020A4-7D0A-424A-90A1-53565F2773E4"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "). "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "CDL error",
                    "subPathSegments": [
                      {
                        "key": "message",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E9E5FEF9-6E3E-43C9-87B1-2FE271270533"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " <"
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "CDL file",
                    "subPathSegments": [
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "2C0EA26A-4ECB-43CA-82A7-353FB716EAB2"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "|Open the file> and log it by hand."
                  }
                ],
                "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": "EXPRESSION",
                "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": "EXPRESSION",
                "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": "Unreadable CDL note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Send unreadable CDL to safety",
        "nextElementIds": [],
        "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": 168,
            "y": 40
          }
        },
        "flowElementId": "7F952512-7057-4361-824A-8F405CBFE236",
        "groupId": null,
        "id": "1FA020A4-7D0A-424A-90A1-53565F2773E4",
        "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": "CDL email",
          "serviceId": "gmail-service",
          "slaConditions": [],
          "staticData": {
            "query": "subject:(CDL OR \"driver license\" OR \"drivers license\" OR \"driver's license\") -in:sent",
            "includeSpamTrash": false
          },
          "storeResult": true,
          "subtype": "POLLING",
          "type": "CUSTOM"
        },
        "name": "New CDL email",
        "nextElementIds": [
          "2C0EA26A-4ECB-43CA-82A7-353FB716EAB2"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Build the log row Result"
          },
          "position": {
            "x": 860,
            "y": 389
          }
        },
        "flowElementId": "AA366799-FE95-4AB0-ACD0-B87EFB57D594",
        "groupId": null,
        "id": "B8DC9307-C09C-47D2-B966-AB634CEAAF9E",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "c",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "License check",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "228B9B5F-10DD-49A0-BD69-A6739822B52F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "decision",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Safety decision",
                    "subPathSegments": [
                      {
                        "key": "decision",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "2F642F5F-C2A2-4FF5-9A2D-A0CFB86DFDFA"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "rows",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Driver rows",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "CD88662E-7D9E-4B52-9F9C-B035069BC7BD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sender",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "CDL email",
                    "subPathSegments": [
                      {
                        "key": "fromAddress",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "1FA020A4-7D0A-424A-90A1-53565F2773E4"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "CDL email",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "1FA020A4-7D0A-424A-90A1-53565F2773E4"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const today = new Date().toISOString().slice(0, 10);\nconst problems = Array.isArray(c.problems) ? c.problems.join('; ') : '';\nlet status = 'OK';\nif (!c.ok) {\n  if (decision === 'cleared') status = `Cleared by safety ${today}: ${problems}`;\n  else if (decision === 'hold') status = `Off dispatch ${today}: ${problems}`;\n  else status = problems;\n}\nconst existing = Array.isArray(rows) && rows.length ? rows[0] : null;\nreturn {\n  exists: Boolean(existing && existing.rowNumber),\n  rowNumber: existing ? existing.rowNumber : null,\n  row: {\n    'Driver': c.name,\n    'License number': c.number,\n    'State': c.state,\n    'Class': c.licenseClass,\n    'Endorsements': c.endorsements,\n    'Restrictions': c.restrictions,\n    'Expires': c.expires,\n    'Status': status,\n    'Checked': today,\n    'Emailed by': sender,\n    'Email': `https://mail.google.com/mail/u/0/#all/${messageId}`,\n  },\n};\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Log row",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Build the log row",
        "nextElementIds": [
          "219DEDD6-95B0-458A-8C47-04CF8D7A2853"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Updates existing data in Google Sheets for AI agents to modify records, correct information, or maintain data accuracy in automated workflows. Perfect for updating user profiles, adjusting scores, or maintaining dynamic data that changes over time.",
          "elementId": "EXTENSION:::SHARED:::default:::google-sheets:::updateRow",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Update the driver's row Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::google-sheets:::updateRow",
          "legacyElementId": "JS###v1###GoogleSheets###updateRow",
          "methodName": "updateRow",
          "position": {
            "x": 528,
            "y": 550
          }
        },
        "flowElementId": "FD8E1287-6243-4D94-944F-42DCED861556",
        "groupId": null,
        "id": "90B94E66-AA22-483D-ACB0-42E9889DB2E1",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "documentId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Driver license sheet",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Driver license sheet"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sheetId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 0
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "rowNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Log row",
                    "subPathSegments": [
                      {
                        "key": "rowNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B8DC9307-C09C-47D2-B966-AB634CEAAF9E"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "rowData",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Log row",
                    "subPathSegments": [
                      {
                        "key": "row",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B8DC9307-C09C-47D2-B966-AB634CEAAF9E"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Update the driver's row', Error: The placeholder \"Driver license sheet\" has no value",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "updateRow",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Updated row",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "google-sheets",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Update the driver's row",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "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 CDL file Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::gmail-service:::saveAttachment",
          "legacyElementId": "JS###v1###GmailService###saveAttachment",
          "methodName": "saveAttachment",
          "position": {
            "x": 539,
            "y": 40
          }
        },
        "flowElementId": "46B87382-684D-41D1-9A9B-F4568AF2F235",
        "groupId": null,
        "id": "2C0EA26A-4ECB-43CA-82A7-353FB716EAB2",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "messageId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "CDL email",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "1FA020A4-7D0A-424A-90A1-53565F2773E4"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "attachmentId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "CDL email",
                    "subPathSegments": [
                      {
                        "key": "attachments",
                        "optional": false
                      },
                      {
                        "index": 0,
                        "last": false
                      },
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "1FA020A4-7D0A-424A-90A1-53565F2773E4"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "CDL email",
                    "subPathSegments": [
                      {
                        "key": "attachments",
                        "optional": false
                      },
                      {
                        "index": 0,
                        "last": false
                      },
                      {
                        "key": "filename",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "1FA020A4-7D0A-424A-90A1-53565F2773E4"
                  }
                ],
                "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": "CDL file",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "gmail-service",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Save the CDL file",
        "nextElementIds": [
          "4B8EA2D4-65FE-43E1-8C26-5B1CEE795780"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "1FA020A4-7D0A-424A-90A1-53565F2773E4",
    "groups": [],
    "id": "51F86211-14C2-44AD-B729-C7335398EEA2",
    "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 'Check the license' has an invalid configuration. Code Argument 'answerLink' has invalid value. Placeholder Data 'Answer link': value is required",
      "executionStaticData": [
        {
          "description": "The URL of the block Wait for the safety manager's answer. The Slack buttons open it.",
          "error": "Placeholder Data 'Answer link': value is required",
          "name": "Answer link",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "The URL or ID of the Google Sheet that logs driver licenses.",
          "error": null,
          "name": "Driver license sheet",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "A license that expires within this many days goes to the safety manager.",
          "error": null,
          "name": "Days before expiry to flag",
          "type": "INT",
          "value": ""
        },
        {
          "description": "License classes your drivers need, separated by commas. Leave empty to accept any class.",
          "error": null,
          "name": "CDL classes accepted",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "Textract's confidence in the name, number and expiry, 0 to 100. Below it, the safety manager is asked.",
          "error": null,
          "name": "Minimum read confidence",
          "type": "INT",
          "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-29T02:52:45.098Z"
}
