> For the complete documentation index, see [llms.txt](https://docs.mdintegrations.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mdintegrations.com/partner/exploring-features/automations.md).

# Automations

Automations are a no-code, drag-and-drop workflow builder in the Partner Portal — think Zapier or n8n, but built around MDI's own data model of Patients, Encounters, and Vouchers. They let you build compliant, automated workflows without engineering resources.

<figure><img src="https://1351412531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYCoNzBEmH2t5SFktn01I%2Fuploads%2FJJOh9n1d4Vdu9SXpRhF6%2FScreenshot%202026-09-23%20at%2017.40.52.png?alt=media&amp;token=a5a23dbe-3603-4c3a-880d-57b2c415dc09" alt=""><figcaption></figcaption></figure>

## How an Automation is structured

Every Automation starts with exactly one **Trigger**, followed by an ordered sequence of **Steps**.

**Triggers** include:

* Encounter Completed
* Patient Created
* Voucher Expired
* Message Received
* Manual
* and others, covering most events in the patient lifecycle

**Steps** run in order once the trigger fires, and can include:

* **Branching/conditional logic** — route down different paths based on Encounter, Patient, or Offering data
* **AI-processing steps** — classify or generate content (e.g., summarize a message, draft a reply) as part of the flow
* **HTTP calls** — reach out to external vendors or systems (pharmacies, CRMs, data warehouses)
* **Native MDI actions** — move an Encounter's status, send a message or email, assign a clinician, generate a Voucher, and more

Because Steps compose, a single Automation can span branching logic, an AI step, and an outbound HTTP call, all triggered by one event.

## Recipes

{% tabs %}
{% tab title="Refill reminder" %}

#### 1. Refill reminder with an automatic follow-up Voucher

Trigger an Automation on a schedule, or off an existing Encounter's treatment duration, to remind a patient it's time to refill — then generate and send the follow-up Voucher automatically as the next Step, with no manual API call needed. The patient gets a message with their `onboarding_url` and can re-enter the intake flow directly from it. See Refill Process for how the refill flow itself works, and Voucher Recipes for the manual/API equivalent of this step.
{% endtab %}

{% tab title="Message triage" %}

#### 2. Message triage and auto-reply

Use the Message Received trigger together with an AI-processing Step to classify incoming patient messages (e.g., "billing question," "clinical question," "order status") and branch accordingly. Common questions can get an immediate auto-reply Step, while anything clinical routes to the assigned clinician instead. This keeps response times low without staff having to triage every inbound message by hand.
{% endtab %}

{% tab title="External sync" %}

#### 3. Sync Encounter status to an external system

Add an HTTP Step after an Encounter Completed (or any status-change) trigger to push the update to an external system — a CRM, a data warehouse, an internal ops tool. This is a useful alternative or complement to consuming MDI's own webhooks: rather than standing up a webhook receiver, you let the Automation push the payload directly. See Webhook Setup & Signature Verification if you'd rather listen for events instead of, or in addition to, pushing them via a Step.
{% endtab %}

{% tab title="Notifications" %}

#### 4. General notification scheduler

Not every reminder needs a status change to trigger it. Use a Manual or scheduled-style trigger to nudge patients who started but didn't finish something — for example, reminding a patient to complete an intake they left partway through. Combine it with a branch that checks whether the intake was completed in the meantime, so you don't end up messaging patients who already finished.
{% endtab %}
{% endtabs %}

## Building an Automation

{% stepper %}
{% step %}

### Create a workflow

In the Partner Portal, open **Automations** and create a new workflow.
{% endstep %}

{% step %}

### Choose a Trigger

Pick the event that should kick off the Automation — an Encounter status change, a new Patient, a Voucher expiring, or one of the other available Triggers.
{% endstep %}

{% step %}

### Add Steps

Add Steps in order, configuring each one as you go — a condition, an AI prompt, an HTTP endpoint, or a native action.
{% endstep %}

{% step %}

### Test the workflow

Before publishing, test the workflow against a sandbox Encounter or Patient to confirm it behaves the way you expect.
{% endstep %}

{% step %}

### Publish

Once you're satisfied with the test run, publish it — the Automation now runs automatically whenever its Trigger fires.
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
Because Automations can take real actions — sending messages, changing Encounter status, generating Vouchers — always test new workflows in a sandbox environment first.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mdintegrations.com/partner/exploring-features/automations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
