flow.rk
Durable flow: steps run in order on an event or a schedule, through the queue.
Lives in modules/<module>/flows/<name>.rk (apps may add glue flows) · Schema flow.json (source) · first line: # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
Properties
| Property | Type | Meaning |
|---|---|---|
name required | name | snake_case, never renamed once released pattern ^[a-z][a-z0-9_]{0,62}$ |
label | label | A label in Bahasa Indonesia (required) and optionally English. |
label.id required | string | |
label.en | string | |
description | object | Owner sentence of what this flow does, conditions included (contract 0060 §1). Changes no behaviour. |
description.id required | string | |
description.en | string | |
on | string | Event: <connector>.<trigger>, <model>.created|updated|submitted|cancelled, or omitted with schedule |
schedule | string | Cron (5 fields) in system.scheduler.timezone pattern ^(@(hourly|daily|weekly|monthly)|([0-9*,/-]+\s+){4}[0-9*,/-]+)$ |
steps required | list of object or object or object or object or object or object or object or object or object or object | at least 1 |
idempotency | string | |
queue | object | |
if | CEL | A CEL expression (plus Rangka helpers) |
Example
From rangka-apps/modules/pipeline/flows/whatsapp_to_lead.rk (first 60 lines):
yaml
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
name: whatsapp_to_lead
label: {id: Chat WhatsApp baru jadi lead}
on: whatsapp_business.message_received
steps:
- {find: lead, where: phone == event.from, as: lead}
- {find: customer, where: phone == event.from, as: customer}
- if: lead == null && customer == null
create: lead
set:
lead_name: event.profile_name
phone: event.from
source: "'whatsapp'"
status: "'new'"
as: lead
- create: activity
set:
activity_type: "'whatsapp'"
subject: truncate(event.text, 80)
lead: lead.name
due_date: today()
done: 'true'
notes: event.text
idempotency: event.message_idGenerated from the schema by website/scripts/gen-reference.mjs. Edit the schema, not this page.