Automations
Extend automations
What package modules bring to automations without any extra work, how the AI Assistant builds and checks automations, and the interfaces and endpoints for new triggers and steps.
Automations are not tied to the modules nexxus ships with. A package module you install adds its data and its actions, the AI Assistant builds automations in a conversation, and the triggers and steps themselves are a list that grows.
What a package module brings along
Section titled “What a package module brings along”A package does not have to do anything for automations. Once it is installed and active:
- Its entities are data sources. Each one appears in the list of sources with the key
<package>:<entity>, with its indexed fields, the same way as in dashboard tiles and the AI Assistant. A field without an index is missing there too. Details in Sources from packages. - Its records trigger. A record is created and A record is changed work for package records, including Only on changes to: the package runtime reports which fields changed. Records that arrive through an import do not trigger, the same as everywhere else.
- Its writing actions are steps. Run an action lists them next to the core actions, with the fields the package declares. Actions that delete or remove something are left out here too.
A change made by a package action can trigger other automations, within the same limits for chains.
A package cannot add a trigger or a step of its own. Triggers and steps are part of the nexxus platform, see New triggers and steps.
Automations from the AI Assistant
Section titled “Automations from the AI Assistant”Describe what you want in the chat, for example “tell me when a risk becomes high”, and the AI Assistant can build the automation for you:
- It proposes, you approve. Creating or changing an automation is a change like any other, so you see it first and confirm it. See The AI Assistant proposes, you approve.
- It can try an automation out, with the same test run as the tab Test run, and see what would fail.
- It can read the history of an automation, to find out why it did not run or which step failed.
- It knows what the editor offers you: the triggers and steps, your sources with their fields, the actions a step can run and the limits. It reads them with the tool
nx_automation_catalogue, from the same place as the editor.
The AI Assistant works with your rights. Tenant automations need the permission automation.manage here too, and a personal automation it creates belongs to you.
New triggers and steps
Section titled “New triggers and steps”Triggers and steps are each a list of Spring beans in the nexxus backend. The check on saving, the runs and the test run work from that list, so a new trigger or step needs no change to any of them. The interfaces are in app.modules.automation, file AutomationTypes.kt:
| Interface | For | Must provide |
|---|---|---|
AutomationTriggerType | every trigger | its key, label and description, whether it delivers records, normalise to check it on saving, describe for the sentence in the editor |
AutomationEventTrigger | a trigger that reacts to changes of records | fires: the run a change starts, or none |
AutomationPollingTrigger | a trigger that checks by itself | due and poll. The job AUTOMATIONS asks every minute |
AutomationStepType | every step | key, label, description, normalise, describe and execute; needsRecord and childKeys for steps like If / else |
A few rules hold for every type:
normalisekeeps only the fields that belong to the type and throwsBxBadArgumentErrwith a sentence for the person in the editor.executeruns as the person the automation runs as, inside the transaction of the run, so a failure rolls back the whole run. In a test run (ctx.test) it changes nothing and returns what it would do aspreview.- What
executereturns asoutputis available to later steps as{{stepN.<field>}}.
The editor has forms for the built-in types only. A trigger or step without a form shows its label from /api/automation/types and a notice such as A module brings this step; here it can only be moved or removed. Its settings stay as they are; it is set up through the actions below.
Endpoints
Section titled “Endpoints”The editor reads four endpoints. Each answers with the rights of the person signed in:
| Endpoint | Returns |
|---|---|
GET /api/automation/types | every trigger and step with key, label and description |
GET /api/automation/sources | the sources you may read, with their fields and the comparisons each field supports |
GET /api/automation/actions | the writing actions you may run as a step, with their input schema |
GET /api/automation/status | whether the two cron jobs run, and whether you may manage tenant automations |
Automations themselves are created, changed and tried out through the actions automation.create, automation.update and automation.test, and automation.runs returns their history. The AI Assistant uses the same actions, and reads what the four endpoints return through the tool nx_automation_catalogue.