{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "0D95E509-9AA7-4003-9418-DBEB909DFC8C",
    "name": "UPS Quantum View: exceptions to customers or ops"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -70,
        "y": -360,
        "zoom": 1
      },
      "autoSave": false,
      "descriptions": {
        "flow": "Every 30 minutes, reads new UPS exceptions from Quantum View, finds each package's order in ShipStation, emails the customer about plain delays, and sends anything that needs a person to ops in Slack.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "Every 30 minutes, reads new UPS exceptions from Quantum View, finds each package's order in ShipStation, emails the customer about plain delays, and sends anything that needs a person to ops in Slack.",
    "elements": [
      {
        "clientMetadata": {
          "elementId": "ai-agent",
          "isFirstElement": false,
          "blockDefinitionId": "ai-agent",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Read what UPS says Result"
          },
          "tools": {},
          "position": {
            "x": 1169,
            "y": 139
          }
        },
        "flowElementId": "1BD72639-AC3A-4D54-B0CA-BE1BA26EA34E",
        "groupId": "5D49D31A-EEC6-4868-92BE-B10B298935C6",
        "id": "24FF8D08-6D22-4468-B835-CF4A2850A7E0",
        "metaInfo": {
          "aiApiKey": null,
          "aiModel": "claude-sonnet-5",
          "aiProvider": "ANTHROPIC",
          "clientValidationState": {
            "errorMessage": "Block: 'Read what UPS says', Error: The placeholder \"Company name\" has no value",
            "valid": false
          },
          "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": [],
          "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": "Exception reading",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "systemPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "You read UPS Quantum View exception events for the customer service team of a shipper or 3PL. Reply with JSON only, with these fields:\nkind: \"delay\" when the package is still on its way and nobody has to do anything but wait (weather, a late trailer or flight, a missed sort, an emergency, a new delivery date); \"action\" when someone has to do or decide something (an incomplete, wrong or corrected address, nobody available after a delivery attempt, held at a UPS Access Point or for pickup, refused, damaged, returning to the shipper, customs or missing paperwork, or anything you are not sure about)\nsummary: one plain sentence for the ops team saying what happened and what to do next\nsubject: an email subject for the customer that names the order number, or the tracking number when there is no order number\ncustomerNote: a short plain-text email to the customer saying their order is running late, the reason UPS gives in everyday words, the new delivery date when UPS gives one, and that they don't need to do anything. No long apology and no marketing. Sign it from "
              },
              {
                "id": "PLACEHOLDER_DATA",
                "label": "Company name",
                "subPathSegments": null,
                "type": "EXECUTION_CONTEXT_STATIC_DATA",
                "value": "Company name"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ". Write it for both kinds; ops sends it themselves when kind is action."
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "tools": [],
          "type": "AI_AGENT",
          "userPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "Tracking number: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Exception",
                "subPathSegments": [
                  {
                    "key": "trackingNumber",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nReference numbers on the label: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Exception",
                "subPathSegments": [
                  {
                    "key": "references",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nOrder number: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Order",
                "subPathSegments": [
                  {
                    "key": "orderNumber",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "12FC99F6-C91E-4F0D-9186-7C7DED923625"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nShip to: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Order",
                "subPathSegments": [
                  {
                    "key": "shipTo",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "12FC99F6-C91E-4F0D-9186-7C7DED923625"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ", "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Order",
                "subPathSegments": [
                  {
                    "key": "destination",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "12FC99F6-C91E-4F0D-9186-7C7DED923625"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nUPS status: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Exception",
                "subPathSegments": [
                  {
                    "key": "status",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nUPS reason: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Exception",
                "subPathSegments": [
                  {
                    "key": "reason",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nUPS resolution: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Exception",
                "subPathSegments": [
                  {
                    "key": "resolution",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nNew delivery date: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Exception",
                "subPathSegments": [
                  {
                    "key": "rescheduledDate",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nAddress UPS corrected to: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Exception",
                "subPathSegments": [
                  {
                    "key": "updatedAddress",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nLast scan: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Exception",
                "subPathSegments": [
                  {
                    "key": "place",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": " "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Exception",
                "subPathSegments": [
                  {
                    "key": "when",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          }
        },
        "name": "Read what UPS says",
        "nextElementIds": [
          "9E2E8622-8F74-4087-A161-315ECD338D57"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "bookmark": "d4ba828e-5b85-407e-a6a5-e833b730adc4",
            "events": "db63bbeb-115d-4105-8691-5b444b81e3e6",
            "more": "407a00f2-3bfb-4199-85bf-dd9db4e65140"
          },
          "position": {
            "x": 758,
            "y": 49
          }
        },
        "flowElementId": "25C38016-2078-4040-AF13-C47480962D4D",
        "groupId": "83F4402C-497B-4773-9E5F-FEDD3D268F83",
        "id": "BFE1FF68-32D4-43AA-9E80-FD23BF579636",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "bookmark",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Page tally",
                    "subPathSegments": [
                      {
                        "key": "bookmark",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDC0BDC-6CA4-4790-8469-B0BDA6A10426"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "events",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Page tally",
                    "subPathSegments": [
                      {
                        "key": "events",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDC0BDC-6CA4-4790-8469-B0BDA6A10426"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "more",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Page tally",
                    "subPathSegments": [
                      {
                        "key": "more",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8BDC0BDC-6CA4-4790-8469-B0BDA6A10426"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "keep",
          "storeResult": true
        },
        "name": "Keep the list",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1100,
            "y": 309
          }
        },
        "flowElementId": "1ADC4EA8-C8BF-4ED8-8C1A-D5004A06F618",
        "groupId": "5D49D31A-EEC6-4868-92BE-B10B298935C6",
        "id": "9E2E8622-8F74-4087-A161-315ECD338D57",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "464657b2-29e0-4c4c-99b7-39efb2bf077e",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Exception reading",
                      "subPathSegments": [
                        {
                          "key": "output",
                          "optional": false
                        },
                        {
                          "key": "kind",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "24FF8D08-6D22-4468-B835-CF4A2850A7E0"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "delay"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              },
              {
                "id": "ec4e466a-8c19-4ac1-b107-bc0839f08ae1",
                "nestedOperation": null,
                "operation": "isNotEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Order",
                      "subPathSegments": [
                        {
                          "key": "email",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "12FC99F6-C91E-4F0D-9186-7C7DED923625"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": []
              }
            ],
            "grouping": [
              "464657b2-29e0-4c4c-99b7-39efb2bf077e",
              "AND",
              "ec4e466a-8c19-4ac1-b107-bc0839f08ae1"
            ]
          },
          "elseComponent": {
            "componentId": "EE47F0BE-3236-4876-ABE8-130511685D8F",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Delay check",
          "storeResult": false,
          "thenComponent": {
            "componentId": "ACC18C85-6260-40B2-9691-2E60B09FD18A",
            "componentType": "ELEMENT"
          }
        },
        "name": "A delay the customer should hear about?",
        "nextElementIds": [
          "ACC18C85-6260-40B2-9691-2E60B09FD18A",
          "EE47F0BE-3236-4876-ABE8-130511685D8F"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Sends emails through Gmail for AI agents to automate customer communication.",
          "elementId": "EXTENSION:::SHARED:::default:::gmail-service:::sendMessage",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Email the customer Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::gmail-service:::sendMessage",
          "legacyElementId": "JS###v1###GmailService###sendMessage",
          "methodName": "sendMessage",
          "position": {
            "x": 795,
            "y": 430
          }
        },
        "flowElementId": "E444F4AC-961F-4519-8918-3BCC72A7B40B",
        "groupId": "5D49D31A-EEC6-4868-92BE-B10B298935C6",
        "id": "ACC18C85-6260-40B2-9691-2E60B09FD18A",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "to",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Order",
                    "subPathSegments": [
                      {
                        "key": "email",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "12FC99F6-C91E-4F0D-9186-7C7DED923625"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subject",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "subject",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "24FF8D08-6D22-4468-B835-CF4A2850A7E0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "bodyType",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "plain"
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "bodyContent",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "customerNote",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "24FF8D08-6D22-4468-B835-CF4A2850A7E0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "from",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cc",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "bcc",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "attachments",
              "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": "sendMessage",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Customer email",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "gmail-service",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Email the customer",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Retrieves Quantum View Exception events, the alerts UPS generates when a shipment encounters a problem such as an address correction, a delay, or a failed delivery attempt. Returns a flattened list of affected packages with tracking numbers, the exception reason, and the resolution status, so an AI agent can proactively surface shipments that need attention. Use the returned bookmark to page through additional data.",
          "elementId": "EXTENSION:::SHARED:::default:::ups-quantum-view:::getExceptionEvents",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get new UPS exceptions Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::ups-quantum-view:::getExceptionEvents",
          "legacyElementId": "JS###v1###UPSQuantumViewService###getExceptionEvents",
          "methodName": "getExceptionEvents",
          "position": {
            "x": 110,
            "y": 40
          }
        },
        "flowElementId": "1B4A376A-F4A4-4A3E-A45A-CE2624EBD4F9",
        "groupId": "83F4402C-497B-4773-9E5F-FEDD3D268F83",
        "id": "EAAEE893-F8F8-46FC-A1A9-4DA50D106C89",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "subscriptionName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Exception subscription",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Exception subscription"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "beginDateTime",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "endDateTime",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "bookmark",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - bookmark",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.bookmark",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "bookmark",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Get new UPS exceptions', Error: The placeholder \"Exception subscription\" has no value",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getExceptionEvents",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Exception page",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "ups-quantum-view",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Get new UPS exceptions",
        "nextElementIds": [
          "8BDC0BDC-6CA4-4790-8469-B0BDA6A10426"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Match the order Result"
          },
          "position": {
            "x": 795,
            "y": 139
          }
        },
        "flowElementId": "69D349A4-BB46-45B7-8170-42A2CDCF2DA6",
        "groupId": "5D49D31A-EEC6-4868-92BE-B10B298935C6",
        "id": "12FC99F6-C91E-4F0D-9186-7C7DED923625",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "result",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Shipment",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "FAED3D00-2BD8-4929-A9E3-271D6B73321A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "tracking",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception",
                    "subPathSegments": [
                      {
                        "key": "trackingNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const list = (result && Array.isArray(result.shipments)) ? result.shipments : [];\nconst s = tracking ? list.find((x) => x && x.trackingNumber === tracking && !x.voided) : null;\nif (!s) {\n  return { found: false, orderNumber: '', shipTo: '', destination: '', email: '' };\n}\nconst to = s.shipTo || {};\nreturn {\n  found: true,\n  orderNumber: String(s.orderNumber || ''),\n  shipTo: [to.name, to.company].filter(Boolean).join(', '),\n  destination: [to.city, to.state].filter(Boolean).join(', '),\n  email: s.customerEmail || '',\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Order",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Match the order",
        "nextElementIds": [
          "24FF8D08-6D22-4468-B835-CF4A2850A7E0"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Add the page to the list Result"
          },
          "position": {
            "x": 438,
            "y": 49
          }
        },
        "flowElementId": "5A02C871-01FD-4331-8A3E-136B9EFE72E8",
        "groupId": "83F4402C-497B-4773-9E5F-FEDD3D268F83",
        "id": "8BDC0BDC-6CA4-4790-8469-B0BDA6A10426",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "events",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - events",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.events",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "events",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageEvents",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception page",
                    "subPathSegments": [
                      {
                        "key": "events",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "EAAEE893-F8F8-46FC-A1A9-4DA50D106C89"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "bookmark",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception page",
                    "subPathSegments": [
                      {
                        "key": "bookmark",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "EAAEE893-F8F8-46FC-A1A9-4DA50D106C89"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const list = Array.isArray(events) ? events : [];\nconst page = Array.isArray(pageEvents) ? pageEvents : [];\nconst next = bookmark ? String(bookmark) : '';\nreturn { events: list.concat(page), bookmark: next, more: next !== '' };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Page tally",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Add the page to the list",
        "nextElementIds": [
          "BFE1FF68-32D4-43AA-9E80-FD23BF579636"
        ],
        "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 it to ops Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 463,
            "y": 300
          }
        },
        "flowElementId": "7405F5E2-9941-46C9-ADC2-2F2209B0EC4F",
        "groupId": "5D49D31A-EEC6-4868-92BE-B10B298935C6",
        "id": "C2E20BC1-52FA-46CA-8935-5C38000CB2A4",
        "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": "Ops note",
                    "subPathSegments": [
                      {
                        "key": "text",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "EE47F0BE-3236-4876-ABE8-130511685D8F"
                  }
                ],
                "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": "Ops message",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Send it to ops",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": true,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "bookmark": "5e51c515-07a4-486c-a2a9-14a2d2a96251",
            "events": "32b8cb67-c70c-4f50-8ed1-e6a59385b617",
            "more": "adc1bedb-af62-4ec1-9a11-1be012c314df"
          },
          "position": {
            "x": 110,
            "y": 400
          }
        },
        "flowElementId": "12ED3843-A385-4456-95D5-B9A165E36226",
        "groupId": null,
        "id": "D06478DB-9972-4447-B1E7-5DB2FEB44189",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "bookmark",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EMPTY_STRING",
                    "label": null,
                    "type": "KEYWORD",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "events",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "JSON",
                    "label": null,
                    "parsedValue": [],
                    "type": "INPUT",
                    "value": "[]"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "more",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "start",
          "storeResult": true
        },
        "name": "Start the exception list",
        "nextElementIds": [],
        "nextGroupIds": [
          "83F4402C-497B-4773-9E5F-FEDD3D268F83"
        ],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "notes": "Retrieves a paginated list of shipments matching optional filters such as recipient, carrier, service, tracking number, store, and date ranges. Useful for tracking dashboards or post-fulfillment automations.",
          "elementId": "EXTENSION:::SHARED:::default:::shipstation:::listShipments",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the order in ShipStation Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::shipstation:::listShipments",
          "legacyElementId": "JS###v1###ShipStation###listShipments",
          "methodName": "listShipments",
          "position": {
            "x": 435,
            "y": 130
          }
        },
        "flowElementId": "087B5747-A19C-4AA4-900D-77CE94C8F2D5",
        "groupId": "5D49D31A-EEC6-4868-92BE-B10B298935C6",
        "id": "FAED3D00-2BD8-4929-A9E3-271D6B73321A",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "recipientName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "recipientCountryCode",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "orderNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "orderId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "carrierCode",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "serviceCode",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "trackingNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception",
                    "subPathSegments": [
                      {
                        "key": "trackingNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "storeId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "createDateStart",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "createDateEnd",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "shipDateStart",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "shipDateEnd",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "includeShipmentItems",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sortBy",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sortDir",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "page",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageSize",
              "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": "listShipments",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Shipment",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "shipstation",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the order in ShipStation",
        "nextElementIds": [
          "12FC99F6-C91E-4F0D-9186-7C7DED923625"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Write the note for ops Result"
          },
          "position": {
            "x": 790,
            "y": 309
          }
        },
        "flowElementId": "9A04E333-6659-4174-835D-5E136160BD64",
        "groupId": "5D49D31A-EEC6-4868-92BE-B10B298935C6",
        "id": "EE47F0BE-3236-4876-ABE8-130511685D8F",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "tracking",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception",
                    "subPathSegments": [
                      {
                        "key": "trackingNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "order",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Order",
                    "subPathSegments": [
                      {
                        "key": "orderNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "12FC99F6-C91E-4F0D-9186-7C7DED923625"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "shipTo",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Order",
                    "subPathSegments": [
                      {
                        "key": "shipTo",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "12FC99F6-C91E-4F0D-9186-7C7DED923625"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "destination",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Order",
                    "subPathSegments": [
                      {
                        "key": "destination",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "12FC99F6-C91E-4F0D-9186-7C7DED923625"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Order",
                    "subPathSegments": [
                      {
                        "key": "email",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "12FC99F6-C91E-4F0D-9186-7C7DED923625"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception",
                    "subPathSegments": [
                      {
                        "key": "status",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "reason",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception",
                    "subPathSegments": [
                      {
                        "key": "reason",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "resolution",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception",
                    "subPathSegments": [
                      {
                        "key": "resolution",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "newDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception",
                    "subPathSegments": [
                      {
                        "key": "rescheduledDate",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "place",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception",
                    "subPathSegments": [
                      {
                        "key": "place",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "when",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception",
                    "subPathSegments": [
                      {
                        "key": "when",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "kind",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "kind",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "24FF8D08-6D22-4468-B835-CF4A2850A7E0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "summary",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "summary",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "24FF8D08-6D22-4468-B835-CF4A2850A7E0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "draft",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exception reading",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "customerNote",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "24FF8D08-6D22-4468-B835-CF4A2850A7E0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const lines = [\n  `*UPS exception on ${order ? 'order ' + order : 'tracking ' + tracking}*`,\n  `Tracking: ${tracking}`,\n  shipTo ? `Ship to: ${shipTo}${destination ? ' (' + destination + ')' : ''}` : 'No ShipStation shipment has this tracking number.',\n  `UPS says: ${[status, reason].filter(Boolean).join(', ') || 'no reason given'}`,\n  resolution ? `UPS resolution: ${resolution}` : null,\n  newDate ? `New delivery date: ${newDate}` : null,\n  (place || when) ? `Last scan: ${[place, when].filter(Boolean).join(', ')}` : null,\n  summary ? `Next step: ${summary}` : null,\n  (kind === 'delay' && !email) ? 'This is only a delay, but the order has no customer email, so the customer has not been told.' : null,\n  draft ? `Note for the customer, ready to send:\\n>${String(draft).split('\\n').join('\\n>')}` : null,\n].filter(Boolean);\nreturn { text: lines.join('\\n') };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Ops note",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Write the note for ops",
        "nextElementIds": [
          "C2E20BC1-52FA-46CA-8935-5C38000CB2A4"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": true,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Read the UPS exception Result"
          },
          "position": {
            "x": 110,
            "y": 139
          }
        },
        "flowElementId": "A1C3C9ED-27A6-4196-A8ED-C321F75735AA",
        "groupId": "5D49D31A-EEC6-4868-92BE-B10B298935C6",
        "id": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "item",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": null,
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "5D49D31A-EEC6-4868-92BE-B10B298935C6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const e = item || {};\nconst pkg = Array.isArray(e.Package) ? (e.Package[0] || {}) : (e.Package || {});\nconst values = (r) => [].concat(r || []).map((x) => (x && typeof x === 'object') ? (x.Value || x.value || '') : (x || '')).filter(Boolean);\nconst references = [...new Set([...values(e.ShipmentReferenceNumber), ...values(e.PackageReferenceNumber), ...values(pkg.PackageReferenceNumber), ...values(pkg.ReferenceNumber)])];\nconst ymd = (d) => (d && String(d).length >= 8) ? `${String(d).slice(0, 4)}-${String(d).slice(4, 6)}-${String(d).slice(6, 8)}` : '';\nconst hm = (t) => (t && String(t).length >= 4) ? `${String(t).slice(0, 2)}:${String(t).slice(2, 4)}` : '';\nconst activity = pkg.Activity || {};\nconst loc = e.ActivityLocation || {};\nconst art = loc.AddressArtifactFormat || {};\nconst desc = (v) => (v && typeof v === 'object') ? (v.Description || v.Code || '') : (v || '');\nreturn {\n  trackingNumber: e.TrackingNumber || pkg.TrackingNumber || '',\n  references: references.join(', '),\n  status: e.StatusDescription || desc(e.StatusType) || e.StatusCode || '',\n  reason: e.ReasonDescription || e.ReasonCode || '',\n  resolution: desc(e.Resolution),\n  rescheduledDate: ymd(e.RescheduledDeliveryDate),\n  updatedAddress: e.UpdatedAddress ? JSON.stringify(e.UpdatedAddress) : '',\n  place: [loc.City || art.PoliticalDivision2, loc.StateProvinceCode || art.PoliticalDivision1].filter(Boolean).join(', '),\n  when: [ymd(e.Date || activity.Date), hm(e.Time || activity.Time)].filter(Boolean).join(' '),\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Exception",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Read the UPS exception",
        "nextElementIds": [
          "FAED3D00-2BD8-4929-A9E3-271D6B73321A"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "D06478DB-9972-4447-B1E7-5DB2FEB44189",
    "groups": [
      {
        "clientMetadata": {
          "elementId": "list-iterator",
          "isFirstElement": false,
          "blockDefinitionId": "list-iterator",
          "viewport": {
            "x": -69.29737402413059,
            "y": -89.1696238466998,
            "zoom": 0.99
          },
          "position": {
            "x": 753,
            "y": 400
          }
        },
        "flowElementId": "BF0910FE-9570-41A7-90B2-39FA69D8EE87",
        "groupId": null,
        "id": "5D49D31A-EEC6-4868-92BE-B10B298935C6",
        "loopType": "LIST_ITERATOR",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'Work each exception', Error: Children have error",
            "valid": false
          },
          "enabled": true,
          "firstElementId": "B67219C9-9A8B-4202-AD48-FB07E9B96EA3",
          "list": {
            "expression": [
              {
                "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                "label": "Default - events",
                "subPathSegments": null,
                "type": "EXECUTION_CONTEXT_PATH",
                "value": "executionContext.dataBuckets.Default.events",
                "valueSegments": [
                  {
                    "key": "executionContext",
                    "optional": false
                  },
                  {
                    "key": "dataBuckets",
                    "optional": false
                  },
                  {
                    "key": "Default",
                    "optional": false
                  },
                  {
                    "key": "events",
                    "optional": false
                  }
                ]
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "onFailElemId": null,
          "resultAlias": "each",
          "storeResult": true
        },
        "name": "Work each exception",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "LOOP"
      },
      {
        "clientMetadata": {
          "elementId": "repeat",
          "isFirstElement": false,
          "blockDefinitionId": "repeat",
          "viewport": {
            "x": -70,
            "y": 0,
            "zoom": 1
          },
          "position": {
            "x": 426,
            "y": 400
          }
        },
        "flowElementId": "1EFDCB6F-B61E-40BE-9B5E-25BB8FB93002",
        "groupId": null,
        "id": "83F4402C-497B-4773-9E5F-FEDD3D268F83",
        "loopType": "REPEAT",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'Read the exception feed', Error: Children have error",
            "valid": false
          },
          "condition": {
            "conditionParts": [
              {
                "id": "eb2db498-e876-449c-ace3-f6c9da1b935e",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                      "label": "Default - more",
                      "subPathSegments": null,
                      "type": "EXECUTION_CONTEXT_PATH",
                      "value": "executionContext.dataBuckets.Default.more",
                      "valueSegments": [
                        {
                          "key": "executionContext",
                          "optional": false
                        },
                        {
                          "key": "dataBuckets",
                          "optional": false
                        },
                        {
                          "key": "Default",
                          "optional": false
                        },
                        {
                          "key": "more",
                          "optional": false
                        }
                      ]
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "eb2db498-e876-449c-ace3-f6c9da1b935e"
            ]
          },
          "enabled": true,
          "firstElementId": "EAAEE893-F8F8-46FC-A1A9-4DA50D106C89",
          "maxIterations": 20,
          "onFailElemId": null,
          "resultAlias": "feedLoop",
          "storeResult": true
        },
        "name": "Read the exception feed",
        "nextElementIds": [],
        "nextGroupIds": [
          "5D49D31A-EEC6-4868-92BE-B10B298935C6"
        ],
        "type": "LOOP"
      }
    ],
    "id": "7E8EB7A7-F3B7-4401-AA60-5C8EAFDCAB3B",
    "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": "Group 'Work each exception' has an invalid configuration. Block 'Read what UPS says' has an invalid configuration. System Prompt is not valid. Placeholder Data 'Company name': value is required",
      "executionStaticData": [
        {
          "description": "",
          "error": null,
          "name": "Anthropic key",
          "type": "API_KEY",
          "value": null
        },
        {
          "description": "The name of your UPS Quantum View subscription for exception events (up to 21 letters and digits).",
          "error": null,
          "name": "Exception subscription",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "Your company name, used to sign the delay emails to customers.",
          "error": "Placeholder Data 'Company name': value is required",
          "name": "Company name",
          "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-26T09:36:35.483Z"
}
