{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "44FAF3FA-D711-4B33-9528-D1EEA6D33CCD",
    "name": "Cloudbrowser: browser-hours checked every morning"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -70,
        "y": 0,
        "zoom": 1
      },
      "autoSave": false,
      "descriptions": {
        "flow": "Every morning, reads the workspace's Cloudbrowser usage for the period (browser time included, used and remaining, running browsers against the concurrency limit, estimated overage and any billing block) and posts a short report to the team's Slack channel. Past the warning line, the report also lists each running browser with auto-pause off.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "Every morning, reads the workspace's Cloudbrowser usage for the period (browser time included, used and remaining, running browsers against the concurrency limit, estimated overage and any billing block) and posts a short report to the team's Slack channel. Past the warning line, the report also lists each running browser with auto-pause off.",
    "elements": [
      {
        "clientMetadata": {
          "notes": "Gets the workspace's plan and usage for the current period: browser-seconds included, used and remaining, running browsers against the concurrency limit, estimated overage and any billing block on starting browsers. Needs rest:read.",
          "elementId": "EXTENSION:::SHARED:::default:::cloudbrowser:::getUsage",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Read the usage Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::cloudbrowser:::getUsage",
          "legacyElementId": null,
          "methodName": "getUsage",
          "position": {
            "x": 110,
            "y": 40
          }
        },
        "flowElementId": "13573867-11EC-4007-AC06-F71E938BF6A3",
        "groupId": null,
        "id": "CE4FADF3-21BC-43F8-AE7B-93526BF728A6",
        "metaInfo": {
          "bodyParams": [],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getUsage",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Usage",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "cloudbrowser",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Read the usage",
        "nextElementIds": [
          "8F4612FA-4401-4837-ABD2-FEE6771F3FF1"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Work out the hours Result"
          },
          "position": {
            "x": 410,
            "y": 49
          }
        },
        "flowElementId": "0326D384-F8E6-4643-9757-6120A7DD1382",
        "groupId": null,
        "id": "8F4612FA-4401-4837-ABD2-FEE6771F3FF1",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "usage",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Usage",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "CE4FADF3-21BC-43F8-AE7B-93526BF728A6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threshold",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Warning threshold percent",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Warning threshold percent"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const u = usage || {};\nconst included = Number(u.includedSeconds) || 0;\nconst used = Number(u.usedSeconds) || 0;\nconst remaining = u.remainingSeconds != null ? Number(u.remainingSeconds) : Math.max(0, included - used);\nconst hours = (s) => Math.round(s / 360) / 10;\nconst percentUsed = included > 0 ? Math.round((used * 1000) / included) / 10 : 0;\nconst warningPercent = Number(threshold) || 80;\nreturn {\n  plan: u.plan || '',\n  includedHours: hours(included),\n  usedHours: hours(used),\n  remainingHours: hours(remaining),\n  percentUsed,\n  warningPercent,\n  pastWarning: included > 0 && percentUsed >= warningPercent,\n  runningBrowsers: u.runningBrowsers ?? 0,\n  concurrencyLimit: u.concurrencyLimit ?? null,\n  overageDollars: Math.round(Number(u.estimatedOverageCents) || 0) / 100,\n  blocked: Boolean(u.computeBlock) || u.billingIssue === true,\n  computeBlock: u.computeBlock || null,\n  periodEnds: u.periodEndsAt ? String(u.periodEndsAt).slice(0, 10) : '',\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Hours",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Work out the hours",
        "nextElementIds": [
          "F48B941C-7061-4D0D-9C6C-3E2705107F6C"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Lists the workspace's browsers, one page at a time, with their status, auto-pause setting and network state. Pass Next Cursor back as Cursor for the next page. Needs rest:read.",
          "elementId": "EXTENSION:::SHARED:::default:::cloudbrowser:::listBrowsers",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "List the browsers Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::cloudbrowser:::listBrowsers",
          "legacyElementId": null,
          "methodName": "listBrowsers",
          "position": {
            "x": 1055,
            "y": 40
          }
        },
        "flowElementId": "C810D6BF-0FF6-4E6A-A56C-47E4EA5BAA0D",
        "groupId": null,
        "id": "F3084832-03D9-430B-8209-43AC75907024",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "limit",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 100
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "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": "listBrowsers",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Browsers",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "cloudbrowser",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "List the browsers",
        "nextElementIds": [
          "234399F9-BD38-4EE9-BABB-F3C21FFBCFDE"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 727,
            "y": 49
          }
        },
        "flowElementId": "0ED60E56-06AC-400A-939E-45605C45A20B",
        "groupId": null,
        "id": "F48B941C-7061-4D0D-9C6C-3E2705107F6C",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "caacbaec-1fdb-48b3-815e-692d708ba46a",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Hours",
                      "subPathSegments": [
                        {
                          "key": "pastWarning",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "8F4612FA-4401-4837-ABD2-FEE6771F3FF1"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "caacbaec-1fdb-48b3-815e-692d708ba46a"
            ]
          },
          "elseComponent": {
            "componentId": "234399F9-BD38-4EE9-BABB-F3C21FFBCFDE",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Past warning",
          "storeResult": false,
          "thenComponent": {
            "componentId": "F3084832-03D9-430B-8209-43AC75907024",
            "componentType": "ELEMENT"
          }
        },
        "name": "Past the warning line?",
        "nextElementIds": [
          "F3084832-03D9-430B-8209-43AC75907024",
          "234399F9-BD38-4EE9-BABB-F3C21FFBCFDE"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Write the report Result"
          },
          "position": {
            "x": 1055,
            "y": 219
          }
        },
        "flowElementId": "CDD055AC-C9FC-4074-B075-5C0DB9A3221B",
        "groupId": null,
        "id": "234399F9-BD38-4EE9-BABB-F3C21FFBCFDE",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "hours",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Hours",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "8F4612FA-4401-4837-ABD2-FEE6771F3FF1"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "items",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Browsers",
                    "subPathSegments": [
                      {
                        "key": "items",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "F3084832-03D9-430B-8209-43AC75907024"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const h = hours || {};\nconst lines = [\n  `*Cloudbrowser this morning*${h.plan ? ` (${h.plan} plan` : ''}${h.periodEnds ? `${h.plan ? ', ' : ' ('}period ends ${h.periodEnds})` : (h.plan ? ')' : '')}`,\n  `Browser time: ${h.usedHours} of ${h.includedHours} hours used (${h.percentUsed}%), ${h.remainingHours} hours left.`,\n  `Running now: ${h.runningBrowsers}${h.concurrencyLimit != null ? ` of ${h.concurrencyLimit}` : ''} browsers.`,\n  h.overageDollars > 0 ? `Estimated overage so far: $${Number(h.overageDollars).toFixed(2)}.` : null,\n  h.blocked ? `Starting browsers is blocked right now${h.computeBlock ? `: ${typeof h.computeBlock === 'string' ? h.computeBlock : JSON.stringify(h.computeBlock)}` : ''}.` : null,\n];\nif (h.pastWarning) {\n  const running = (Array.isArray(items) ? items : []).filter((b) => b && b.status === 'running' && b.autoPause === false);\n  lines.push(`Past ${h.warningPercent}% of the included time.`);\n  lines.push(running.length ? `Running with auto-pause off (${running.length}), using the hours:` : 'No running browser has auto-pause off.');\n  for (const b of running) {\n    const since = String(b.updatedAt || b.createdAt || '').slice(0, 16).replace('T', ' ');\n    lines.push(`• ${b.name} (${b.id}), ${b.tabCount ?? 0} tab(s)${since ? `, since ${since} UTC` : ''}`);\n  }\n}\nreturn { text: lines.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": "Report",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Write the report",
        "nextElementIds": [
          "E1D28EA8-22F6-4967-893F-044E5C38E8E5"
        ],
        "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": "Post the report to the team Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 710,
            "y": 210
          }
        },
        "flowElementId": "387D3071-1BE1-4C1E-A48E-6D1602FD467E",
        "groupId": null,
        "id": "E1D28EA8-22F6-4967-893F-044E5C38E8E5",
        "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": "Report",
                    "subPathSegments": [
                      {
                        "key": "text",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "234399F9-BD38-4EE9-BABB-F3C21FFBCFDE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sendAsBot",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botIcon",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyBroadcast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageURL",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "blocks",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Report posted",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Post the report to the team",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "CE4FADF3-21BC-43F8-AE7B-93526BF728A6",
    "groups": [],
    "id": "04FA55FE-7333-47BB-9686-E62FE1CAC326",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": null,
        "valid": true
      },
      "errorMessage": null,
      "executionStaticData": [
        {
          "description": "Past this share of the plan's included browser time, the morning report also lists every running browser with auto-pause off.",
          "error": null,
          "name": "Warning threshold percent",
          "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-12-02T08:44:14.155Z"
}
