Back to Wekan

IFTTT / Rules (Automation)

docs/Features/IFTTT/IFTTT.md

9.574.3 KB
Original Source

IFTTT / Rules (Automation)

WeKan Rules ("if this then that") automate your board: when something happens (a trigger), WeKan runs an action.

See the full, up-to-date reference at Features / Rules — this page is a quick overview. The Rules page is now a fullscreen page (board sidebar → Rules), not a popup, and adds selecting, editing, import/export, a visual Workflow view, scheduled rules, and a REST API.

What's new beyond the basics below

  • Scheduled triggers: run rules on a schedule (once / daily / weekday / weekly / monthly at a time), on due dates (set / approaching / overdue), or by card aging ("a card has been in a list for N days"). Example process that works out of the box: archive cards that have been in "Completed" for 90 days.
  • Buttons: card buttons (shown on the card) and board buttons that run an action on demand.
  • More actions: sort a list, move all cards in a list, mark card complete / incomplete, set a date relative to now, in addition to the actions below.
  • Manage rules: select all / unselect all, delete selected, edit (rename), and a visual Workflow view (When … → Then …, grouped by trigger).
  • Import / Export rules to JSON (lossless) and CSV (round-trippable); export only selected rules; best-effort import of Trello Butler commands; import of Jira automationRules.
  • REST API to add/edit/remove rules — see Rules REST API below.

1) Click: Menu item for the rules

2) Rule Menu: Overview, deleting and adding new rules

2a) Add new rule : Triggers

Currently, there are three types of triggers: board, card and checklist

BoardCardChecklist
create cardadded/removed label, attachment, personchecklist added/removed
card moved tocheck item checked/unchecked
card moved fromchecklist completed

2b) Add new rule : Actions

For every trigger, there are 4 types of actions: board, card, checklist and mail

BoardCardChecklistMail
move card to listadd/remove label, attachment, personchecklist add/removesend email to
move to top/bottomset title/descriptioncheck/uncheck item
archive/unarchivechecklist complete

Example : How the rule works

  • Rule 1: When a card is added to the board -> Add label yellow
  • Rule 2: When a card is moved to List 2 -> Add checklist ToDo
  • Rule 3: When a card is added to List 1 -> Add label blue

Rules REST API

Rules can be added, edited and removed over the REST API. The trigger and action are embedded inline so each rule is self-contained.

MethodPathPurpose
GET/api/boards/:boardId/ruleslist rules
GET/api/boards/:boardId/rules/:ruleIdget one rule
POST/api/boards/:boardId/rulesadd a rule
PUT/api/boards/:boardId/rules/:ruleIdedit a rule (title / trigger / action)
DELETE/api/boards/:boardId/rules/:ruleIdremove a rule (and its trigger + action)

POST / PUT body:

json
{
  "title": "Archive after 90 days",
  "trigger": { "activityType": "scheduledTrigger", "scheduleKind": "aging",
               "listName": "Completed", "days": 90, "atTime": "03:00" },
  "action":  { "actionType": "archive" }
}

Python helper (api.py):

bash
python3 api.py listrules BOARDID
python3 api.py addrule BOARDID 'On create -> top' \
  '{"activityType":"createCard","listName":"*","swimlaneName":"*","cardTitle":"*","userId":"*"}' \
  '{"actionType":"moveCardToTop","listName":"*","swimlaneName":"*"}'
python3 api.py editrule BOARDID RULEID '{"title":"New title"}'
python3 api.py removerule BOARDID RULEID

See Features / Rules for the full list of trigger activityTypes and action actionTypes, scheduled rules, buttons, the visual Workflow view, and Trello/Jira import.