{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "F7418E00-A19D-47D9-80A8-DCC45FA17D9B",
    "name": "Jotform: intake form insurance checked with Stedi"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -70,
        "y": -640,
        "zoom": 1
      },
      "autoSave": false,
      "descriptions": {
        "flow": "Checks your Jotform new-patient intake form for new submissions. For each new form, reads the insurance the patient gave, finds the payer in Stedi and runs an eligibility check for the first visit date on the form, or today. A missing payer or member ID, a payer Stedi can't find, a failed or rejected check, or inactive coverage goes to the front desk in Slack with the patient's details. Self-pay patients are skipped. Run it on a schedule, for example every 15 minutes.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "Checks your Jotform new-patient intake form for new submissions, reads the insurance each patient gave, finds the payer in Stedi and runs an eligibility check. A missing payer or member ID, a failed or rejected check, or inactive coverage goes to the front desk in Slack.",
    "elements": [
      {
        "clientMetadata": {
          "notes": "Runs a real-time insurance eligibility check (270/271) with the patient's payer and returns the full response plus a summary to branch on: whether coverage is active, plan and group, copays, coinsurance, deductibles, out-of-pocket amounts, prior authorization flags and any payer rejection.",
          "elementId": "EXTENSION:::SHARED:::default:::stedi:::checkEligibility",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Check eligibility in Stedi Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::stedi:::checkEligibility",
          "legacyElementId": null,
          "methodName": "checkEligibility",
          "position": {
            "x": 790,
            "y": 470
          }
        },
        "flowElementId": "C88A9345-6B77-4287-AEF0-FD7EB7C5CC3C",
        "groupId": "AC67100E-E50B-4004-8846-469E9A52C2F3",
        "id": "55E5123B-4629-41DD-81A6-C92E76C7C948",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "payerId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check details",
                    "subPathSegments": [
                      {
                        "key": "payerId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "139B1860-C4BB-42E3-9846-0238BA214CED"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "providerNpi",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Practice NPI",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Practice NPI"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "providerOrganizationName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "providerFirstName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "providerLastName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "memberId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check details",
                    "subPathSegments": [
                      {
                        "key": "memberId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "139B1860-C4BB-42E3-9846-0238BA214CED"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check details",
                    "subPathSegments": [
                      {
                        "key": "firstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "139B1860-C4BB-42E3-9846-0238BA214CED"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check details",
                    "subPathSegments": [
                      {
                        "key": "lastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "139B1860-C4BB-42E3-9846-0238BA214CED"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check details",
                    "subPathSegments": [
                      {
                        "key": "dateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "139B1860-C4BB-42E3-9846-0238BA214CED"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "gender",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "groupNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check details",
                    "subPathSegments": [
                      {
                        "key": "groupNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "139B1860-C4BB-42E3-9846-0238BA214CED"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dependentFirstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check details",
                    "subPathSegments": [
                      {
                        "key": "dependentFirstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "139B1860-C4BB-42E3-9846-0238BA214CED"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dependentLastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check details",
                    "subPathSegments": [
                      {
                        "key": "dependentLastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "139B1860-C4BB-42E3-9846-0238BA214CED"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dependentDateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check details",
                    "subPathSegments": [
                      {
                        "key": "dependentDateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "139B1860-C4BB-42E3-9846-0238BA214CED"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dependentRelationship",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "serviceTypeCodes",
              "type": "SIMPLE_LIST",
              "value": [
                {
                  "expression": [
                    {
                      "id": "TEXT",
                      "label": null,
                      "type": "INPUT",
                      "value": "30"
                    }
                  ],
                  "mode": "BASIC",
                  "parseJsonString": false,
                  "resultType": null
                }
              ]
            },
            {
              "name": "dateOfService",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check details",
                    "subPathSegments": [
                      {
                        "key": "dateOfService",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "139B1860-C4BB-42E3-9846-0238BA214CED"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "patientId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Check eligibility in Stedi', Error: The placeholder \"Practice NPI\" has no value",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "checkEligibility",
          "onFailElemId": "8FFE7BB6-9D8B-4AAD-B69F-405BC8D55A7F",
          "packageId": "default",
          "resultAlias": "Eligibility",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "stedi",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Check eligibility in Stedi",
        "nextElementIds": [
          "CDFA04BF-C1CE-4D32-9928-F8880F692D8C"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Searches Stedi's payer network by name, payer ID or alias (fuzzy, case-insensitive), optionally only payers that support eligibility checks, and returns each payer's IDs and supported transactions.",
          "elementId": "EXTENSION:::SHARED:::default:::stedi:::searchPayers",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the payer in Stedi Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::stedi:::searchPayers",
          "legacyElementId": null,
          "methodName": "searchPayers",
          "position": {
            "x": 795,
            "y": 40
          }
        },
        "flowElementId": "010BC7CD-2434-4942-81E2-AB66615C693B",
        "groupId": "AC67100E-E50B-4004-8846-469E9A52C2F3",
        "id": "C4F0FA0B-FF8A-4AEE-8DE6-D708CD3D4F73",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "query",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Coverage",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "payerSearch",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A22A41E7-3319-4A49-944A-4FB145378598"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "eligibilityCheck",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "EITHER"
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageSize",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 10
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageToken",
              "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": "searchPayers",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Payers",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "stedi",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the payer in Stedi",
        "nextElementIds": [
          "139B1860-C4BB-42E3-9846-0238BA214CED"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "ai-agent",
          "isFirstElement": true,
          "blockDefinitionId": "ai-agent",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Read the insurance answers Result"
          },
          "tools": {},
          "position": {
            "x": 115,
            "y": 49
          }
        },
        "flowElementId": "000859AC-D957-4A9A-AA1A-791E46E1BFBC",
        "groupId": "AC67100E-E50B-4004-8846-469E9A52C2F3",
        "id": "A22A41E7-3319-4A49-944A-4FB145378598",
        "metaInfo": {
          "aiApiKey": null,
          "aiModel": "claude-sonnet-5",
          "aiProvider": "ANTHROPIC",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "dynamicAiApiKey": {
            "expression": [
              {
                "id": "PLACEHOLDER_DATA",
                "label": "Anthropic key",
                "subPathSegments": null,
                "type": "EXECUTION_CONTEXT_STATIC_DATA",
                "value": "Anthropic key"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "files": [],
          "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": "Coverage",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "systemPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "You read the patient and insurance answers on a new-patient intake form that a patient filled in on Jotform for a medical practice. The answers follow, one per line as question: answer. Reply with JSON only, with these fields:\nfirstName: the patient's first name as written\nlastName: the patient's last name as written\ndateOfBirth: the patient's date of birth as YYYY-MM-DD, or empty text\nphone: the patient's phone number with area code, or empty text\nselfPay: true if the patient chose self-pay or says they have no insurance, otherwise false\nhasInsurance: true only if the form gives both an insurance payer and a member ID\npayerName: the insurance payer's name as written, or empty text\npayerSearch: the payer ID if the form gives one, otherwise the payer's name, or empty text\nmemberId: the member ID, or empty text\ngroupNumber: the group number, or empty text\nholderRelationship: how the patient is related to the policy holder: Self, Spouse, Child or Other\nholderFirstName: the policy holder's first name when the holder is not the patient, otherwise empty text\nholderLastName: the policy holder's last name when the holder is not the patient, otherwise empty text\nholderDateOfBirth: the policy holder's date of birth as YYYY-MM-DD when the holder is not the patient, otherwise empty text\nvisitDate: the date of the patient's first visit as YYYY-MM-DD if the form shows one, otherwise empty text\nIgnore links to uploaded files and signatures. Never guess a value that is not on the form."
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "tools": [],
          "type": "AI_AGENT",
          "userPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "New-patient form submitted on Jotform at "
              },
              {
                "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                "label": null,
                "subPathSegments": [
                  {
                    "key": "createdAt",
                    "optional": false
                  }
                ],
                "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                "value": "AC67100E-E50B-4004-8846-469E9A52C2F3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ", submission "
              },
              {
                "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                "label": null,
                "subPathSegments": [
                  {
                    "key": "id",
                    "optional": false
                  }
                ],
                "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                "value": "AC67100E-E50B-4004-8846-469E9A52C2F3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ". Today is "
              },
              {
                "id": "GET_CURRENT_DATE",
                "label": null,
                "type": "GET_CURRENT_DATE_TIME",
                "value": null
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ".\n\n"
              },
              {
                "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                "label": null,
                "subPathSegments": [
                  {
                    "key": "answersText",
                    "optional": false
                  }
                ],
                "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                "value": "AC67100E-E50B-4004-8846-469E9A52C2F3"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          }
        },
        "name": "Read the insurance answers",
        "nextElementIds": [
          "2937DE11-FC31-4E6D-BCF9-7BA2A043DA72"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "shared-memory-read",
          "isFirstElement": true,
          "blockDefinitionId": "shared-memory-read",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Last form handled Result"
          },
          "position": {
            "x": 110,
            "y": 689
          }
        },
        "flowElementId": "4588585B-0C4C-4CB8-B1CD-9E2DD16A58AA",
        "groupId": null,
        "id": "5F396A97-9AF2-4ED5-9EAD-B0C8295C0587",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "defaultValue": {
            "expression": [
              {
                "id": "EMPTY_STRING",
                "label": null,
                "type": "KEYWORD",
                "value": ""
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "key": "Last form",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Last form",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "READ",
          "type": "SHARED_MEMORY"
        },
        "name": "Last form handled",
        "nextElementIds": [
          "CED35C9F-C89A-46A0-ADAC-D258193742BA"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 472,
            "y": 49
          }
        },
        "flowElementId": "685F23F6-2D91-437A-AE4B-1A2548D744E0",
        "groupId": "AC67100E-E50B-4004-8846-469E9A52C2F3",
        "id": "2937DE11-FC31-4E6D-BCF9-7BA2A043DA72",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "b451366c-0af6-42bf-8cbc-d1ed2384b2e6",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Coverage",
                      "subPathSegments": [
                        {
                          "key": "output",
                          "optional": false
                        },
                        {
                          "key": "hasInsurance",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "A22A41E7-3319-4A49-944A-4FB145378598"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "b451366c-0af6-42bf-8cbc-d1ed2384b2e6"
            ]
          },
          "elseComponent": {
            "componentId": "2AF81C23-AB5C-4DE4-9404-4C34B700C145",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Form has insurance",
          "storeResult": false,
          "thenComponent": {
            "componentId": "C4F0FA0B-FF8A-4AEE-8DE6-D708CD3D4F73",
            "componentType": "ELEMENT"
          }
        },
        "name": "Insurance on the form?",
        "nextElementIds": [
          "2AF81C23-AB5C-4DE4-9404-4C34B700C145",
          "C4F0FA0B-FF8A-4AEE-8DE6-D708CD3D4F73"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Collect the new forms Result"
          },
          "position": {
            "x": 1039,
            "y": 689
          }
        },
        "flowElementId": "AC6B761B-AB52-4296-88D7-0BDAE0640F2F",
        "groupId": null,
        "id": "244CAE20-CC43-48FD-912C-17421B9FE73E",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "result",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "New forms",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "AF566511-C71C-4A8D-914F-A61998C6259F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Start",
                    "subPathSegments": [
                      {
                        "key": "cursor",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CED35C9F-C89A-46A0-ADAC-D258193742BA"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const list = ((result && result.content) || []).filter((s) => s && s.status === 'ACTIVE' && s.created_at);\nconst done = new Set((cursor.ids || []).map(String));\nconst fresh = list.filter((s) => s.created_at > cursor.at || (s.created_at === cursor.at && !done.has(String(s.id))));\nfresh.sort((a, b) => (a.created_at === b.created_at ? String(a.id).localeCompare(String(b.id)) : (a.created_at < b.created_at ? -1 : 1)));\nif (!fresh.length) return { count: 0, forms: [] };\nconst last = fresh[fresh.length - 1].created_at;\nconst next = { at: last, ids: [...(last === cursor.at ? [...done] : []), ...fresh.filter((s) => s.created_at === last).map((s) => String(s.id))] };\nconst skip = ['control_head', 'control_button', 'control_text', 'control_divider', 'control_image', 'control_pagebreak', 'control_collapse'];\nconst show = (a) => a.prettyFormat || (typeof a.answer === 'object' ? JSON.stringify(a.answer) : String(a.answer));\nconst text = (s) => Object.values(s.answers || {})\n  .filter((a) => a && a.answer !== undefined && a.answer !== '' && !skip.includes(a.type))\n  .sort((a, b) => Number(a.order) - Number(b.order))\n  .map((a) => `${a.text || a.name}: ${show(a)}`)\n  .join(String.fromCharCode(10));\nconst forms = fresh.map((s) => ({ id: String(s.id), createdAt: s.created_at, answersText: text(s) }));\nreturn { count: forms.length, forms, cursor: next };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "New batch",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Collect the new forms",
        "nextElementIds": [
          "9C1A4CBB-218B-4D04-B8FF-ED13BBBC85C7"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1137,
            "y": 479
          }
        },
        "flowElementId": "F918EC32-9F47-4B86-BAC2-6FF095E9BB91",
        "groupId": "AC67100E-E50B-4004-8846-469E9A52C2F3",
        "id": "89C553AA-4D0A-4426-B496-17B83F23ABA1",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "83ee6e1c-96d4-40ff-9328-6e6acc50e242",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Check details",
                      "subPathSegments": [
                        {
                          "key": "payerFound",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "139B1860-C4BB-42E3-9846-0238BA214CED"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "83ee6e1c-96d4-40ff-9328-6e6acc50e242"
            ]
          },
          "elseComponent": {
            "componentId": "6F1FFCFB-2513-4F0C-997B-59561E05896D",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Payer found",
          "storeResult": false,
          "thenComponent": {
            "componentId": "55E5123B-4629-41DD-81A6-C92E76C7C948",
            "componentType": "ELEMENT"
          }
        },
        "name": "Payer found?",
        "nextElementIds": [
          "55E5123B-4629-41DD-81A6-C92E76C7C948",
          "6F1FFCFB-2513-4F0C-997B-59561E05896D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Work out where to start Result"
          },
          "position": {
            "x": 410,
            "y": 689
          }
        },
        "flowElementId": "917BE195-F1C0-48F6-BDFB-CA72CA2E3B4A",
        "groupId": null,
        "id": "CED35C9F-C89A-46A0-ADAC-D258193742BA",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'Work out where to start', Error: The placeholder \"Forms submitted after\" has no value",
            "valid": false
          },
          "codeArguments": [
            {
              "name": "lastSeen",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Last form",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "5F396A97-9AF2-4ED5-9EAD-B0C8295C0587"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "startAfter",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Forms submitted after",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Forms submitted after"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const parse = (v) => {\n  if (!v) return null;\n  if (typeof v === 'object') return v.at ? v : null;\n  try { const o = JSON.parse(v); return o && o.at ? o : null; } catch (e) { return null; }\n};\nconst floorAt = String(startAfter || '').trim();\nif (!/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/.test(floorAt)) throw new Error('Set the flow setting Forms submitted after as YYYY-MM-DD HH:MM:SS.');\nlet cursor = parse(lastSeen) || { at: floorAt, ids: [] };\nif (cursor.at < floorAt) cursor = { at: floorAt, ids: [] };\n// Jotform filters by greater than only, so ask from one second earlier and skip the forms already handled at that second.\nconst t = new Date(cursor.at.replace(' ', 'T') + 'Z');\nt.setUTCSeconds(t.getUTCSeconds() - 1);\nconst from = t.toISOString().slice(0, 19).replace('T', ' ');\nreturn { cursor: { at: cursor.at, ids: (cursor.ids || []).map(String) }, filters: JSON.stringify({ 'created_at:gt': from }) };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Start",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Work out where to start",
        "nextElementIds": [
          "AF566511-C71C-4A8D-914F-A61998C6259F"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 481,
            "y": 479
          }
        },
        "flowElementId": "C150935E-B94C-46BA-89E3-B7696E085DC3",
        "groupId": "AC67100E-E50B-4004-8846-469E9A52C2F3",
        "id": "CDFA04BF-C1CE-4D32-9928-F8880F692D8C",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "8c791d77-3def-48a3-ba4c-106c3559842a",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Eligibility",
                      "subPathSegments": [
                        {
                          "key": "coverageActive",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "55E5123B-4629-41DD-81A6-C92E76C7C948"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              },
              {
                "id": "b04f0992-964e-4a55-aa61-fcc62c3ee30b",
                "nestedOperation": null,
                "operation": "isFalse",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Eligibility",
                      "subPathSegments": [
                        {
                          "key": "payerRejected",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "55E5123B-4629-41DD-81A6-C92E76C7C948"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "8c791d77-3def-48a3-ba4c-106c3559842a",
              "AND",
              "b04f0992-964e-4a55-aa61-fcc62c3ee30b"
            ]
          },
          "elseComponent": {
            "componentId": "6F1FFCFB-2513-4F0C-997B-59561E05896D",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Coverage is active",
          "storeResult": false,
          "thenComponent": null
        },
        "name": "Coverage active?",
        "nextElementIds": [
          "6F1FFCFB-2513-4F0C-997B-59561E05896D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Eligibility check failed Result"
          },
          "position": {
            "x": 477,
            "y": 609
          }
        },
        "flowElementId": "E639FFE1-19E6-45BE-8D77-E9B262290AE2",
        "groupId": "AC67100E-E50B-4004-8846-469E9A52C2F3",
        "id": "8FFE7BB6-9D8B-4AAD-B69F-405BC8D55A7F",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Check failed",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "Eligibility check failed",
        "nextElementIds": [
          "6F1FFCFB-2513-4F0C-997B-59561E05896D"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 481,
            "y": 219
          }
        },
        "flowElementId": "40D48CD1-DB2F-4497-B1B7-66BEDF8A4745",
        "groupId": "AC67100E-E50B-4004-8846-469E9A52C2F3",
        "id": "2AF81C23-AB5C-4DE4-9404-4C34B700C145",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "3a7ea12e-9cc1-4189-91bd-905695f22b7d",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Coverage",
                      "subPathSegments": [
                        {
                          "key": "output",
                          "optional": false
                        },
                        {
                          "key": "selfPay",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "A22A41E7-3319-4A49-944A-4FB145378598"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "3a7ea12e-9cc1-4189-91bd-905695f22b7d"
            ]
          },
          "elseComponent": {
            "componentId": "6F1FFCFB-2513-4F0C-997B-59561E05896D",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Is self-pay",
          "storeResult": false,
          "thenComponent": null
        },
        "name": "Self-pay?",
        "nextElementIds": [
          "6F1FFCFB-2513-4F0C-997B-59561E05896D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "shared-memory-put",
          "isFirstElement": false,
          "blockDefinitionId": "shared-memory-put",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default"
          },
          "position": {
            "x": 734,
            "y": 859
          }
        },
        "flowElementId": "068DE100-6F4A-444A-9339-D7B0971F670B",
        "groupId": null,
        "id": "C63FE0E7-4D6C-4DEE-9324-45EF63FBD23D",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "data": [
            {
              "name": "Last form",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "New batch",
                    "subPathSegments": [
                      {
                        "key": "cursor",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "244CAE20-CC43-48FD-912C-17421B9FE73E"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "override": true,
          "resultAlias": "Remembered",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "PUT",
          "type": "SHARED_MEMORY"
        },
        "name": "Remember the forms",
        "nextElementIds": [],
        "nextGroupIds": [
          "AC67100E-E50B-4004-8846-469E9A52C2F3"
        ],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1045,
            "y": 859
          }
        },
        "flowElementId": "E32FF124-0480-4EDD-B72D-8476805F11B3",
        "groupId": null,
        "id": "9C1A4CBB-218B-4D04-B8FF-ED13BBBC85C7",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "2ed45b73-9ab3-4aa6-bd5a-ea38a9715884",
                "nestedOperation": null,
                "operation": ">",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "New batch",
                      "subPathSegments": [
                        {
                          "key": "count",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "244CAE20-CC43-48FD-912C-17421B9FE73E"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "INT",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "NUMBER",
                        "label": null,
                        "type": "INPUT",
                        "value": 0
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "2ed45b73-9ab3-4aa6-bd5a-ea38a9715884"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Has new forms",
          "storeResult": false,
          "thenComponent": {
            "componentId": "C63FE0E7-4D6C-4DEE-9324-45EF63FBD23D",
            "componentType": "ELEMENT"
          }
        },
        "name": "Any new forms?",
        "nextElementIds": [
          "C63FE0E7-4D6C-4DEE-9324-45EF63FBD23D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Sends messages to Slack channels with optional Block Kit rich layouts. Supports plain text with Slack formatting, or advanced Block Kit JSON for buttons, menus, and interactive elements. Returns the message timestamp and channel ID for later updates or tracking.",
          "elementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell the front desk Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 141,
            "y": 770
          }
        },
        "flowElementId": "E795D64D-273A-4C75-8F9D-DDB079D39B4A",
        "groupId": "AC67100E-E50B-4004-8846-469E9A52C2F3",
        "id": "5A55300A-9B50-429A-B57F-1E8E73A0E4A5",
        "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": "Front desk note",
                    "subPathSegments": [
                      {
                        "key": "text",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "6F1FFCFB-2513-4F0C-997B-59561E05896D"
                  }
                ],
                "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": "Front desk message",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the front desk",
        "nextElementIds": [],
        "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 front desk message Result"
          },
          "position": {
            "x": 110,
            "y": 479
          }
        },
        "flowElementId": "3E729F18-234B-4E79-9DC5-4C3FE65E409E",
        "groupId": "AC67100E-E50B-4004-8846-469E9A52C2F3",
        "id": "6F1FFCFB-2513-4F0C-997B-59561E05896D",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "coverage",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Coverage",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A22A41E7-3319-4A49-944A-4FB145378598"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "details",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check details",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "139B1860-C4BB-42E3-9846-0238BA214CED"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "checkId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Eligibility",
                    "subPathSegments": [
                      {
                        "key": "checkId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "55E5123B-4629-41DD-81A6-C92E76C7C948"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "checkError",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check failed",
                    "subPathSegments": [
                      {
                        "key": "message",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8FFE7BB6-9D8B-4AAD-B69F-405BC8D55A7F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "payerRejected",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Eligibility",
                    "subPathSegments": [
                      {
                        "key": "payerRejected",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "55E5123B-4629-41DD-81A6-C92E76C7C948"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "payerErrors",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Eligibility",
                    "subPathSegments": [
                      {
                        "key": "payerErrors",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "55E5123B-4629-41DD-81A6-C92E76C7C948"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "coverageStatus",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Eligibility",
                    "subPathSegments": [
                      {
                        "key": "coverageStatus",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "55E5123B-4629-41DD-81A6-C92E76C7C948"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "planName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Eligibility",
                    "subPathSegments": [
                      {
                        "key": "planName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "55E5123B-4629-41DD-81A6-C92E76C7C948"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "submissionId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "AC67100E-E50B-4004-8846-469E9A52C2F3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "submittedAt",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "createdAt",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "AC67100E-E50B-4004-8846-469E9A52C2F3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "// Says what is wrong with the insurance on the form, with the details the front desk needs to sort it out.\nconst v = coverage || {};\nconst d = details || {};\nconst payer = d.payerName || v.payerName || 'the payer';\nconst name = [v.firstName, v.lastName].filter(Boolean).join(' ') || 'A new patient';\nconst who = `${name}${v.dateOfBirth ? `, born ${v.dateOfBirth}` : ''}${v.phone ? `, phone ${v.phone}` : ''}`;\nconst card = `${v.payerName || 'no payer'}${v.memberId ? `, member ID ${v.memberId}` : ''}${v.groupNumber ? `, group ${v.groupNumber}` : ''}`;\nlet reason;\nif (!v.hasInsurance) {\n  reason = v.payerName ? 'The form names a payer but gives no member ID.' : 'The form gives no insurance and does not say self-pay.';\n} else if (!d.payerFound) {\n  reason = `Stedi has no payer matching \"${v.payerSearch || v.payerName}\". Find the payer and run the check by hand.`;\n} else if (!checkId) {\n  reason = `The eligibility check with ${payer} did not go through: ${checkError || 'no answer from the payer'}.`;\n} else if (payerRejected) {\n  const why = (payerErrors || []).map((e) => [e.code, e.description, e.followupAction].filter(Boolean).join(' ')).filter(Boolean).join('; ');\n  reason = `${payer} rejected the eligibility check: ${why || 'no reason given'}.`;\n} else {\n  reason = `${payer} shows no active coverage on ${d.dateOfService || 'the visit date'} (status: ${coverageStatus || 'none'}${planName ? `, plan ${planName}` : ''}).`;\n}\nconst lines = [\n  '*Insurance on a new-patient form needs a look before the first visit.*',\n  `Patient: ${who}`,\n  `On the form: ${card}`,\n  reason,\n  `Jotform submission ${submissionId}, sent ${submittedAt}.`,\n];\nreturn { text: lines.join(String.fromCharCode(10)) };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Front desk note",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Write the front desk message",
        "nextElementIds": [
          "5A55300A-9B50-429A-B57F-1E8E73A0E4A5"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Gets a list of form responses with pagination and filtering options. Includes detailed submission data, answers, and metadata.",
          "elementId": "EXTENSION:::SHARED:::default:::jotform:::getFormSubmissions",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get new intake forms Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::jotform:::getFormSubmissions",
          "legacyElementId": "JS###v1###Jotform###getFormSubmissions",
          "methodName": "getFormSubmissions",
          "position": {
            "x": 733,
            "y": 680
          }
        },
        "flowElementId": "B78E5E33-003F-4E61-98EE-F70FFED8233E",
        "groupId": null,
        "id": "AF566511-C71C-4A8D-914F-A61998C6259F",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "id",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Intake form ID",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Intake form ID"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "offset",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "limit",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 1000
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "filters",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Start",
                    "subPathSegments": [
                      {
                        "key": "filters",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CED35C9F-C89A-46A0-ADAC-D258193742BA"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "orderBy",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "created_at"
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Get new intake forms', Error: The placeholder \"Intake form ID\" has no value",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getFormSubmissions",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "New forms",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "jotform",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Get new intake forms",
        "nextElementIds": [
          "244CAE20-CC43-48FD-912C-17421B9FE73E"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Line up the eligibility check Result"
          },
          "position": {
            "x": 1114,
            "y": 49
          }
        },
        "flowElementId": "641E8393-B47E-4E33-90D2-277CC06A31F4",
        "groupId": "AC67100E-E50B-4004-8846-469E9A52C2F3",
        "id": "139B1860-C4BB-42E3-9846-0238BA214CED",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "payers",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payers",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "C4F0FA0B-FF8A-4AEE-8DE6-D708CD3D4F73"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "coverage",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Coverage",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A22A41E7-3319-4A49-944A-4FB145378598"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "// Takes Stedi's best payer match, the member on the card and the visit date for the eligibility check.\nconst items = (payers && payers.items) || [];\nconst top = items[0] && items[0].payer;\nconst c = coverage || {};\nconst day = (d) => (d ? String(d).slice(0, 10) : '');\nconst isSelf = !c.holderRelationship || String(c.holderRelationship).toLowerCase() === 'self' || !(c.holderFirstName && c.holderLastName);\nconst today = new Date().toISOString().slice(0, 10);\nconst visit = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(c.visitDate || '') && c.visitDate >= today ? c.visitDate : today;\nreturn {\n  payerFound: Boolean(top && top.primaryPayerId),\n  payerId: top ? top.primaryPayerId : '',\n  payerName: top ? top.displayName : '',\n  memberId: c.memberId || '',\n  groupNumber: c.groupNumber || '',\n  firstName: isSelf ? c.firstName : c.holderFirstName,\n  lastName: isSelf ? c.lastName : c.holderLastName,\n  dateOfBirth: isSelf ? day(c.dateOfBirth) : day(c.holderDateOfBirth),\n  dependentFirstName: isSelf ? '' : c.firstName,\n  dependentLastName: isSelf ? '' : c.lastName,\n  dependentDateOfBirth: isSelf ? '' : day(c.dateOfBirth),\n  dateOfService: visit,\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Check details",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Line up the eligibility check",
        "nextElementIds": [
          "89C553AA-4D0A-4426-B496-17B83F23ABA1"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "5F396A97-9AF2-4ED5-9EAD-B0C8295C0587",
    "groups": [
      {
        "clientMetadata": {
          "elementId": "list-iterator",
          "isFirstElement": false,
          "blockDefinitionId": "list-iterator",
          "viewport": {
            "x": -59.322799097065456,
            "y": 3.882618510158011,
            "zoom": 0.9
          },
          "position": {
            "x": 422,
            "y": 859
          }
        },
        "flowElementId": "B294BD3B-0944-40BC-B15F-C33438F62EFD",
        "groupId": null,
        "id": "AC67100E-E50B-4004-8846-469E9A52C2F3",
        "loopType": "LIST_ITERATOR",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'Each new form', Error: Children have error",
            "valid": false
          },
          "enabled": true,
          "firstElementId": "A22A41E7-3319-4A49-944A-4FB145378598",
          "list": {
            "expression": [
              {
                "id": "ELEMENT_RESULT",
                "label": "New batch",
                "subPathSegments": [
                  {
                    "key": "forms",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "244CAE20-CC43-48FD-912C-17421B9FE73E"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "onFailElemId": null,
          "resultAlias": "loop",
          "storeResult": true
        },
        "name": "Each new form",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "LOOP"
      }
    ],
    "id": "7F87CB7A-84D5-4936-99C7-10EB8C31B7B6",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
        "valid": false
      },
      "errorMessage": "Block 'Work out where to start' has an invalid configuration. Code Argument 'startAfter' has invalid value. Placeholder Data 'Forms submitted after': value is required",
      "executionStaticData": [
        {
          "description": "The Anthropic key the AI step uses to read the insurance answers.",
          "error": null,
          "name": "Anthropic key",
          "type": "API_KEY",
          "value": null
        },
        {
          "description": "The ID of your new-patient intake form in Jotform: the number at the end of the form's URL.",
          "error": null,
          "name": "Intake form ID",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "Only forms submitted after this time are checked, written as YYYY-MM-DD HH:MM:SS in your Jotform account's time zone. Set it to the time you turn the flow on.",
          "error": "Placeholder Data 'Forms submitted after': value is required",
          "name": "Forms submitted after",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "Your practice's 10-digit NPI, sent with every eligibility check.",
          "error": null,
          "name": "Practice NPI",
          "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-12-01T05:36:18.809Z"
}
