Skip to content
Guides

Start a workflow

Find your way around the Workflows page, work through the setup checklist, and start a workflow with New workflow or from a template.

On this page

This guide covers the three ways into a new workflow: the Workflows page and its setup checklist, New workflow, and the Templates gallery. Whichever way you start, you get a draft that is turned off. It opens in the builder and takes no live messages until you deploy it.

New workflow has four steps.

flowchart LR
    Start["Start: shape and how to start"] --> Source["Source: trigger, or the API"]
    Source --> Sample["Sample: a message to build from"]
    Sample --> Draft["Draft: name, then Open in builder"]
    Draft --> Builder["Builder, turned off"]

Before you start

The Workflows page

Open Workflows in the sidebar. The header has Templates, Import and New workflow. Import offers Import from Mirth or Rhapsody and Import JSON. Components and Topics are under the ··· menu (More workflow pages).

Under the header:

  • Search workflows matches the name, the trigger and the destinations.
  • The chips All, Active, Needs attention, Draft and Paused narrow the list. Needs attention shows workflows that are failing, waiting for approval, or still waiting for their first message.
  • Table and Flow map switch the view. Your browser remembers the choice.

The table has these columns.

ColumnWhat it shows
OnWhether the workflow takes messages. A viewer sees the switch disabled.
WorkflowThe name, with the trigger under it.
Delivers toThe destinations.
StatusActive, Needs approval, Failing, Waiting for first message, Draft or Paused, with a reason line under the pill.
24 hA sparkline of the runs in the last 24 hours, and their count.
ErrorsFailed runs in the last 24 hours.
p95The 95th percentile run time over the last 24 hours.
VersionThe deployed version, and a newer draft or a save waiting for approval, such as v4 · v5 draft.
UpdatedWhen the workflow last changed.

The reason line says why a workflow needs you, for example PACS not answering or v3 waiting for review. In Flow map, each workflow is a card with its trigger, its step count and its destinations, a sparkline, and the count, errors and p95. A failing card, and the destination that is not answering, have a red border.

Turning a workflow off asks you to confirm. A workflow that has never been deployed cannot be turned on from the list: the engine asks Deploy first?, and Go to Deploy opens its versions page, where deploying turns it on.

Tour this page in the sidebar walks through the search, the views, a row and the checklist.

The setup checklist

A new workspace shows Get your first interface live at the top of the Workflows page. It has five steps, and shows how many are done.

The setup checklist Get your first interface live at 0 of 5: Connect a tunnel highlighted with New tunnel, then Load a sample message, Open the practice workflow, Run a test, and Get approval and deploy, each with its action, and the Coming from Mirth Connect? panel with the Mirth → MedHook guide and Builder tour

StepActionDone when
Connect a tunnelNew tunnelA tunnel is up. The line then shows the tunnel's name and its peer IP.
Load a sample messageLoad sampleA workflow has a saved sample message, or you loaded one from the card.
Open the practice workflowOpen builderYou opened the practice workflow from the card.
Run a testRun testThe practice workflow has run a test.
Get approval and deployOpen versionsA workflow is deployed.

The practice workflow is Demo ADT intake. The engine makes it the first time someone opens it from the card. It is turned off and synthetic: an MLLP listener, a filter for ADT A01, A04 and A08, a map to FHIR Patient and Encounter, and a destination with no connection, so nothing is delivered. Its sample is a synthetic admit with no PHI.

The side panel Coming from Mirth Connect? links the Mirth → MedHook guide, a page under Workflows that shows where each Mirth Connect concept lives in MedHook, and the Builder tour, which opens the practice workflow with the builder's tour.

Someone who can't create tunnels (an Operator or a Viewer) sees Ask an admin on Connect a tunnel instead of a button, and the next step they can take is highlighted. In a sandbox workspace the last step is Deploy: sandbox deploys need no approval. A workflow counts as deployed while it is deployed and on.

The API path

A workspace whose workflows take webhooks (and none takes MLLP), or a person who can't create tunnels in a workspace with no MLLP workflow, gets four steps instead:

StepActionDone when
Add a connectionNew connectionThe workspace has a connection.
Start from a templateBrowse templatesThe workspace has a workflow. The gallery opens on Request and respond.
Run a testRun testThe newest workflow has run.
DeployOpen versionsA workflow is deployed and on.

The card goes away once every step is done. × (Hide the setup checklist) hides it for you in this workspace. To bring it back, open the ? help on the Workflows page and choose Show the setup checklist. A viewer sees the card but cannot hide it.

New workflow

Choose New workflow. The stepper on the left shows Start, Source, Sample and Draft. You can go back to a finished step from the stepper, or with Back. Continue moves on.

1. Start

Under 1 · What shape is it?, pick the shape of the integration.

New workflow's Start step: How do you want to start?, the five shape cards with Receive and forward picked, the four ways to start with Describe it to the Agent picked, its example description, and Continue

ShapeWhat it does
Receive and forwardWebhook or MLLP in, transform, send on
Request and respondExpose an endpoint, call systems, answer
Poll and pushPull an API on a schedule, page through
Keep in syncChanges in A update B, IDs kept
Batch fileSFTP or bucket file, split, send each

Under 2 · How do you want to start?, pick one:

  • Describe it to the Agent. Say where messages come from and where each kind goes. The Agent drafts the steps on the Draft step. It sees the sample masked, or the bundled synthetic message, never a raw message from a listener. When AI is off on the engine, this option is not shown, and the page says why.
  • Start from a template. Opens the Templates gallery.
  • Import a Mirth channel. Upload the channel export XML here (up to 5 MB). A viewer sees the file picker disabled. Continue waits until the engine has read it. The draft is converted from the channel, and keeps the channel's own source.
  • Blank workflow. Pick a trigger and add steps yourself.

2. Source

Where do messages come from? Pick a trigger. The shape picks one for you, and you can change it.

TriggerFor
MLLP listenerHL7v2 over a tunnel
WebhookJSON · HMAC signed
SFTP pickupfiles on a schedule
FHIR subscriptionR4 · rest-hook
Schedulecron · runs a query
Database pollSQL · new rows
  • MLLP listener: pick the Tunnel and the Listener port. The port picked for you is the lowest declared listener no workflow uses, marked next free. Test connection checks the tunnel's peer and shows Tunnel up · peer reachable with the time it took, or why it failed. With no tunnel yet, choose Connect a tunnel.
  • SFTP pickup and Database poll: pick the Connection it reads. Continue waits until you do. Add one opens a new connection.
  • Other triggers: you fill in the details in the builder.

For an imported Mirth channel, the trigger is locked: the channel keeps its Mirth source, and you change it in the builder.

Source for an API

Request and respond, Poll and push and Keep in sync, and Receive and forward with Webhook, describe an API instead. The step shows two cards. You can use either, or both.

Bring the API's description. Paste an OpenAPI 3 or Swagger 2 document, a Postman collection or a curl command, or an https URL of an OpenAPI document. The step shows Found {n} endpoints · {auth}, such as OAuth2 client credentials, and lists each endpoint's method and path. The engine reads the description and keeps nothing. A URL is fetched over https only, from a public address, up to 5 MB. A description that points to another file with a remote $ref is refused.

Capture a real request. Choose Send a test. The engine makes a one-time capture URL and a signing secret, and the button reads Listening… while Waiting for the first request… shows. Point the sender at the URL once. The first request it posts shows here with its size and whether its HMAC signature is valid, with the body masked and no header values. The button then reads Captured, and the request is offered as the sample on the next step.

  • The URL expires after 15 minutes. When it expires, or stops listening, choose Get a new URL.
  • Only the person who made the URL sees the request. Credential and signature headers are not kept.
  • The engine keeps the raw request for 15 minutes from when it arrives, even if the URL runs out sooner. If you keep it as the sample, it is saved encrypted with the draft. If those 15 minutes pass before Open in builder, the draft is still created without it, and a notice says The captured request expired before the draft was saved, so it is not kept anywhere.

For Request and respond, the step also says: Adds a Respond step. The caller waits for MedHook's answer: you map the status code, body and headers, set a timeout, and choose what upstream errors turn into. The draft starts with a Respond to caller step. See Answer from a Respond step.

3. Sample

Load a sample message. The builder shows this message's data at every step, so mapping starts from real fields. Pick one:

  • Captured request, when you captured one on Source. It is shown masked.
  • Bundled ADT^A01, a synthetic Demo Health admit with no PHI. This is the default for an MLLP listener.
  • Paste or upload, the default for the other triggers. The step reads HL7v2, JSON, X12 and XML, and takes .hl7, .txt, .json, .x12, .edi and .xml files up to 1 MB. A message you paste is shown masked. If the step cannot tell the format, it says Paste HL7v2, JSON, X12 or XML.

You can leave the paste empty and load a sample later in the builder. See Test with sample messages.

4. Draft

The step lists the draft's steps, numbered, with branch steps indented. A blank workflow lists only its trigger. With Describe it to the Agent, the step shows Drafting the workflow… and then Draft ready. While it drafts, Start blank goes on without the Agent. If the model fails, the step shows the error with Try again, which asks again in place, and Start blank. Going Back and then Continue also asks again. For a Mirth channel, Review the conversion report opens the report of what needs a person, and the Name is read-only: Named after the Mirth channel. Rename it in the builder. A channel imported before is not imported twice: the engine says This channel was imported before: opening that workflow. and opens it.

Enter a Name. Leave This workflow processes PHI on for real patient data: a PHI workflow runs only when your license authorizes PHI. Choose Open in builder. The engine creates the draft, turned off, with its sample, and the builder opens.

Choose Templates on the Workflows page. Working interfaces you adapt. Each opens as a draft with a sample message, and tells you what it needs first.

  • Search templates matches the name, the description, what it needs and its tags.
  • The shape filter (All shapes, then the five shapes above) and the category chips (ADT, Labs, Scheduling, Orders, FHIR, X12, Files, Webhook) narrow the grid.

Each card shows its category, its shape and who made it, a diagram of the shape, and what it needs. A need already set up has a tick. A missing one has a +, such as + Payer API, and the card says to add it first or during setup. A connection whose last connection test failed does not count as set up. Templates your team saved with Save as template are cards by Your team in the same grid. They open their own page; see Templates made of components.

Choose a built-in card to open its preview on the right. The address gets ?selected= and the template's id, so you can share the link. The preview shows:

The preview of HL7v2 over MLLP → JSON webhook: ADT · Receive and forward, its three steps, a synthetic Sample in → out, Before you start listing a tunnel and Generic REST not set up yet with Add, Profiles it uses with Choose later and Create one, and Use this template

  • Steps: the template's steps in order, branch steps indented.
  • Sample in → out: a synthetic message and what the template makes of it.
  • Before you start: each need, with Add for one that is missing. Add opens a new tunnel or a new connection, or, for a connection that is failing, that connection in Adapters.
  • Connections it uses: one choice per step the template calls, named by the step's role, such as Source FHIR server and Destination FHIR server, or Payer API. Two steps of one type are two choices, so a template that reads one server and writes another binds each to its own. A step whose type has one profile in the workspace has it picked already. With none, choose Create one, or leave Choose later and pick it in the builder. New workflow with a template asks the same on its last step, and the API takes the same choices: see Create a workflow from a template.

Choose Use this template. The engine creates the workflow as a draft, turned off, and the builder opens; it goes live through the Deploy checklist. A template with an SFTP pickup waits until you pick the pickup's SFTP profile. Each copy of a webhook template gets its own webhook URL, so two copies never answer the same address, and Deploy refuses a webhook id another live workflow already answers (WEBHOOK_ID_IN_USE).

A webhook template's preview has Callers: Generate a signing secret is on by default. After the workflow is created, the secret is shown once with Copy: give it to the sender, who signs the raw body with HMAC-SHA256 in x-hub-signature-256 (sha256=<hex>). Callers with a bearer token use an API client instead (Settings › API clients). With neither, every call is refused with 401.

While the engine's license doesn't cover PHI, the Templates screen says so once: synthetic messages only until the BAA is signed.

🎉 You have a draft in the builder. Next, build and test it: Build a channel with several destinations, or start from a recipe in the Workflow catalog.

Create a workflow from a template with the API

POST /api/workflows with a templateId and no nodes creates the template's steps as Use this template does. stepProfiles binds a profile to each step by its node id ("trigger" for an SFTP pickup or a poll), and adapterProfiles is a shorthand that binds every step of an adapter type that has no profile yet. A step's own choice wins. GET /api/workflows/templates lists each template's steps and their node ids.

json
{
  "templateId": "scheduled-fhir-sync",
  "name": "Nightly patient copy",
  "stepProfiles": {
    "fetch": "<source FHIR profile id>",
    "adapter-dest-send": "<destination FHIR profile id>"
  }
}

A body that sends its own nodes (a template's graph with its REPLACE_WITH_* placeholders replaced) works as before; stepProfiles and adapterProfiles apply to it too.

Reference