Health New Zealand Te Whatu Ora Shared Care FHIR API
0.4.5 - release
NZ
Health New Zealand Te Whatu Ora Shared Care FHIR API - Local Development build (v0.4.5) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions
The Common Messaging System (CMS) provides a centralised FHIR API for sending SMS and email communications to patients and practitioners. It supports both direct message content and template-based messaging with parameterised placeholders.
| Resource | Purpose |
|---|---|
| CommunicationRequest | A request to send a communication (SMS or email) |
| Communication | A record of a communication that was sent |
| TemplateDocumentReference | A reusable message template with placeholders and parameter definitions |
There are two ways to send a message:
A CommunicationRequest must include either a message-body or a message-template payload (enforced by the cms-body-or-template invariant). Both may be provided.
The CommunicationRequest payload is sliced by an extension that identifies the logical type of each payload element. The discriminator is the value of the cms-payload-type-extension.
| Slice | Cardinality | Description |
|---|---|---|
message-body |
0..1 | The message content as a text/plain attachment. Used for direct messaging. |
message-template |
0..1 | A reference to a TemplateDocumentReference containing the message template. |
message-parameters |
0..1 | A JSON attachment (application/json) containing key-value pairs to substitute into template placeholders. |
attachment-file |
0..* | File attachments (e.g. PDFs) to include with the message. Supports an optional hnz-attachment-extension for disposition and content ID. |
// Message body provided inline
* payload[message-body].extension[payloadType].valueCode = #body
* payload[message-body].contentAttachment.contentType = #text/plain
* payload[message-body].contentAttachment.data = "<base64-encoded message>"
| See: Email without template | SMS without template |
// Reference to a template
* payload[message-template].extension[payloadType].valueCode = #template
* payload[message-template].contentReference = Reference(DocumentReference/MyTemplate)
// Parameter values to fill template placeholders
* payload[message-parameters].extension[payloadType].valueCode = #parameters
* payload[message-parameters].contentAttachment.contentType = #application/json
* payload[message-parameters].contentAttachment.data = "<base64-encoded JSON key-value pairs>"
| See: Email with template | SMS with template |
The TemplateDocumentReference content is sliced using the same extension-based pattern. The discriminator is the value of the cms-template-content-type-extension.
| Slice | Cardinality | Description |
|---|---|---|
template-message-body |
1..1 | The template body as a text/html attachment. Contains {{placeholder}} markers that are substituted at send time. |
template-message-parameters |
0..1 | A JSON schema (application/json) defining the parameters the template expects, including types, descriptions, and which are required. |
template-attachment-file |
0..* | Static file attachments bundled with the template. Supports an optional hnz-attachment-extension for disposition and content ID. |
The template body is HTML containing placeholder markers using double-brace syntax:
<p>Dear {{PatientName}},</p>
<p>You are invited to a screening on {{AppointmentDate}} at {{AppointmentTime}}.</p>
The template-message-parameters content holds a JSON schema that documents the expected parameters:
{
"title": "Welcome Message Schema",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The recipient's first name.",
"required": true
},
"lastName": {
"type": "string",
"description": "The recipient's last name.",
"required": false
}
},
"required": ["firstName"]
}
See: Template example
The Communication resource records the outcome of a sent message. It uses the same payload slicing pattern as CommunicationRequest for message-body and attachment-file slices, and links back to the originating CommunicationRequest via basedOn.
| Slice | Cardinality | Description |
|---|---|---|
message-body |
0..1 | The rendered message content that was sent. |
attachment-file |
0..* | Any file attachments that were included. |
| See: Email communication | SMS communication |
All CMS resources use named extensions for metadata:
| Extension | Context | Description |
|---|---|---|
| Campaign | CommunicationRequest, Communication | Campaign code and name for tracking. |
| ContactPoint | CommunicationRequest, Communication | The to and from contact points (email address, phone number). Required. |
| CallbackUrl | CommunicationRequest, Communication | A webhook URL for delivery status callbacks. |
| Reply | CommunicationRequest, Communication | SMS reply configuration — whether a reply is expected and a webhook URL. |
| StatusDateTime | Communication | Timestamp of the last status update. |
| AttachmentExtension | Attachment | Disposition and content ID for file attachments. |
basedOn.status and statusReason fields.