Skip to content
Recipes

Post each sender's messages to its own API

One ADT workflow posts each customer's messages to that customer's REST API with its own credentials, picked by MSH-4, and fails clearly for a sender nobody set up.

On this page

Two customers send ADT through the same feed, and each wants the messages posted to its own API with its own credentials. Build one workflow with one destination, and give that destination a connection per sender. A third sender that nobody has set up yet either uses a default API or fails, naming its MSH-4.

Source and destination

flowchart LR
    A[ADT from DH-NORTH or DH-SOUTH] --> B[Customer API destination]
    B -->|MSH-4 DH-NORTH| C[North API profile]
    B -->|MSH-4 DH-SOUTH| D[South API profile]
    B -->|anyone else| E[Default profile, or fail]
  • Source: any HL7v2 trigger (MLLP, webhook) or a manual run.
  • Destination: one Generic REST send step, action write, endpoint /adt.
  • Connections: three Generic REST adapter profiles, one per customer and one default, each with its own base URL and credentials.

What it uses

Status

Available on this release.

Steps

  1. Under Adapters, create three Generic REST profiles: North API (base URL https://north-api.example.test), South API (https://south-api.example.test) and Default API (https://default-api.example.test), each with its own authentication.

  2. Create the workflow. In the Steps view, add a destination named Customer API. Under Send, choose Default API, action write and the config { "endpoint": "/adt" }.

  3. Choose Different connection per sender, then + Add sender. Fill the row: Sender (MSH-4) DH-NORTH, Connection North API. Choose + Add sender and fill DH-SOUTH with South API.

  4. Leave Senders not listed on use the default connection while you test. Save and deploy.

  5. Send a synthetic message from each sender:

    text
    MSH|^~\&|ADT|DH-NORTH|MEDHOOK|MEDHOOK|20260101120000||ADT^A01|MSG0001|P|2.5.1
    PID|1||TESTMRN0001^^^DH^MR||TESTPATIENT^NORTH||19800101|F

    and the same with DH-SOUTH in MSH-4 and MSG0002 in MSH-10.

  6. When every customer that sends to this feed has a row, set Senders not listed to fail the message, save and deploy.

Test it

  • The message from DH-NORTH reaches the north API, the one from DH-SOUTH the south API. In Messages, each message's Steps tab reads "Connection: North API, for sender DH-NORTH" or "Connection: South API, for sender DH-SOUTH".
  • A message from DH-EAST first goes to the default API ("the default (sender DH-EAST isn't listed)"). After step 6 it fails with "No connection is set for sender MSH-4 "DH-EAST"", nothing is sent, and it is not retried.
  • In Run with sample, choose Sender DH-NORTH to see only the north customer's samples. The send step shows the north connection and nothing is sent.
  • The audit log has a workflow.sender_connections_changed entry for each save that changed the table.

Reference