Automations
Build rules that react to clinic events or a schedule and then act for you, and check every run on the Runs and Analytics pages.
Automations
An automation rule does work for you when something happens. Each rule has three parts:
- A trigger: the event that starts the rule, for example Appointment completed or Material low.
- Optional conditions: checks on the trigger's data. If the checks fail, the actions don't run.
- One or more actions: what the rule does, for example Book Follow-up Appointment or Notify the owner.
Each time a trigger fires, MediSync records a run. You can see every run, its steps and any errors on the Runs page.
Before you start
- The Automations module must be on. Turn it on in Administration → Modules. See Modules.
- Some triggers and actions also need another module, for example Client Invoicing for invoice triggers. The tables below list them.
- To see the Automations pages, you need permission to view automations. Every Owner, Admin and Member has it.
- To create, edit, switch on or off, test or retry rules, and to change settings, you need permission to manage automations. Owners and Admins have it. Give it to other people with a custom role. See Staff & roles.
- Your plan can limit how many rules you can create. Owners and Admins can see the limit on Administration → Usage & limits.
Open Automations
In the sidebar, under Sales & Billing, open Automations. It has four pages:
- Automation rules: the list of your rules.
- Runs: every run of every rule.
- Analytics: charts of run results and messages sent.
- Settings: clinic-wide limits, the kill switch and the webhook allowlist.
If the module is off, or you don't have permission, the pages show The Automation module isn't enabled for this organization.
The rules list
Automation rules shows one row per rule, with the columns Name, Trigger, Enabled, Runs, Last run and Updated.
- Type in Search rules… to find a rule by name.
- Click a row to open the rule.
- Use the Enabled switch to pause or restart a rule. A paused rule keeps its settings and its run history. A new rule is enabled as soon as you save it.
To delete a rule, click the bin icon (Delete rule) at the end of its row, then click Delete rule in Delete this rule? to confirm. The rule stops running and leaves the list. Its past runs stay on the Runs page. You need permission to manage automations. If you may want the rule again later, switch it off instead.
Triggers
Pick the trigger in When this happens.
| Trigger | When it fires | Needs module |
|---|---|---|
| Client created | A new client is added. | None |
| Appointment completed | An appointment moves to Completed. | Appointment Scheduling |
| Invoice created | A client invoice is created. | Client Invoicing |
| Invoice issued | A client invoice is issued. | Client Invoicing |
| Invoice paid | A client invoice is paid. | Client Invoicing |
| Patient birthday | Once a day, for each client whose birthday is today. The check runs at midnight UTC. | None |
| End of day | Once a day at 18:00 in your clinic's time zone. | None |
| Material low | Once a day, for each stock-tracked product at or below its reorder level. The check runs at midnight UTC. | Products & Services |
| Material expiring | Once a day, for each stock lot that expires within the number of days in Alert within (days) (30 for a new rule; leave it blank for up to 365 days). The check runs at midnight UTC. See Get alerted before stock expires. | Products & Services |
| On a schedule | On a timetable you set (see below). | None |
The trigger list shows only the triggers whose module is on. If a module is turned off after you built a rule, the rule still opens, but you can't save it until you turn the module back on or change the trigger: MediSync shows This rule uses a trigger or action whose module is turned off for your organization. Turn the module on, or change the rule.
There is no trigger for a booking, an appointment that is about to start, a cancellation or a no-show. You can't use automations to send reminders before a visit or to follow up on a no-show.
On a schedule
Choose a Schedule type:
- Fixed interval: enter Every (minutes). The value must divide evenly into an hour or a day, for example 5, 15, 30, 60, 120 or 1440.
- Cron expression: enter a standard five-part cron expression in
Cron expression. For example,
0 9 * * 1means every Monday at 09:00. The smallest step is one minute.
Then enter a Timezone, for example Africa/Cairo. The default is
UTC.
A scheduled rule carries no client, appointment or invoice. Actions that need one, such as Tag Client, fail on a scheduled rule.
Conditions
Conditions check the data that came with the trigger. Each condition has a Field, an Operator and a Value. Operators include equals, does not equal, greater than, less than, contains, is one of, is empty and is not empty.
With two or more conditions, use Match to choose All conditions (AND) or Any condition (OR).
With no conditions, the actions run every time the trigger fires.
Each trigger carries these fields:
| Trigger | Fields |
|---|---|
| Client created | Client ID, Source, Has email, Has phone |
| Appointment completed | Appointment ID, Appointment type (the appointment type's code), Doctor (the doctor on the appointment), Client ID, Has follow-up (the client already has a later appointment booked) |
| Invoice created, Invoice issued, Invoice paid | Invoice ID, Client ID, Amount, Currency, Status (DRAFT, ISSUED or PAID) |
| Patient birthday | Client ID, Age |
| End of day | Date |
| Material low | Product ID, Name, On hand, Reorder level |
| Material expiring | Product ID, Name, Lot number, Quantity, Expiry date, Days until expiry, Branch |
| On a schedule | Scheduled time |
Amount is in the invoice's currency, for example 250 or 99.5.
Because invoice triggers carry the client, client actions such as
Tag Client or Send an email work on them.
Actions
Pick each action in Action. A rule runs its actions in order. If one action fails, the next ones still run.
| Action | What it does | Needs module |
|---|---|---|
| Notify the owner | Puts an in-app notification in the Owner's notifications. Choose a Severity: Info, Warning or Critical. The title is "Automation:" and the rule's name. The text is what you write in Message (optional), or, if you leave it blank, a short summary of what triggered the rule, for example the client's name, the invoice amount, or the product, lot and expiry date. It is written in the Owner's language. | None |
| Send an email | Sends the Subject and Message you write to the client or to the Owner (Send to). | None |
| Send an SMS | Sends the Message you write to the client or to the Owner. | SMS Notifications |
| Send a WhatsApp message | Sends the Message you write to the client or to the Owner. See WhatsApp messages from automation rules. | WhatsApp Messaging |
| Send Appointment Reminder | Sends the Message you write to the trigger's client. Choose a Channel: Email, SMS or WhatsApp. For email, also enter a Subject; if you leave it blank the subject is "Appointment reminder". | Appointment Scheduling |
| Create an invoice | Creates an invoice for the trigger's client, with the products or services you pick. Optionally Issue immediately and Email to client. | Client Invoicing |
| Send an invoice | Issues an invoice (if it is still a draft) and emails it to the client. Choose a Template: Basic or Detailed. | Client Invoicing |
| Assign a task | Creates a task for the Owner or a team member, with a Priority and Due in (days). The person sees it on their tasks page. | None |
| Send to lab | Creates a lab order for the trigger's client, with a Panel, Test codes and Specimen. | Lab Orders |
| Book Follow-up Appointment | Books the trigger's client into the first free slot of an Appointment type, starting Days after trigger days later (1 to 90). | Appointment Scheduling |
| Cancel Appointment | Moves the trigger's appointment to the final status you pick in Cancel to status. | Appointment Scheduling |
| Tag Client | Adds a tag to, or removes a tag from, the trigger's client. See Tags. | None |
| Update Client Field | Sets one of your custom client fields on the trigger's client. See Client field configuration. | None |
| Add Loyalty Points | Gives the trigger's client loyalty points, with a Note. Needs an active loyalty program. See Loyalty program. | Loyalty & Rewards |
| Send Webhook | Calls a web address of another system. See Send data to another system. | None |
Like triggers, the action list shows only the actions whose module is on.
Write the message
For Send an email, Send an SMS, Send a WhatsApp message and Send Appointment Reminder, type the text to send in Message. Email also needs a Subject. Click Insert field to add details from the trigger, for example the client ID or the invoice amount. MediSync fills them in when the rule runs. You can't save the rule while the message is empty: MediSync shows Write the message to send (and a subject for email).
A rule built before you could write the message refers to a notification template instead. Its action shows This action also references the notification template and the template's name. Write a message to replace the template.
A message step only shows Succeeded when the message was actually handed to the email, SMS or WhatsApp provider. If nothing could be sent, the step is Failed, and Run detail tells you why, for example Nothing was sent — the recipient has no address for this channel, or the action has no message text. The other actions in the rule still run.
Other limits to know
- Cancel Appointment needs a trigger that carries an appointment. The only one is Appointment completed, and a completed appointment can't change status. So this action has no practical use yet.
- Book Follow-up Appointment fails if no slot is free in the search window. It uses the branch of the completed appointment.
Use data from the trigger or an earlier step
Some text fields have an Insert field button. It adds a placeholder that MediSync fills in when the rule runs:
- From the trigger: data that came with the trigger, for example
{{trigger.clientId}}. - From a previous step: output of an earlier action in the same rule. Create an invoice gives Invoice ID and Invoice total.
The main use is to send an invoice that the rule just created. See example 2 below.
See assigned tasks
Tasks from Assign a task appear on My tasks, directly under Overview in the sidebar. Every team member has this page.
- It lists the tasks assigned to you: open tasks first, soonest due first, then finished ones. Each task shows its priority (Low, Normal, High or Urgent) and its due date.
- Click Mark done when you finish a task. It then shows Done.
- If you can manage automations, choose All tasks to see every task in your clinic and who it is assigned to (or Unassigned), and mark any of them done. Assigned to me goes back to your own tasks.
A task assigned to the Owner appears on the Owner's My tasks.
Create a rule in Simple mode
Simple mode is a form. Use it for rules that run straight down: one trigger, an optional set of conditions, then actions.
- Go to Automations → Automation rules and click New rule.
- Keep the Simple tab.
- Enter a Name. Optionally add a Description.
- Optionally set Max runs per day for this rule. Leave it empty to use the clinic default from Settings.
- Leave Allow this rule to trigger other rules off unless you need it. When it is on, things this rule does (for example, a new invoice) can start other rules, up to a safe depth.
- Under Trigger, choose When this happens.
- Under Conditions, click Add condition for each check you need.
- Under Actions, choose the first Action and fill in its fields. Click Add action to add more. A rule needs at least one action.
- Click Save rule.
Create a rule in Advanced mode
Advanced mode is a canvas. Use it when you need branches, for example "if the condition is true do this, otherwise do that".
- Click New rule, then click the Advanced tab.
- Enter a Name.
- The canvas starts with a When step. Click it and pick the trigger in the Inspector panel.
- From Add step, drag a Condition or an Action onto the canvas.
- Connect the steps: drag from the dot on the edge of one step to the next step. A condition step has two outputs, true and false. Connect each to the steps that should run in that case.
- Click a step to edit it in the Inspector. In a condition step,
pick the Field from the trigger's fields, for example
Days until expiry, then pick the Operator and enter the
Value. To check a field that isn't listed, choose
Other field key… and type its internal name. Each condition step
holds one check. For Material expiring, the When step also has
Alert within (days). Message actions have the same Message and
Subject boxes as in Simple mode; type a placeholder such as
{{trigger.clientId}}yourself, as the canvas has no Insert field button. - To remove a step, right-click it and click Delete node, or select it and press Delete. You can't remove the When step.
- Watch the badge in the toolbar. It shows Valid, or the number of issues, for example a step that isn't connected or a loop.
- Click Save. Save is available only when the rule has a name and no issues.
The toolbar also has Undo, Redo, Tidy layout, Fit view and Full screen.
Each mode saves on its own. Save your work before you switch tabs. A rule with branches can only be edited in Advanced mode, so the Simple tab is greyed out for it.
Test a rule
You can test a saved rule from the Simple tab.
- Open the rule.
- Click Test.
The test changes nothing and sends nothing. The Simulation result lists each step as would run or skipped. The test uses no sample data, so a condition that needs a value usually shows its actions as skipped.
A rule with branches can't be tested, because it can't open in Simple mode.
Check runs
Go to Automations → Runs. Each row shows the Rule, Trigger, Status, Started, Finished, Duration and Actions.
Filter the list with Rule, Status, Trigger, From and To. Use Previous and Next to page through.
| Run status | What it means |
|---|---|
| Pending | Waiting to run. |
| Running | Running now. |
| Succeeded | Every action succeeded, or no action needed to run. |
| Partial | Some actions succeeded and some failed or were skipped. |
| Failed | Every action failed. |
| Skipped | The run didn't happen, for example because the rule was paused, the kill switch was on, or the rule reached its daily limit. |
Click a run to open Run detail. It lists each step in order, with its name (for example Send an email), status, the branch taken (for conditions), the channel (for messages) and, if something went wrong, the reason in plain words. Below the reason you may see the technical message from the email, SMS or WhatsApp provider, to share with support.
Retry a run
For a Failed or Partial run, Run detail shows Retry. Click it to run the rule again. Actions that already succeeded are not run a second time. You need permission to manage automations.
Analytics
Go to Automations → Analytics. Choose 30 days or 90 days. The page shows:
- Total runs, Success rate, Partial rate, Failure rate and Top failure reason.
- Runs over time, split by status.
- Actions by type and Messages by channel.
- Sends vs. daily quota.
- Top rules, by number of runs.
Settings
Go to Automations → Settings. You need permission to manage automations to change anything here. Click Save changes after you edit the first three settings.
Sends used today shows how many messages your rules sent today.
Kill switch
Turn on Kill switch to stop every rule in your clinic at once, for example if a rule is sending the wrong messages. While it is on, no rule runs. Runs that were already waiting are marked Skipped. Events that happen while it is on are not run later. Turn it off to start again.
Daily send quota
Daily send quota is the most messages your rules can send per day, across all rules. It counts email, SMS and WhatsApp messages, including invoice emails. When the quota is reached, further message actions that day are Skipped. The day resets at midnight UTC. Leave the field empty for no limit. Enter 0 to block all messages.
Default per-rule run cap
Default per-rule run cap is the most times a single rule can run per day. A rule's own Max runs per day overrides it. When a rule reaches its cap, further triggers that day are ignored. The day resets at midnight UTC. Leave the field empty for no limit.
Provider credentials
Add your own WhatsApp sender here. See WhatsApp messages from automation rules.
Webhook allowlist
A Send Webhook action can only call a web address whose domain is on this list. This stops a rule from sending your data to an unknown site.
- Enter the domain, for example
api.partner.com. - Click Add domain.
The match is exact: partner.com does not cover api.partner.com. Click
Remove to take a domain off the list.
Send data to another system
Send Webhook sends the trigger's data to another system, for example your accounting tool.
- Add the other system's domain to the Webhook allowlist.
- In the rule, add a Send Webhook action.
- Enter the URL. It must start with
https://. - Choose the Method, for example
POST. - Optionally enter a Body template (optional, JSON). Leave it blank to send the trigger's data as JSON.
MediSync also refuses addresses inside private networks.
Examples
1. Book a follow-up visit after each appointment
- When this happens: Appointment completed.
- Action: Book Follow-up Appointment. Pick the follow-up
Appointment type and set Days after trigger to
14. - Save. MediSync books the client into the first free slot from 14 days after the visit. Check Runs for any Failed runs, for example when no slot was free.
2. Invoice and email the client after each appointment
- When this happens: Appointment completed.
- Action 1: Create an invoice. Set the Currency, the Item type (Service), the Item and the Quantity.
- Action 2: Send an invoice. In Invoice, click Insert field and choose Invoice ID under From a previous step. Choose a Template.
- Save.
3. Welcome new clients with a tag and loyalty points
- When this happens: Client created.
- Action 1: Tag Client. Set Operation to Add and choose a Tag, for example "New client".
- Action 2: Add Loyalty Points. Enter the Points and a Note, for example "Welcome bonus".
- Save.
4. Get told when stock runs low
- When this happens: Material low.
- Action: Notify the owner with Severity Warning.
- Save.
The Owner gets one notification per low product per day, for example "Gauze is running low: 2 left (reorder level 10)".
Common problems
I can't see Automations in the sidebar. The Automations module is off, or your role can't view automations. Ask an Owner or Admin.
The New rule button or the Enabled switch is missing or greyed out. You can view automations but not manage them. Ask an Owner or Admin for a role that can manage automations. The switches are also locked when your clinic's account is read-only or suspended.
"You’ve reached this organization’s limit for this resource. Contact your admin to raise the cap." Your plan's rule limit is reached. See Billing & plans.
My rule didn't run. Check that the rule is enabled, that the kill switch is off, that the rule hasn't reached its daily cap, and that the module the trigger needs is on. Daily triggers run once a day, so wait for the next check.
A run is Failed with "There was no one to send this to" or a missing client. The trigger doesn't carry a client. Scheduled, end-of-day and stock triggers don't. Use a client, appointment, invoice or birthday trigger for client actions.
A message step is Failed with "Nothing was sent". The client has no email address or phone number on file for that channel, or the action has no message. Add the contact detail to the client, or write the message. See Write the message.
A message action is Skipped with "Skipped — the daily send quota was reached." Raise Daily send quota in Settings, or wait until midnight UTC.
A Send Webhook action failed with "not on this organization's webhook allowlist". Add the exact domain in Settings → Webhook allowlist.