Przejdź do treści
Intum

Automatyzacje - reguły typu "kiedy, jeśli, to"

Aktualizacja: 3 min czytania

Endpoints

Metoda Ścieżka Opis
GET /automation/rules.json Lista (filtry: q, active, trigger_kind, source_type, app_code, group_code)
POST /automation/rules.json Utworzenie
PATCH /automation/rules/:id.json Aktualizacja
DELETE /automation/rules/:id.json Usunięcie
POST /automation/rules/:id/dry_run.json Dry-run na rekordzie (subject_id) - bez wykonania akcji
POST /automation/rules/:id/run.json Ręczne wykonanie (subject_id / subject_ids, max 100)

Przykład: reguła zdarzeniowa

POST /automation/rules.json
{ "rule": {
  "name": "Reklamacja - reakcja",
  "trigger_kind": "event", "source_type": "Organize::Task", "event": "update",
  "conditions_json": "{\"changed\": {\"status_id\": {\"to\": 5}}}",
  "actions": [
    { "kind": "predefined", "action": "notification", "user": "responsible", "message": "Reklamacja: {{title}}" },
    { "kind": "predefined", "action": "update_record", "field": "priority", "value": "1" }
  ]
} }

Przykład: sekwencja czasowa (drip)

{ "rule": {
  "name": "Powitanie klienta (3 dni)",
  "trigger_kind": "time_offset", "source_type": "Crm::Client",
  "anchor_field": "created_at", "offset_value": "3", "offset_unit": "days",
  "actions": [ { "kind": "predefined", "action": "send_template", "template_id": 7, "mailbox_id": 2 } ]
} }

Akcje: notification, update_record (field + value, whitelista pól per model), send_template (template_id + mailbox_id), send_sms / send_chat (connector_id + message), create_task (title, user, project_id), start_escalation (escalation_policy_id, resolve_on_change), send_webhook (url, token), {"kind":"flow","flow_code":"..."}.

Warunki: równość, tablica wartości, {"any": [...]}, operatory not, gt, lt, contains, present, oraz {"changed": {"pole": {"from": ..., "to": ...}}}. Treści akcji obsługują {{pole}} z payloadu rekordu.