Skip to content

Automations

An Automation binds a trigger to an action: every time the trigger emits a value, the action runs. Under the hood it is a managed, long-running continuous task with a first-class lifecycle — start, stop, run history, and drift detection — so you don’t have to wire up and babysit that continuous task yourself.

Typical uses:

  • A trigger watches an inbox → the action processes each new email.
  • A trigger listens for webhook events → the action handles each incoming payload.
  • A trigger polls a data source → the action processes each new record.

Automations connect two task templates, each marked with a role:

  • A Trigger template is a continuous template that produces a stream of values. It ends in a single exit node — the point where it hands each value off to whatever comes next. On its own, a trigger’s output goes nowhere; an automation gives it a destination.
  • An Action template is an ordinary task template that runs once per value the trigger emits. It is invoked by reference, exactly like a sub task.

Templates are marked as Trigger or Action by their role, and the wizard only offers valid, enabled templates of the matching role.

Open the automation wizard and work through its steps:

  1. Trigger — pick the trigger template and fill in its input (the same form you would fill in to start that template as a task).
  2. Action — pick the action template. Requence checks whether the trigger’s output type satisfies the action’s input type.
  3. Mapping — shown only when the types don’t match. Supply a small TypeScript mapping function that converts the trigger’s output into the action’s input (see below).
  4. Confirm — give the automation a name, choose whether each action run waits for delivery, and review the summary.

Finish with Create (save it idle) or Create & Start (save it and start running immediately).

Your own application can also create, start, stop, read and delete automations with an access token — see Managing Automations.

A trigger template can mark an input field as Secret — see Entry Node. Use it for a credential that belongs to one automation, such as a mailbox password.

  • The automation stores the value encrypted and never shows it again — not in the wizard and not through the API.
  • When you edit the automation, type the secret again. A secret field you leave empty is removed.
  • In the tasks the automation starts, the value is redacted from inputs, results and error text, on the same best-effort basis as a secret variable. The service still receives the real value.

When the trigger’s output shape already satisfies the action’s input, no mapping is needed and the wizard skips the Mapping step. When the shapes differ, you write a function that adapts one to the other:

(input: TriggerOutput): ActionInput => {
// build the action's input from the trigger's output
return { /* ... */ }
}

The editor is pre-seeded with the concrete TriggerOutput and ActionInput types (and any schemas they reference), so you get full autocomplete and type-checking while you write the mapping.

An automation is always in one of four states:

Status Meaning
Idle Saved but not running
Running Its continuous task is live, invoking the action on every trigger emission
Stopped Was running and has since stopped — by you, or because the task ended on its own
Failed The underlying task failed

Start and stop an automation from its row in the list or from the wizard. Each run is a real task, so you can open and inspect it like any other task. The run history shows the current run plus every previous run, with stop and error reasons.

Deleting a running automation stops its running task. The tasks of earlier runs are not deleted: task retention deletes them later, like any other task. What the automation kept in the store is deleted with it.

Every start of an automation is a new task. Anything the trigger kept in its task is gone, so a trigger that does not remember its position starts from “now” again — and everything that arrived while the automation was stopped is skipped.

To continue where it stopped, the trigger keeps its position in the store under the automation binding:

  • a node writes the position as each value goes out — for email, the uid of the last mail;
  • the receiver reads it back in a computed configuration field, so a new start begins after it.

That position belongs to this automation. Every start of it reads it, a second automation on the same trigger template never does, and deleting the automation deletes it. The same read happens when the receiver’s service restarts or retries inside one run.

Delivery is at least once. A value that went out but was not yet recorded when the trigger stopped goes out again on the next start. Build the action so that handling the same value twice does no harm.

One case is not covered: stopping an automation also stops the action runs that are still working. A value already recorded whose action was stopped half-way is not sent again.

Failed is final. Requence does not restart a failed automation. To run it again, start it yourself.

The reason is the trigger. By the time its task fails, the trigger service has already decided not to try again:

  • for a fault that can go away (network, timeout, a server that is down), the service retries the message itself;
  • a node’s Retry setting retries a thrown error that many times;
  • any other error fails the node, because trying again cannot fix it (a wrong password, a missing mailbox).

A second retry on the automation would repeat that decision, and could turn a deliberate failure into a loop.

Why it failed is shown on the automation: its failureReason is the error of the task that failed. It is read from that task when you look, so a secret the service echoed in its error is masked, exactly as on the task itself. It is empty in every status except Failed, and also when that task has been deleted since.

One bad action run won’t stop the automation

Section titled “One bad action run won’t stop the automation”

If a single action run errors, the failure is caught and routed aside — it does not bring down the continuous task. The automation keeps reacting to subsequent trigger emissions. By default the failure is simply logged.

Each trigger event runs the action as its own task — an action run. You can open each one like any other task.

When your own application consumes the results, choose wait for delivery on the Confirm step (requireAck in the API):

Option Meaning
No (default) An action run ends directly.
Yes, the app acks on receive A finished action run waits in Awaiting Delivery until your app receives it.
Yes, the app acks after processing It waits until your app has processed it and acks it.

With delivery, your app gets every result also when it was down for a while: the result waits for it. The default is No, because an automation that nobody watches would pile up waiting results.

  • Only the action runs wait. A task that a node inside the trigger starts, or that an action run starts, never waits.
  • A change reaches the action runs that start after the change.
  • Every access token with write access to the automation’s scope may ack an action run.
  • A result waits until it is acked, or until the scope’s max wait for delivery has passed (30 days by default). Then it is deleted.

When results wait, the automation’s run history shows a warning such as “20 results waiting for delivery · the oldest expires on 18 Dec”. When the last one is acked, the warning goes away. Requence sends no notification for it.

An automation can run for months, and each event adds an action run and some history to the automation’s task. Task retention deletes them again:

  • A finished action run is deleted after the scope’s max tasks age, and only the newest automation run history limit (1 000 by default) are kept per automation. An action run that waits for delivery is kept until it is acked or its deadline has passed.
  • When an action run is deleted, the automation’s task deletes the trigger output, node history and files of that event too.
  • An event that never started an action run, and node history that belongs to no event, are deleted after the max tasks age.

So the canvas of a running automation shows the recent events only. The report panel of an automation’s task counts only the events that are still kept.

An automation captures a snapshot of the trigger and action templates as they were when you created it. If you later edit either template, the automation keeps running against the version it captured. Cosmetic edits (like moving a node on the canvas) are ignored; only structural changes count.

When a template the automation was built from has meaningfully changed — or was disabled, deleted, had its role changed, or developed errors — the automation is flagged Outdated (a badge on its row, and a banner in the wizard). To adopt the current templates, open it and choose Replace & Start: this re-snapshots the live templates, stops the stale run, and starts a fresh one. Type every secret input again before you confirm.

One mail automation per user, from your own application

Section titled “One mail automation per user, from your own application”

This puts the pieces above together for a common case: your application gives each of its users a mail automation. Every mail that arrives in the user’s mailbox is sent to your application’s API.

  • Trigger: a continuous template with the Email service’s receiver and one exit node. Put the mailbox host, username and password in the entry input, and mark the password as secret. To continue after a restart where it stopped, keep the last mail’s uid under the automation binding of the store and read it back in a computed startAfterUid field — see Starting again where it stopped.
  • Action: a template whose logic node calls your API with fetch for each mail. Keep your API key in a secret variable, not in the script.

Create the automation when a user signs up

Section titled “Create the automation when a user signs up”

Your application calls the automation API with an access token:

  1. Mint a new random uuid for the user’s automation and save it with the user first.
  2. Create the automation with that id, the two templates, and the user’s mailbox credentials as input. If the answer is “exists”, an earlier attempt created it: continue.
  3. Start it.

A create that runs twice — a retry, a cleanup job, two instances of your application — cannot make a second automation, because both name the same id. See Creating safely more than once.

Read the automation and act on its status:

Status What to do
Running Nothing. A running receiver either receives mail or reports in its node log why it cannot, and it retries by itself while the mail server is unreachable.
Idle or Stopped Start it.
Failed Show failureReason to the user. A wrong password or a missing mailbox fails the automation, and it stays failed. Start it again only after the cause is fixed.
Not found It was deleted. Create a new one with a new id, and save that id.

When outdatedReason is set, a template changed since the automation was created. When the user’s credentials change, the automation must change too. In both cases, delete the automation and create a new one with a new id.

Delete the automation. This stops its task and its mailbox connection, and deletes the position it kept in the store. Then remove the id from your store: it can never be used again.

Delivery is at least once. After a restart, a mail can reach your API a second time. Make your API ignore a mail it already handled, for example by its message id.