When an automation rule fires, it executes one or more actions. Each action is implemented by a handler. The handlers library lives in the backend across 5 domains: booking, marketing, sales, accounting, notification. This article is the reference: every released action with what it does, what config it accepts, what payload it sees, and a working example. Use this when designing rules.
How to use this reference#
- Browse by domain to find the action you need.
- Each handler has: purpose, trigger compatibility, config schema, example.
- Examples use the released action catalog from the unified action runner.
- Configure your rules under Automations → Custom automations. Built-in automations have a separate catalog.
Booking domain handlers#
booking.session.morning_reminder#
- Purpose: morning reminder to patients with sessions later today.
- Trigger: cron
scheduler.daily.morning_reminders.v2. - Config: template, channel, lead time.
booking.session.evening_reminder#
- Purpose: evening reminder for tomorrow's sessions.
- Trigger: cron
scheduler.daily.evening_reminders.v2.
booking.session.telehealth_reminder#
- Purpose: telehealth-specific reminder with join link.
- Trigger: cron
scheduler.daily.telehealth_reminders.v2, scoped to telehealth sessions.
booking.session.service_reminder#
- Purpose: per-service custom reminder timing (for example labs need 48 h, consults 24 h).
- Trigger: cron
scheduler.daily.service_reminders.v2.
booking.session.morning_reminder_catchup / service_reminder_catchup / evening_reminder_catchup#
- Purpose: catchup variants that re-send to patients who didn't acknowledge the initial reminder. Three separate handlers, one per parent.
- Trigger: respective
scheduler.daily.*_catchup.v2crons that run later in the day.
booking.session.consultation_followup#
- Purpose: post-consultation follow-up message.
- Trigger: cron
scheduler.daily.consultation_followup.v2. The daily tick scans completed consultations. - Config: wait days after session done, template, optional review request.
booking.session.review_reminder#
- Purpose: request a review after a positive visit.
- Trigger: cron
scheduler.hourly.review_reminders.v2.
booking.session.statistics#
- Purpose: emit session statistics for reports.
- Trigger: cron
scheduler.daily.session_statistics.v2.
Marketing domain handlers#
marketing.lead.auto_assign#
- Purpose: auto-assign a new lead to the least-loaded eligible rep.
- Trigger:
marketing.lead.created.v2. - Config: candidate roles, branch scope.
marketing.lead.first_contact_sla#
- Purpose: enforce a first-contact SLA after assignment.
- Trigger:
marketing.lead.assigned.v2.
marketing.lead.auto_label#
- Purpose: auto-apply labels to a new lead based on rules.
- Trigger:
marketing.lead.created.v2. - Config: rule list (source to label, utm campaign to label, etc.).
marketing.lead.advance_on_booking#
- Purpose: advance a lead to "Booked" or "Attended" stage when the patient's session is created.
- Trigger:
booking.session.created.v2. - Note: this is the only built-in stage-advance handler. Other stage transitions are manual or via the custom-automation designer with an
emit_eventchained to a marketing listener.
marketing.retargeting#
- Purpose: re-engage dormant patients.
- Trigger: cron
scheduler.daily.retargeting.v2.
Sales domain handlers#
cashback_award#
- Purpose: award cashback to patient wallet on paid invoice.
- Trigger: invoice.paid.v2.
- Config: cashback rate (%), eligibility rules.
- Side effect: posts wallet liability + cashback expense.
cashback_redemption_nudge#
- Purpose: encourage patient to redeem wallet credit.
- Trigger: scheduled cron checking wallet balance + last visit.
- Config: minimum balance threshold, message template.
sales.invoice.send_details_reminder#
- Purpose: send the invoice details to the patient when the invoice is created.
- Trigger:
sales.invoice.created.v2. - Config: template, channel, delay before send.
- Note: there is no built-in D+3 / D+7 / D+14 dunning ladder yet. Set up that ladder yourself as three scheduled
scheduler.croncustom automations that look up overdue invoices by age.
Accounting domain handlers#
vendor_bill_due#
- Purpose: reminder for upcoming vendor bill payment.
- Trigger: scheduled cron checking AP due dates.
- Config: lead time before due, accountant notification.
Notification domain handlers#
crm_daily_push#
- Purpose: daily CRM digest to staff (lead summary, pipeline health).
- Trigger: scheduled cron 08:00.
- Config: recipient role, KPI selection.
crm_weekly_push#
- Purpose: weekly CRM rollup.
- Trigger: scheduled cron Monday 09:00.
- Config: recipient role, KPI selection.
Generic action catalog#
Beyond the domain-specific handlers, the unified action runner provides these primitive actions usable in any rule:
send_whatsapp#
- Purpose: send a WhatsApp message via an approved template.
- Config: template_key, variables map, sender_account, language_code.
- Side effects: respects the messaging layer's 24-hour window, marketing-consent gate, opt-out, quiet hours, and provider rate limit. The error-131049 guard is live. Refusals surface with the upstream error code in
action_results[].detail.
send_sms#
- Purpose: send SMS.
- Config: message body, variables.
- Side effects: respects opt-out, rate limit.
send_email#
- Purpose: send transactional or marketing email.
- Config: subject, body, attachment path.
- Side effects: respects opt-out.
create_task#
- Purpose: create an operational task for a user.
- Config: title, description, assignee derivation, due date, priority, linked record.
- Side effects: task.created.v2 event.
award_club_points#
- Purpose: add loyalty points to patient.
- Config: points amount, reason.
deduct_club_points#
- Purpose: subtract points (e.g. on refund).
- Config: points amount, reason.
add_customer_tag / remove_customer_tag#
- Purpose: tag manipulation.
- Config: tag name.
- Side effects: tag visible everywhere patient appears.
add_lead_note#
- Purpose: append a note to a lead.
- Config: note text with variable substitution.
if / else (branch)#
- Purpose: conditional branching in multi-step rules.
- Config: condition (DSL), true-branch actions, false-branch actions.
emit_event#
- Purpose: emit a custom event for other rules or external listeners.
- Config: event name (must be registered), payload.
http_webhook#
- Purpose: call an external HTTPS endpoint.
- Config: URL (HTTPS only, allowlist enforced), method, headers, body.
- Safety: SSRF guard blocks private IPs, HMAC signing, allowlist.
Custom-automation action types (designer)#
What the tenant-authored designer composes inside an actions list:
- send_whatsapp / send_sms / send_email: a messaging action.
- create_task / add_lead_note: an operational action.
- award_club_points / deduct_club_points / add_customer_tag / remove_customer_tag: a customer-domain action.
- http_webhook: external integration.
- emit_event: chain to other rules.
- if: conditional branch with then / else action lists.
Workflow-engine step types (API only)#
The backend ships a richer multi-step engine (WorkflowDefinition plus WorkflowStep) with these step types.
- action: execute a handler.
- condition: evaluate, proceed or skip.
- delay: wait N minutes / hours / days, or wait until a condition is met (capped by
delay_max_wait_minutes). - branch: multi-way split.
- parallel: execute branches concurrently, then continue when all complete.
- end: terminate the workflow instance.
Action config schema#
Every action accepts a config object. Common fields:
- template: template name to render (for messaging actions).
- variables: map of variable names to JSON path expressions (e.g.
patient_name: payload.customer.full_name). - channel: explicit channel (WhatsApp / SMS / email).
- fallback_channels: ordered list for retry.
- rate_limit_count + rate_limit_period_minutes: per-rule rate cap.
- quiet_hours_respect: boolean.
- marketing_consent_required: boolean.
- conditions: pre-action evaluation (skip if false).
Template renderer#
- All text content supports
{{path.dot.notation}}for variable substitution. - Paths resolve against the event payload + patient context + clinic context.
- Examples:
{{patient.first_name}},{{session.start_time}},{{clinic.name}}. - Default fallback when path missing: empty string or configured default.
Audit per action#
- Every action's outcome is recorded in
AutomationExecutionLog.result.action_results. The list has one entry per action in the rule, with status, detail, provider_code, upstream_message_id. - The correlation_id ties the run back to the source event in
EventAuditTrailso support can grep end-to-end.
When http_webhook is refused#
The SSRF guard refuses certain URLs before the request goes out. The action returns status: failed with detail: blocked: <reason> and emits an audit event so you can spot the refusal in the log.
Blocked cases:
- Private and link-local IPs (
10.0.0.0/8,192.168.0.0/16,169.254.0.0/16,127.0.0.0/8). They point at your own infra. - Non-HTTP schemes. Only
http(s)POST / GET / PUT / PATCH are allowed. The guard strips the body for GET. - Redirects. The action runs with
allow_redirects=falseto block the redirect re-entry path. - Timeout. Default 5 s per request. Bump via the action's
timeout_secondsconfig up to a tenant-set cap.
If your integration legitimately needs to point at an internal IP, ask support to add the host to the allowlist. Do not work around the guard.
Versioning#
- Handlers themselves do not carry a version field. What carries a version is the trigger event name (for example
booking.session.created.v2). When engineering bumps an event's payload shape, the version goes up and the old name stops emitting. A rule pinned to the old name silently stops firing. - Release process bumps locked-rule and custom-rule trigger names automatically when an event version bumps. After any major release, scan custom automations for any name that ends in an old
.vN(see When the trigger event version bumps).
Coming soon (handlers roadmap)#
- send_push: native push notification action.
- create_appointment: book a session from a rule (no-show recovery).
- cancel_appointment: rule-driven cancellation.
- send_payment_link: generate and send pay-by-link.
- charge_stored_card: charge tokenised card (no-show fee).
- send_consent_request: trigger e-sign flow.
- create_quote: build a quote from a service list.
- raise_alert: high-priority operator alert.
- train_ai_with_message: feed an exchange to the AI knowledge base.
- generate_report_snapshot: scheduled report delivery.
- backfill_event: re-fire an event for testing.
Common mistakes#
- Hardcoded recipient instead of variable: messages go to wrong person.
- Missing conditions on marketing actions: spam patients.
- Rate limit too low: legitimate messages queue.
- Rate limit too high: misfiring rule floods.
- Webhook to private IP: SSRF guard blocks.
- Template variable typo: empty string in message.
- Action conditions evaluated incorrectly: dry-run before publish.
How handlers connect#
- Automation engine: executes handlers in rule order.
- EventAuditTrail: source event captured.
- ExecutionLog: per-action outcome.
- Template renderer: variable substitution.
- Messaging: send_whatsapp/sms/email route to provider.
- Tasks: create_task fires task.created.v2.
- Loyalty: award/deduct points.
- Patients: tag manipulation.
- External services: http_webhook (with safety).
