Triggers
A trigger is how work starts for a Workflow. It connects a blueprint pathway to the thing that should start it, and one pathway can have more than one. Every trigger is scoped to one tenant and workspace.
MedFlow has three types:
| Type | Starts a run when | Best for |
|---|---|---|
| Web | your system POSTs to the trigger’s URL | your own backend, a form, or a job firing it on demand |
| Search | a query matches a patient or pathway | acting on everyone who meets a clinical condition, on a schedule or as matches appear |
| Event | an event happens in a connected system | reacting to activity like a new patient, a lab result, or a partner event |
Web trigger
Section titled “Web trigger”You fire a web trigger directly over HTTP. Your backend, a form, or a job POSTs a payload to the trigger’s own URL when something happens in your system, and MedFlow starts a run.
curl -X POST "https://api-staging.medflow.care/v1/triggers/TRIGGER_ID" \
-H "Authorization: Bearer $MEDFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "payload": {} }'This is the most direct option when your own system already knows a run should start. See the Quickstart for the full walkthrough and Runs for what comes back.
Search trigger
Section titled “Search trigger”A search trigger runs a query against your data and starts a pathway for each patient or pathway that matches. Use it to act on an entire patient cohort that meets a clinical condition, rather than one record at a time.
A search trigger can rerun its query on a fixed schedule, for example nightly or hourly, so new matches are picked up without anyone starting a run by hand. Leave the schedule off to run it on demand.
Search depends on current data, so data sources and data syncs keep the clinical graph in sync and the query sees the latest matches.
Event trigger
Section titled “Event trigger”An event trigger starts a pathway when MedFlow raises an event, such as a new patient, a new lab result, or a completed appointment. You pick the event from the Connections catalog and bind it to a pathway. MedFlow owns the event: it raises the event from what it observes. External systems do not directly trigger runs from events, instead use a web trigger.
MedFlow raises an event from the data and activity it sees:
- New data arriving from a connected system, whether pushed in through an inbound webhook or pulled in by a data sync.
- Changes its own integrations detect while keeping the clinical picture in sync.
Trigger fields
Section titled “Trigger fields”Every trigger has shared fields plus options that depend on type (web, search, or event). Full shapes: Triggers API.
| Field | Role |
|---|---|
type | web, search, or event |
sourceId | Blueprint pathway to run |
autoStart | Start node actions as soon as a run is created |
active | Whether the trigger is enabled |
queryId | Search only: query that selects who to start pathways for |
schedule | Search only: optional recurring cadence |
event | Event only: event type to match (for example order.signed) |
Manage triggers in the product or through the Triggers API. Partner API keys and a test workflow (web, search, or event, depending on what you need) are set up when you request access. See Authentication and Quickstart.
Which type to use
Section titled “Which type to use”| Need | Use |
|---|---|
| Your system has a payload and a known trigger id | Web trigger |
| Start a pathway for every record a query matches | Search trigger |
| Rerun a query on a schedule, for example nightly | Search trigger with a schedule |
| React to a change MedFlow sees, like a new patient or lab result | Event trigger |
| A partner pushes data to a fixed URL | Inbound webhook; MedFlow can raise an event trigger from it |