Automations
Let Kashef do routine work for you: alert staff, message patients on WhatsApp, Telegram, or email, update records, and connect with other systems and AI.
What automations do
An automation (also called a workflow) is a set of steps that runs by itself when something happens. For example:
- When an urgent order is registered, notify the branch managers.
- When a critical result is approved, send a Telegram alert to managers and technicians.
- When an order is completed, send the patient their results link on WhatsApp.
- Every evening, post the day's orders and payments to your management Telegram group.
- When a patient leaves feedback, let Kashef AI decide whether it is a complaint and escalate it.
- When a new patient is registered, send their details to your CRM or marketing tool.
Open Admin > Automations to see your workflows. You need the Automations: View permission to see them and Automations: Manage to create or change them.
Create a workflow
- Click Start from a template to begin from a ready-made workflow, or New workflow to start empty.
- The designer opens. Pick a trigger — what starts the workflow.
- Add steps under the trigger. Click the small + under a step, or select a step and click an item in the Add a step panel; the new step is connected automatically. You can also drag items onto the canvas and connect them by dragging from one dot to another.
- Click a step to open it and fill in its settings.
- Click Test to try it safely, then Activate.
Rename the workflow by clicking its name at the top. Press Ctrl+S (or ⌘+S) to save at any time.
Triggers: when the workflow starts
Every workflow has exactly one trigger. Picking another trigger replaces it and keeps the connected steps.
- Events in Kashef — an order is created or changes status, a critical result is approved, a sample collection is overdue, and patients, doctors, feedback tickets, samples, invoices, payments, finance, and inventory records are created, updated, deleted, or change status.
- For status changes, you can limit the trigger to certain statuses (for example only when an order becomes completed).
- For updates, you can list fields so the workflow runs only when, for example, the patient's phone or email changes.
- On a schedule — every few minutes, every hour, every day, week, or month at a time you choose, or a custom cron expression. Set the time zone, for example Africa/Cairo.
- Incoming webhook — another system starts the workflow by sending a request to the workflow's own URL, shown inside the trigger. Add a Secret so only systems that know it can call the URL (they send it in the
X-Webhook-Secretheader). The data they send is available as{{ body }}. - Incoming Telegram message — the workflow runs when someone sends a message to your lab Telegram bot. Choose the bot, and optionally limit it to certain chats or to messages that start with a command such as
/result. See Receive messages from your Telegram bot below. - Run manually — the workflow runs when someone clicks Run now from the automations list. You can pass optional input data, available as
{{ input }}.
Steps you can add
Lab records
- Find records — look up orders, patients, invoices, payments, samples, doctors, feedback tickets, inventory items, or finance transactions using filters, and use them in later steps.
- Count or total records — count records or calculate a total, average, minimum, or maximum, for example today's payments.
- Update a record — change allowed fields, such as an order's priority or a feedback ticket's status and priority.
- Add a note to an order — adds a follow-up note that staff see in the order notes, labelled with the workflow name.
- Create a feedback ticket — opens a patient feedback ticket so staff can follow it up under Patient Feedback.
- Reply to a feedback ticket — sends a reply the patient sees in their portal, or adds an internal note for staff, and can change the ticket status.
Messages and notifications
- In-app notification — appears in the bell menu of the staff roles you choose, in the triggering branch or all branches.
- Send email — to any address, the patient, or chosen staff roles.
- Send WhatsApp message — a text message or an approved WhatsApp template.
{{ generated.result_access_url }}adds a secure link to the patient's results. - Send Telegram message — see the Telegram section below.
- Post to Slack, Discord, Teams, or Google Chat — posts to a team channel.
Integrations
- HTTP request — call any other system's API to send or fetch data. The response can be used by the next steps.
Kashef AI
- Kashef AI — write or summarise text, classify text into one of your categories, or extract fields (such as a date or amount) as data. Available when Kashef AI is included in your plan.
Flow control and data
- If — splits into True and False paths using one or more conditions (all or any).
- Switch — a separate path for each value, for example one path per order priority, and a Default path.
- Loop over items — runs the For each path once for every item in a list, for example every record found, then continues with Done.
- Wait — pauses for minutes, hours, or days, or until a date, then continues (up to 30 days).
- Stop workflow — ends the run as completed or failed with a message.
- Set variables — calculate a value once and reuse it later as
{{ vars.name }}.
Use data from earlier steps
Any text field accepts values written between double braces, like {{ order.code }}. When a step is open, the Data you can use panel on the left lists everything available: the trigger's data, the output of every earlier step, variables, and loop items. Click a field in the form, then click a value in the panel to insert it.
- Trigger data:
{{ order.patient.name }},{{ result.value }},{{ body.order_code }} - An earlier step's output:
{{ nodes.find_records_1.count }}(the step ID is shown under Step options) - Inside a loop:
{{ loop.item.code }},{{ loop.position }}
You can format values with filters:
| Example | Result |
|---|---|
{{ order.code | upper }} |
Upper case |
{{ order.total_amount | number:2 }} |
1,250.00 |
{{ order.created_at | date:"d/m/Y H:i" }} |
15/10/2026 09:30 |
{{ order.notes | default:"—" }} |
A fallback when empty |
{{ nodes.find_records_1.records | pluck:"code" | join:", " }} |
A list joined into text |
Telegram notifications
There are two ways to send Telegram messages:
- Your lab Telegram bot — send to any chat, group, or channel.
- Create a bot with @BotFather in Telegram and copy its token.
- Add the bot to your group or channel (as an admin for channels).
- In Kashef open Admin > Automations > More > Credentials, click Add credential, choose Telegram bot, and paste the token. You can also save a default chat ID.
- In the Send Telegram message step choose the bot and enter the chat IDs (group IDs start with
-100) or a channel username such as@mylab_alerts.
- Kashef Bot — send to staff who connected their Telegram account to Kashef Bot from their profile notification settings. Choose the staff roles and branches; staff who did not connect Telegram are skipped.
Messages support bold, italic, and links (Telegram HTML), and you can add link buttons under the message or send a photo or document by URL.
Receive messages from your Telegram bot
Your lab bot can also start workflows when patients or staff message it, for example to answer /hours or to collect a request.
- Open Admin > Automations > More > Credentials and click Connect webhook next to your Telegram bot. The Receives messages column shows Connected when it is ready. If you change the bot token, connect it again.
- Create a workflow with the Incoming Telegram message trigger and choose the bot. You can limit it to some chat IDs or to messages that start with a word such as
/result. - Use the message in later steps:
{{ message.text }},{{ message.chat.id }},{{ message.from.first_name }},{{ message.from.username }}. - To answer, add a Send Telegram message step and choose Reply in the same chat. The reply goes to the person or group that sent the message, from the same bot.
A bot can only have one webhook, so connecting it in Kashef replaces any webhook another service set on the same bot. To stop receiving messages, click Disconnect webhook.
Credentials
API tokens, passwords, Telegram bot tokens, and chat webhook URLs are saved once under Admin > Automations > More > Credentials. They are encrypted and never shown in the designer; steps only refer to them by name. When you edit a credential, leave a secret empty to keep its saved value.
Test before you activate
Click Test in the designer to run the workflow immediately using recent data from your lab:
- Dry run (default) — every step runs, but messages, record updates, and requests that change data are only previewed. Nothing is sent.
- Live test — really sends messages, updates records, and calls other systems once. Wait steps are skipped.
After a test, each step shows a green tick or a red cross. Click a step to see exactly what it received and produced in the Output panel. Use Check to list anything that still needs fixing.
Activate, publish changes, and pause
- Activate checks the workflow and starts running it for new events. Each activation saves a version.
- While a workflow is active, your edits stay in the draft until you click Publish changes.
- Pause stops new runs without losing anything. Resume it from the automations list.
- To delete a workflow, pause it first. Its run history is kept.
- Use More on the list to Import workflow, and the menu on each workflow to Duplicate or Export it (to share a workflow with another lab).
Run history and failures
Click Executions in the designer to see recent runs on the canvas, or open Run history for the full list with each step's result.
- If a step fails, choose in its Step options what happens: stop and retry later (default), continue with the next step, or follow a separate red Error path — for example to alert a manager.
- Failed runs are retried automatically. Retry from failed step continues from where it stopped; steps that already finished, like messages already sent, are not repeated.
- Runs waiting on a Wait step show as Waiting; you can cancel them.
- Disable a step with the power button to skip it without deleting it.
Good practice
- Keep each workflow focused on one outcome and name it after that outcome.
- Send patients only the minimum details they need, and prefer the secure results link to pasting results.
- Use Dry run after every change, and watch the first real runs in Run history.
- Your plan includes a monthly number of automation runs; test runs do not count.
- Automations that change records can start other automations; Kashef stops chains that go too deep to prevent loops.