# Build HL7 Message

> Perform Build HL7 Message through HL7.

Source: [https://genhealth.ai/docs/workflows/integrations/hl7/hl7_build_message](https://genhealth.ai/docs/workflows/integrations/hl7/hl7_build_message)

Integration: [HL7](https://genhealth.ai/docs/workflows/integrations/hl7.md)

- Handler: `hl7_build_message`

## Use in a workflow

Copy this discovered node config, fill params from the input contract, and validate the complete graph. Integration results are available as {{node_id.default.field}}. Check business success before dependent writes; completion alone does not prove business success.

```json

{
  "_group": "HL7",
  "params": {
    "hl7_version": "2.5.1",
    "message_type": "ORM^O01",
    "processing_id": "T"
  },
  "handler": "hl7_build_message"
}

```

[Action contracts](https://genhealth.ai/docs/workflows/action-contracts.md) · [Run recovery](https://genhealth.ai/docs/workflows/operations.md)

## Inputs

- `message_type` — Message Type (select, required)
  Required selected identifier or value.
  Default: `"ORM^O01"`
  Options: ORM^O01 ("ORM^O01"), ADT^A04 ("ADT^A04"), ADT^A08 ("ADT^A08"), ORU^R01 ("ORU^R01"), MDM^T02 ("MDM^T02")
- `hl7_version` — Hl7 Version (select, required)
  Required selected identifier or value.
  Default: `"2.5.1"`
  Options: 2.3 ("2.3"), 2.3.1 ("2.3.1"), 2.4 ("2.4"), 2.5 ("2.5"), 2.5.1 ("2.5.1"), 2.6 ("2.6"), 2.7 ("2.7")
- `sending_application` — Sending Application (expression)
  Optional literal value or workflow expression.
- `sending_facility` — Sending Facility (expression)
  Optional literal value or workflow expression.
- `receiving_application` — Receiving Application (expression)
  Optional literal value or workflow expression.
- `receiving_facility` — Receiving Facility (expression)
  Optional literal value or workflow expression.
- `processing_id` — Processing Id (select)
  Optional selected identifier or value.
  Default: `"T"`
  Options: T · Test ("T"), P · Production ("P"), D · Debug ("D")
- `field_map` — Field Map (repeatable_group, required)
  Required list of structured items.
  - `field` — Field (text, required)
    Required text value.
  - `value` — Value (expression)
    Optional literal value or workflow expression.

## Outputs

- `success` — Success
- `message` — Message
- `control_id` — Control Id
- `message_type` — Message Type
- `hl7_version` — Hl7 Version
- `segment_names` — Segment Names
- `validation_errors` — Validation Errors
- `validation_warnings` — Validation Warnings
- `error` — Error
- `error_type` — Error Type

Output schema completeness: `best_effort_declared`

## Safety

- External effect: `write`
- Confirmation recommended: no
- Retry safe: no
- Dry run supported: no

## Schemas

These schemas are first-pass authoring guidance. Runtime validation remains authoritative.

### Input schema

```json
{
  "type": "object",
  "required": [
    "message_type",
    "hl7_version",
    "field_map"
  ],
  "properties": {
    "field_map": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "field"
        ],
        "properties": {
          "field": {
            "type": "string",
            "description": "Required text value.",
            "x-workflow-field-type": "text"
          },
          "value": {
            "description": "Optional literal value or workflow expression.",
            "x-workflow-field-type": "expression"
          }
        },
        "additionalProperties": false
      },
      "description": "Required list of structured items.",
      "x-workflow-field-type": "repeatable_group"
    },
    "hl7_version": {
      "enum": [
        "2.3",
        "2.3.1",
        "2.4",
        "2.5",
        "2.5.1",
        "2.6",
        "2.7"
      ],
      "type": "string",
      "default": "2.5.1",
      "description": "Required selected identifier or value.",
      "x-workflow-field-type": "select"
    },
    "message_type": {
      "enum": [
        "ORM^O01",
        "ADT^A04",
        "ADT^A08",
        "ORU^R01",
        "MDM^T02"
      ],
      "type": "string",
      "default": "ORM^O01",
      "description": "Required selected identifier or value.",
      "x-workflow-field-type": "select"
    },
    "processing_id": {
      "enum": [
        "T",
        "P",
        "D"
      ],
      "type": "string",
      "default": "T",
      "description": "Optional selected identifier or value.",
      "x-workflow-field-type": "select"
    },
    "sending_facility": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "receiving_facility": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "sending_application": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "receiving_application": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    }
  },
  "additionalProperties": false
}
```

### Output schema

```json
{
  "type": "object",
  "properties": {
    "error": {},
    "message": {},
    "success": {},
    "control_id": {},
    "error_type": {},
    "hl7_version": {},
    "message_type": {},
    "segment_names": {},
    "validation_errors": {},
    "validation_warnings": {}
  },
  "additionalProperties": true
}
```
