{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "342CCB4A-6BE9-4DA9-9364-33CFB9788661",
    "name": "Easyship: end-of-day courier manifests"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -26,
        "y": -522,
        "zoom": 1
      },
      "autoSave": true,
      "descriptions": {
        "flow": "Before the courier cutoff, gathers the day's labeled Easyship shipments, creates a manifest for each courier, checks every parcel is on its manifest, and posts the manifests and counts to the ops channel in Slack.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "Before the courier cutoff, gathers the day's labeled Easyship shipments, creates a manifest for each courier, checks every parcel is on its manifest, and posts the manifests and counts to the ops channel in Slack.",
    "elements": [
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Manifest failed Result"
          },
          "position": {
            "x": 400,
            "y": 160
          }
        },
        "flowElementId": "86C12CAB-FEDB-45FB-B463-039D8F48763D",
        "groupId": "345F03A8-30FD-4F4A-B3D3-532B6114A41A",
        "id": "33437593-1AED-4D5B-8ACF-7E039171AE82",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Manifest error",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "Manifest failed",
        "nextElementIds": [
          "60D08137-8FAD-4B5A-A1F1-0F7D773723F3"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "notes": "Generates a new end-of-day manifest for a courier, optionally restricted to a specific list of shipments. Use this once all of the day's labels are printed and ready for courier handover.",
          "elementId": "EXTENSION:::SHARED:::default:::easyship:::createManifest",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Create the manifest Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::easyship:::createManifest",
          "legacyElementId": "JS###v1###EasyshipService###createManifest",
          "methodName": "createManifest",
          "position": {
            "x": 110,
            "y": 40
          }
        },
        "flowElementId": "EF4FDC0B-D372-4145-8FC7-804E2B47706E",
        "groupId": "345F03A8-30FD-4F4A-B3D3-532B6114A41A",
        "id": "F2B4CDB3-5CBF-4A7A-8031-EF0DDC31F81A",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "courierId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "courierId",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "345F03A8-30FD-4F4A-B3D3-532B6114A41A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "shipmentIds",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "shipmentIds",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "345F03A8-30FD-4F4A-B3D3-532B6114A41A"
                  }
                ],
                "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": "createManifest",
          "onFailElemId": "33437593-1AED-4D5B-8ACF-7E039171AE82",
          "packageId": "default",
          "resultAlias": "Manifest",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "easyship",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Create the manifest",
        "nextElementIds": [
          "99FD8E04-CACF-4B7D-86CC-627FB37742EF"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Group labeled parcels by courier Result"
          },
          "position": {
            "x": 690,
            "y": 770
          }
        },
        "flowElementId": "7B0D557E-4793-4C59-8BCA-23670CE2DC82",
        "groupId": null,
        "id": "E1A4DA31-D9F3-4780-B629-E0F8042E14CA",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "shipments",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Shipments",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Shipments",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Shipments",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const ready = ['generated', 'printed'];\nconst list = Array.isArray(shipments) ? shipments : [];\nconst labeled = list.filter(s => ready.includes(String(s.label_state || '').toLowerCase()));\nconst byCourier = {};\nfor (const s of labeled) {\n  const cs = s.courier_service || {};\n  const id = cs.courier_id;\n  if (!id) continue;\n  if (!byCourier[id]) byCourier[id] = { courierId: id, courierName: cs.umbrella_name || cs.name || id, shipmentIds: [] };\n  byCourier[id].shipmentIds.push(s.easyship_shipment_id);\n}\nconst couriers = Object.values(byCourier).map(c => ({ ...c, count: c.shipmentIds.length }));\nreturn { couriers, labeled: labeled.length, withoutLabel: list.length - labeled.length, total: list.length };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Courier groups",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Group labeled parcels by courier",
        "nextElementIds": [
          "CEF7C68E-3353-40B8-9807-DC392C6DC530"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Manifests": "44971ee1-3f67-40d1-a825-0000f36908d4"
          },
          "position": {
            "x": 400,
            "y": 770
          }
        },
        "flowElementId": "6EF48A35-0B26-4AED-B0FB-739B61704173",
        "groupId": null,
        "id": "CEF7C68E-3353-40B8-9807-DC392C6DC530",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "Manifests",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EMPTY_LIST",
                    "label": null,
                    "type": "KEYWORD",
                    "value": "arrays.create()"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "b3",
          "storeResult": true
        },
        "name": "Start the manifest results",
        "nextElementIds": [],
        "nextGroupIds": [
          "345F03A8-30FD-4F4A-B3D3-532B6114A41A"
        ],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": true,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Manifests"
          },
          "position": {
            "x": 400,
            "y": 40
          }
        },
        "flowElementId": "44D37FDD-771A-4F10-AD21-77016520D642",
        "groupId": "345F03A8-30FD-4F4A-B3D3-532B6114A41A",
        "id": "99FD8E04-CACF-4B7D-86CC-627FB37742EF",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "results",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Manifests",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Manifests",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Manifests",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "manifest",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Manifest",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "F2B4CDB3-5CBF-4A7A-8031-EF0DDC31F81A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "courierName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "courierName",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "345F03A8-30FD-4F4A-B3D3-532B6114A41A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "expected",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "count",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "345F03A8-30FD-4F4A-B3D3-532B6114A41A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const list = Array.isArray(results) ? results : [];\nconst m = (manifest && manifest.manifest) || {};\nconst onManifest = Number(m.shipments_count);\nconst want = Number(expected);\nlist.push({\n  courier: courierName,\n  expected: want,\n  onManifest: Number.isFinite(onManifest) ? onManifest : null,\n  url: m.manifest_url || '',\n  ok: onManifest === want,\n});\nreturn list;"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Manifest check",
          "retryPolicy": null,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Manifests"
          },
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Check every parcel is on it",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Shipments": "683512af-a387-407a-b11e-c93ab872a222",
            "Page": "113f9852-a8f0-470f-8c18-511816cb7693",
            "More pages": "9ba6c084-7b46-4a87-9495-13217a5191fe"
          },
          "position": {
            "x": 400,
            "y": 580
          }
        },
        "flowElementId": "D7706CFB-7F8B-4141-9746-9CCEC7FD4733",
        "groupId": null,
        "id": "76FD9F74-057D-4B1B-B6A2-833583F47024",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "Shipments",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EMPTY_LIST",
                    "label": null,
                    "type": "KEYWORD",
                    "value": "arrays.create()"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "Page",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 1
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "More pages",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "b1",
          "storeResult": true
        },
        "name": "Start the shipment list",
        "nextElementIds": [],
        "nextGroupIds": [
          "975292C1-A433-400C-83E5-DD308703E9F9"
        ],
        "type": "DATA_BUCKET"
      },
      {
        "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": "Post the handover to ops Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 400,
            "y": 960
          }
        },
        "flowElementId": "7AF7F030-4E8D-486D-94CD-5518456D1D31",
        "groupId": null,
        "id": "5F50CC32-D547-42F8-A3B6-F60C7C795C95",
        "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": "Handover summary",
                    "subPathSegments": [
                      {
                        "key": "text",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1A5BCDDC-10F6-4A3B-A097-ED8CE9C8420B"
                  }
                ],
                "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": "Handover message",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Post the handover to ops",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Lists shipments from the Easyship account with rich filtering by date ranges, states, countries, and order numbers. Supports pagination for large result sets. Each shipment carries a nested courier_service object and a trackings array (there is no top-level tracking_number).",
          "elementId": "EXTENSION:::SHARED:::default:::easyship:::listShipments",
          "isFirstElement": true,
          "dynamicOptionLabels": {
            "shipmentState": {
              "created": "Created"
            }
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "List the day's shipments Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::easyship:::listShipments",
          "legacyElementId": "JS###v1###EasyshipService###listShipments",
          "methodName": "listShipments",
          "position": {
            "x": 110,
            "y": 400
          }
        },
        "flowElementId": "913F3A60-D9F4-41F1-87F0-06E45166CDDB",
        "groupId": "975292C1-A433-400C-83E5-DD308703E9F9",
        "id": "DE44CA55-0360-413E-803C-7BE15855DFE7",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "page",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Page",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Page",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Page",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "perPage",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 100
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "createdAtFrom",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Handover window",
                    "subPathSegments": [
                      {
                        "key": "since",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "85D2043F-CC22-4CCE-9C95-0B1CFAC7387F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "createdAtTo",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "shipmentState",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "created"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "originCountryAlpha2",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "destinationCountryAlpha2",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "platformOrderNumber",
              "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 page",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "easyship",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "List the day's shipments",
        "nextElementIds": [
          "1C7AF823-2B93-4883-AED2-48661123FC8D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": true,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Manifests"
          },
          "position": {
            "x": 400,
            "y": 280
          }
        },
        "flowElementId": "DBB5E5B3-DB7C-4536-8F74-C9E56C08BF7F",
        "groupId": "345F03A8-30FD-4F4A-B3D3-532B6114A41A",
        "id": "60D08137-8FAD-4B5A-A1F1-0F7D773723F3",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "results",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Manifests",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Manifests",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Manifests",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "courierName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "courierName",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "345F03A8-30FD-4F4A-B3D3-532B6114A41A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "expected",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "count",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "345F03A8-30FD-4F4A-B3D3-532B6114A41A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "message",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Manifest error",
                    "subPathSegments": [
                      {
                        "key": "message",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "33437593-1AED-4D5B-8ACF-7E039171AE82"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const list = Array.isArray(results) ? results : [];\nlist.push({ courier: courierName, expected: Number(expected), onManifest: 0, url: '', ok: false, error: String(message || 'Easyship refused the manifest.') });\nreturn list;"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Failed manifest",
          "retryPolicy": null,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Manifests"
          },
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Note the failed manifest",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Shipments": "1e04cf09-98e1-4d20-8c10-1c62517dc912",
            "Page": "dd26175c-e9f8-4aa0-be10-033b37764aa8",
            "More pages": "db77a4a6-64da-4bf7-91da-07ef6e2f0d79"
          },
          "position": {
            "x": 690,
            "y": 400
          }
        },
        "flowElementId": "E203752C-45F3-4E53-834D-34CE4F8D2859",
        "groupId": "975292C1-A433-400C-83E5-DD308703E9F9",
        "id": "5C98C1D6-C317-4A71-9C2C-3AEF78B9B558",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "Shipments",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Page result",
                    "subPathSegments": [
                      {
                        "key": "shipments",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1C7AF823-2B93-4883-AED2-48661123FC8D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "Page",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Page result",
                    "subPathSegments": [
                      {
                        "key": "next",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1C7AF823-2B93-4883-AED2-48661123FC8D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "More pages",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Page result",
                    "subPathSegments": [
                      {
                        "key": "more",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1C7AF823-2B93-4883-AED2-48661123FC8D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "b2",
          "storeResult": true
        },
        "name": "Keep the list and next page",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Write the handover summary Result"
          },
          "position": {
            "x": 110,
            "y": 960
          }
        },
        "flowElementId": "C539F2F1-1589-4EFB-B8A8-07DAAFD4C1F8",
        "groupId": null,
        "id": "1A5BCDDC-10F6-4A3B-A097-ED8CE9C8420B",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "results",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Manifests",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Manifests",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Manifests",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "groups",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Courier groups",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "E1A4DA31-D9F3-4780-B629-E0F8042E14CA"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "since",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Handover window",
                    "subPathSegments": [
                      {
                        "key": "since",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "85D2043F-CC22-4CCE-9C95-0B1CFAC7387F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const rows = Array.isArray(results) ? results : [];\nconst g = groups || {};\nif (!g.labeled) return { text: `*End-of-day handover*\\nNo labeled parcels in Easyship since ${since}. Nothing to hand over today.` };\nconst lines = [`*End-of-day handover: ${g.labeled} parcel${g.labeled === 1 ? '' : 's'}, ${rows.length} courier${rows.length === 1 ? '' : 's'}*`];\nfor (const r of rows) {\n  const link = r.url ? ` <${r.url}|Open the manifest>` : '';\n  if (r.error) lines.push(`:x: ${r.courier}: no manifest for ${r.expected} parcel${r.expected === 1 ? '' : 's'}. Easyship said: ${r.error}`);\n  else if (r.ok) lines.push(`:white_check_mark: ${r.courier}: all ${r.expected} parcel${r.expected === 1 ? '' : 's'} on the manifest.${link}`);\n  else lines.push(`:warning: ${r.courier}: ${r.onManifest == null ? 'an unknown number' : r.onManifest} of ${r.expected} parcels on the manifest. Find the missing ones before the courier leaves.${link}`);\n}\nlines.push(rows.every(r => r.ok) ? 'Every labeled parcel is on a manifest.' : 'Some parcels are not accounted for. Check the lines above before handover.');\nif (g.withoutLabel) lines.push(`${g.withoutLabel} shipment${g.withoutLabel === 1 ? ' has' : 's have'} no label yet and ${g.withoutLabel === 1 ? 'is' : 'are'} not on any manifest.`);\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": "Handover summary",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Write the handover summary",
        "nextElementIds": [
          "5F50CC32-D547-42F8-A3B6-F60C7C795C95"
        ],
        "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": 400,
            "y": 400
          }
        },
        "flowElementId": "99454E1A-8CE5-4C5B-B010-4F394357A8FC",
        "groupId": "975292C1-A433-400C-83E5-DD308703E9F9",
        "id": "1C7AF823-2B93-4883-AED2-48661123FC8D",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "collected",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Shipments",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Shipments",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Shipments",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "page",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Shipment page",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "DE44CA55-0360-413E-803C-7BE15855DFE7"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const list = Array.isArray(collected) ? collected : [];\nconst rows = page && Array.isArray(page.shipments) ? page.shipments : [];\nconst next = page && page.meta && page.meta.pagination ? page.meta.pagination.next : null;\nreturn { shipments: list.concat(rows), next: next || 0, more: Boolean(next) && rows.length > 0 };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Page result",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Add the page to the list",
        "nextElementIds": [
          "5C98C1D6-C317-4A71-9C2C-3AEF78B9B558"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": true,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Start of the handover day Result"
          },
          "position": {
            "x": 110,
            "y": 580
          }
        },
        "flowElementId": "F7412CCA-0136-4EB1-A9BF-F112FB946139",
        "groupId": null,
        "id": "85D2043F-CC22-4CCE-9C95-0B1CFAC7387F",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "hours",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Hours to look back",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Hours to look back"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const h = Number(hours) || 24;\nreturn { since: new Date(Date.now() - h * 3600 * 1000).toISOString() };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Handover window",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Start of the handover day",
        "nextElementIds": [
          "76FD9F74-057D-4B1B-B6A2-833583F47024"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "85D2043F-CC22-4CCE-9C95-0B1CFAC7387F",
    "groups": [
      {
        "clientMetadata": {
          "elementId": "repeat",
          "isFirstElement": false,
          "blockDefinitionId": "repeat",
          "viewport": {
            "x": -70,
            "y": -360,
            "zoom": 1
          },
          "position": {
            "x": 690,
            "y": 580
          }
        },
        "flowElementId": "1A5C2E6C-0191-4AA0-97E6-223793E0A2F3",
        "groupId": null,
        "id": "975292C1-A433-400C-83E5-DD308703E9F9",
        "loopType": "REPEAT",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "af6cc5bc-439b-44a3-894b-acb303aae6f7",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                      "label": "Default - More pages",
                      "subPathSegments": null,
                      "type": "EXECUTION_CONTEXT_PATH",
                      "value": "executionContext.dataBuckets.Default.More pages",
                      "valueSegments": [
                        {
                          "key": "executionContext",
                          "optional": false
                        },
                        {
                          "key": "dataBuckets",
                          "optional": false
                        },
                        {
                          "key": "Default",
                          "optional": false
                        },
                        {
                          "key": "More pages",
                          "optional": false
                        }
                      ]
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "af6cc5bc-439b-44a3-894b-acb303aae6f7"
            ]
          },
          "enabled": true,
          "firstElementId": "DE44CA55-0360-413E-803C-7BE15855DFE7",
          "maxIterations": 50,
          "onFailElemId": null,
          "resultAlias": "rep",
          "storeResult": true
        },
        "name": "Read every page of shipments",
        "nextElementIds": [
          "E1A4DA31-D9F3-4780-B629-E0F8042E14CA"
        ],
        "nextGroupIds": [],
        "type": "LOOP"
      },
      {
        "clientMetadata": {
          "elementId": "list-iterator",
          "isFirstElement": false,
          "blockDefinitionId": "list-iterator",
          "viewport": {
            "x": -70,
            "y": 0,
            "zoom": 1
          },
          "position": {
            "x": 110,
            "y": 770
          }
        },
        "flowElementId": "9FAAF603-DD8D-49A0-936C-25AE04B26457",
        "groupId": null,
        "id": "345F03A8-30FD-4F4A-B3D3-532B6114A41A",
        "loopType": "LIST_ITERATOR",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "enabled": true,
          "firstElementId": "F2B4CDB3-5CBF-4A7A-8031-EF0DDC31F81A",
          "list": {
            "expression": [
              {
                "id": "ELEMENT_RESULT",
                "label": "Courier groups",
                "subPathSegments": [
                  {
                    "key": "couriers",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "E1A4DA31-D9F3-4780-B629-E0F8042E14CA"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "onFailElemId": null,
          "resultAlias": "loop",
          "storeResult": true
        },
        "name": "Manifest each courier",
        "nextElementIds": [
          "1A5BCDDC-10F6-4A3B-A097-ED8CE9C8420B"
        ],
        "nextGroupIds": [],
        "type": "LOOP"
      }
    ],
    "id": "BE42C024-7902-498E-BFBF-6595D1A38A75",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": null,
        "valid": true
      },
      "errorMessage": null,
      "executionStaticData": [
        {
          "description": "How far back the flow looks for labeled shipments each run. 24 fits a flow that runs once a day before the courier cutoff.",
          "error": null,
          "name": "Hours to look back",
          "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-19T02:33:16.599Z"
}
