Skip to content

Triggers

Terminal window
npm install @reminix/sdk
import { createClient } from "@reminix/sdk";
const reminix = createClient(); // reads REMINIX_API_KEY

GET /v1/scripts/{slug}/triggers

The events that start it.

await reminix.triggers.list("alert-on-failure");
FieldDescription
slugstring, path, required

POST /v1/scripts/{slug}/triggers

Starts a run, as you, when an event of eventType happens in the workspace (GET /v1/workspace/event-types lists them) and its data matches filter — within about a minute.

await reminix.triggers.create("alert-on-failure", {
name: "Nightly sync failed",
eventType: "run.failed",
});
FieldDescription
slugstring, path, required
namestring, requiredA name for the trigger, shown in the app.
eventTypestring, requiredThe event that starts a run: any webhook event type, such as run.failed.
filterobjectEvent data fields (dotted paths) that must equal these values.
inputsobjectThe script's inputs for each run, by name; a value "{{event.data.<path>}}" takes it from the event.
environmentstringThe environment its runs use. Default: the request's (X-Environment), else the workspace's default.
More about this endpoint

A chain of triggered runs stops after 3.

PATCH /v1/scripts/{slug}/triggers/{triggerId}

Its name, filter, inputs, or switch it on or off.

await reminix.triggers.update("alert-on-failure", "<trigger-id>");
FieldDescription
slugstring, path, required
triggerIdstring, path, required
namestringA name for the trigger, shown in the app.
filterobjectEvent data fields (dotted paths) that must equal these values.
inputsobjectThe script's inputs for each run, by name; a value "{{event.data.<path>}}" takes it from the event.
enabledbooleanWhether it fires. Default: true.
environmentstringMove its runs to another environment.
More about this endpoint

Its creator, or an owner or admin.

DELETE /v1/scripts/{slug}/triggers/{triggerId}

Its creator, or an owner or admin.

await reminix.triggers.delete("alert-on-failure", "<trigger-id>");
FieldDescription
slugstring, path, required
triggerIdstring, path, required