Skip to content

Actions ​

Workspace actions: user-authored code executed in a sandbox, with vault credentials injected as env vars.

An action belongs to a workspace and carries the code (must export an execute(input) function), its dependencies as a verbatim package.json, an egress allowlist, and bound vault credentials - each credential payload key becomes one env var in the sandbox (process.env[name]; later credentials win name collisions). Runs are recorded durably and queryable via v3.action.runs. v3.action.trigger waits up to 25 s: longer runs return the still-running record and finish in the background.

Endpoints ​

EndpointArgumentsReturns
v3.action.cancelRunrunId: stringobject
v3.action.createaction: { name, workspaceId, code, packageJson?, allowNet?, credentialIds?, limits?, maxRunsPerHour?, runners?, triggers?, schedule?, description?, key?, public?, enabled? }object
v3.action.getactionId: stringobject
v3.action.getRunrunId: stringobject
v3.action.listoptions: { workspaceId }object[]
v3.action.removeactionId: stringboolean
v3.action.runoptions: { workspaceId, config: { name?, code, packageJson?, allowNet?, credentialIds?, limits? }, actionId?, input?, activityId?, member?: { userId, event: 'joined' | 'left' } }object
v3.action.runsoptions: { workspaceId, actionId?, status?, createdFrom?, createdTo?, limit?, skip? }object[]
v3.action.triggeroptions: { actionId?, workspaceId?, key?, publicKey? }, input?: anyobject
v3.action.triggers-object[]
v3.action.updateactionId: string, changes: { name?, description?, key?, public?, rotatePublicKey?, enabled?, code?, packageJson?, allowNet?, credentialIds?, limits?, maxRunsPerHour?, runners?, triggers?, schedule? }boolean

v3.action.cancelRun ​

Description

Cancel a run the executor still holds queued (status queued with an execRunId - phase-triggered runs waiting for a sandbox slot). Returns the cancelled record. Fails with the executor's message when the run has already left queued there or the executor no longer has its record; the record here is left untouched - the executor's callbacks own its state. Workspace admins and owners only.

Parameters

Argument 1 (ObjectId, required):

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.action.cancelRun', [
  '507f1f77bcf86cd799439011', // ObjectId (required)
]);
console.log(result);

Returns

FieldTypeRequiredDescription
_idObjectIdyes
actionIdObjectIdno
workspaceIdWorkspaceIdyesworkspaceId (former networkId)
eventmanual | phase.activity-created | phase.activity-updated | phase.activity-moved | workspace.member-joined | workspace.member-left | schedule.runyes
testbooleanno
triggeredByObjectIdno
configobjectnoSee below.
argumentsstringno
statusqueued | running | completed | runtime_error | timeout | output_limit | infra_error | cancelled | config_error | deniedyes
execRunIdstringno
exitCodenumberno
stdoutstringno
stderrstringno
outputanyno
messagestringno
wallTimeMsnumberno
creatednumberyes
finishedAtnumberno

config (object):

FieldTypeRequiredDescription
namestringno
codestringyes
packageJsonstringno
allowNetstring[]no
credentialIdscredentialId[]no
limitsobjectnoSee below.

config.limits (object):

FieldTypeRequiredDescription
wallTimeMsintegerno

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, retryAfter?, debug? }. retryAfter is a delay in milliseconds.

v3.action.create ​

Description

Create a workspace action: sandboxed code run by the executor. Workspace admins only. Bound credentials are injected as env vars (each payload key becomes one env var; later credentials win name collisions). maxRunsPerHour bounds runs per sliding hour - test runs are exempt; default 1000. triggers are event keys from v3.action.triggers: phase.* keys carry the workflowId and phaseId of this workspace (phase.activity-created:<workflowId>:<phaseId>), workspace.* keys are the bare event. schedule arms a cron run: a 5-field cron expression and an optional IANA tz (UTC when absent); the stored schedule carries the api-computed nextRunAt.

Parameters

Argument 1 (object, required):

FieldTypeRequiredDescription
namestringyes
workspaceIdWorkspaceIdyesworkspaceId (former networkId)
codestringyes
packageJsonstringno
allowNetstring[]no
credentialIdscredentialId[]no
limitsobjectnoSee below.
maxRunsPerHourintegerno
runnersstring[]no
triggersstring[]no
scheduleobjectnoSee below.
descriptionstringno
keystringno
publicbooleanno
enabledbooleanno

limits (object):

FieldTypeRequiredDescription
wallTimeMsintegerno

schedule (object):

FieldTypeRequiredDescription
cronstringyes
tzstringnoOne of 597 values, e.g. Africa/Abidjan, Africa/Accra, Africa/Addis_Ababa, Africa/Algiers, Africa/Asmara.

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.action.create', [
  {
    name: 'string',
    workspaceId: '507f1f77bcf86cd799439011', // workspaceId (former networkId)
    code: 'string',
  },
]);
console.log(result);

Returns

FieldTypeRequiredDescription
_idObjectIdyes

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, retryAfter?, debug? }. retryAfter is a delay in milliseconds.

v3.action.get ​

Description

Get one action - same shape as a v3.action.list item. Use it to fetch the latest state of a single action (e.g. before editing). Workspace admins and owners only.

Parameters

Argument 1 (ObjectId, required):

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.action.get', [
  '507f1f77bcf86cd799439011', // ObjectId (required)
]);
console.log(result);

Returns

FieldTypeRequiredDescription
_idObjectIdyes
namestringyes
workspaceIdWorkspaceIdyesworkspaceId (former networkId)
descriptionstringno
keystringno
publicbooleanno
publicKeystringno
enabledbooleanyes
codestringyes
packageJsonstringno
allowNetstring[]no
credentialIdscredentialId[]yes
limitsobjectnoSee below.
maxRunsPerHourintegerno
runnersstring[]no
triggersstring[]yes
scheduleobjectnoSee below.
createdByObjectIdyes
creatednumberyes
updatednumberyes

limits (object):

FieldTypeRequiredDescription
wallTimeMsintegerno

schedule (object):

FieldTypeRequiredDescription
cronstringyes
tzstringnoOne of 597 values, e.g. Africa/Abidjan, Africa/Accra, Africa/Addis_Ababa, Africa/Algiers, Africa/Asmara.
nextRunAttimestampnoTime (milliseconds since 1970-01-01 UTC)

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, retryAfter?, debug? }. retryAfter is a delay in milliseconds.

v3.action.getRun ​

Description

Get one run record - same shape as a v3.action.runs item. The action.run.updated signal carries only ids and status; fetch the changed row with this instead of relisting. Workspace admins and owners see the full record; the user who triggered the run sees the outcome only (status, output, message).

Parameters

Argument 1 (ObjectId, required):

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.action.getRun', [
  '507f1f77bcf86cd799439011', // ObjectId (required)
]);
console.log(result);

Returns

FieldTypeRequiredDescription
_idObjectIdyes
actionIdObjectIdno
workspaceIdWorkspaceIdyesworkspaceId (former networkId)
eventmanual | phase.activity-created | phase.activity-updated | phase.activity-moved | workspace.member-joined | workspace.member-left | schedule.runyes
testbooleanno
triggeredByObjectIdno
configobjectnoSee below.
argumentsstringno
statusqueued | running | completed | runtime_error | timeout | output_limit | infra_error | cancelled | config_error | deniedyes
execRunIdstringno
exitCodenumberno
stdoutstringno
stderrstringno
outputanyno
messagestringno
wallTimeMsnumberno
creatednumberyes
finishedAtnumberno

config (object):

FieldTypeRequiredDescription
namestringno
codestringyes
packageJsonstringno
allowNetstring[]no
credentialIdscredentialId[]no
limitsobjectnoSee below.

config.limits (object):

FieldTypeRequiredDescription
wallTimeMsintegerno

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, retryAfter?, debug? }. retryAfter is a delay in milliseconds.

v3.action.list ​

Description

List a workspace's actions as full documents, code included - one fetch gets everything. Workspace admins and owners only.

Parameters

Argument 1 (object, required):

FieldTypeRequiredDescription
workspaceIdWorkspaceIdyesworkspaceId (former networkId)

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.action.list', [
  {
    workspaceId: '507f1f77bcf86cd799439011', // workspaceId (former networkId)
  },
]);
console.log(result);

Returns

Array of objects:

FieldTypeRequiredDescription
_idObjectIdyes
namestringyes
workspaceIdWorkspaceIdyesworkspaceId (former networkId)
descriptionstringno
keystringno
publicbooleanno
publicKeystringno
enabledbooleanyes
codestringyes
packageJsonstringno
allowNetstring[]no
credentialIdscredentialId[]yes
limitsobjectnoSee below.
maxRunsPerHourintegerno
runnersstring[]no
triggersstring[]yes
scheduleobjectnoSee below.
createdByObjectIdyes
creatednumberyes
updatednumberyes

limits (object):

FieldTypeRequiredDescription
wallTimeMsintegerno

schedule (object):

FieldTypeRequiredDescription
cronstringyes
tzstringnoOne of 597 values, e.g. Africa/Abidjan, Africa/Accra, Africa/Addis_Ababa, Africa/Algiers, Africa/Asmara.
nextRunAttimestampnoTime (milliseconds since 1970-01-01 UTC)

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, retryAfter?, debug? }. retryAfter is a delay in milliseconds.

v3.action.remove ​

Description

Remove an action. Its run records are kept as the workspace's run history. Workspace admins and owners only.

Parameters

Argument 1 (ObjectId, required):

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.action.remove', [
  '507f1f77bcf86cd799439011', // ObjectId (required)
]);
console.log(result);

Returns

boolean

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, retryAfter?, debug? }. retryAfter is a delay in milliseconds.

v3.action.run ​

Description

Run an action config inline, without saving an action - the editor's test button, usable on unsaved drafts and unsaved edits alike. Same sandbox, credential rules and billing as a saved action. The run is recorded with test: true and a snapshot of the executed config; pass actionId when testing an edit of an existing action to link the record to it. Input, one of: free-form input, delivered as the payload of a manual event; activityId to receive that activity exactly as a phase trigger delivers it on creation (event 'phase.activity-created'); member to receive a workspace member exactly as a membership trigger delivers them (event 'workspace.member-joined' or 'workspace.member-left', the caller standing in as inviter / remover). Waits up to 25 s like v3.action.trigger. Workspace admins and owners only.

Parameters

Argument 1 (object, required):

FieldTypeRequiredDescription
workspaceIdWorkspaceIdyesworkspaceId (former networkId)
configobjectyesSee below.
actionIdObjectIdno
inputanyno
activityIdObjectIdno
memberobjectnoSee below.

config (object):

FieldTypeRequiredDescription
namestringno
codestringyes
packageJsonstringno
allowNetstring[]no
credentialIdscredentialId[]no
limitsobjectnoSee below.

config.limits (object):

FieldTypeRequiredDescription
wallTimeMsintegerno

member (object):

FieldTypeRequiredDescription
userIdObjectIdyes
eventjoined | leftyes

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.action.run', [
  {
    workspaceId: '507f1f77bcf86cd799439011', // workspaceId (former networkId)
    config: {
      code: 'string',
    },
  },
]);
console.log(result);

Returns

FieldTypeRequiredDescription
_idObjectIdyes
actionIdObjectIdno
workspaceIdWorkspaceIdyesworkspaceId (former networkId)
eventmanual | phase.activity-created | phase.activity-updated | phase.activity-moved | workspace.member-joined | workspace.member-left | schedule.runyes
testbooleanno
triggeredByObjectIdno
configobjectnoSee below.
argumentsstringno
statusqueued | running | completed | runtime_error | timeout | output_limit | infra_error | cancelled | config_error | deniedyes
execRunIdstringno
exitCodenumberno
stdoutstringno
stderrstringno
outputanyno
messagestringno
wallTimeMsnumberno
creatednumberyes
finishedAtnumberno

config (object):

FieldTypeRequiredDescription
namestringno
codestringyes
packageJsonstringno
allowNetstring[]no
credentialIdscredentialId[]no
limitsobjectnoSee below.

config.limits (object):

FieldTypeRequiredDescription
wallTimeMsintegerno

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, retryAfter?, debug? }. retryAfter is a delay in milliseconds.

v3.action.runs ​

Description

List a workspace's action run records, newest first - optionally filtered to one action, a set of statuses, and/or a created-time range (createdFrom/createdTo, epoch ms, inclusive). Also the polling endpoint for runs that outlived v3.action.trigger's 25 s window. Rows omit arguments; v3.action.getRun returns it. Workspace admins and owners only.

Parameters

Argument 1 (object, required):

FieldTypeRequiredDescription
workspaceIdWorkspaceIdyesworkspaceId (former networkId)
actionIdObjectIdno
status(queued | running | completed | runtime_error | timeout | output_limit | infra_error | cancelled | config_error | denied)[]no
createdFromintegerno
createdTointegerno
limitintegerno
skipintegerno

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.action.runs', [
  {
    workspaceId: '507f1f77bcf86cd799439011', // workspaceId (former networkId)
  },
]);
console.log(result);

Returns

Array of objects:

FieldTypeRequiredDescription
_idObjectIdyes
actionIdObjectIdno
workspaceIdWorkspaceIdyesworkspaceId (former networkId)
eventmanual | phase.activity-created | phase.activity-updated | phase.activity-moved | workspace.member-joined | workspace.member-left | schedule.runyes
testbooleanno
triggeredByObjectIdno
configobjectnoSee below.
argumentsstringno
statusqueued | running | completed | runtime_error | timeout | output_limit | infra_error | cancelled | config_error | deniedyes
execRunIdstringno
exitCodenumberno
stdoutstringno
stderrstringno
outputanyno
messagestringno
wallTimeMsnumberno
creatednumberyes
finishedAtnumberno

config (object):

FieldTypeRequiredDescription
namestringno
codestringyes
packageJsonstringno
allowNetstring[]no
credentialIdscredentialId[]no
limitsobjectnoSee below.

config.limits (object):

FieldTypeRequiredDescription
wallTimeMsintegerno

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, retryAfter?, debug? }. retryAfter is a delay in milliseconds.

v3.action.trigger ​

Description

Trigger a saved action now. Waits up to 25 s for the result; longer runs return the still-running record and finish in the background (poll v3.action.getRun). The action is addressed one way: actionId or { workspaceId, key } for a logged-in caller - workspace admins and owners, plus anyone matched by the action's runners - or publicKey for anyone, no login needed, when the action is public. Admins get the full run record; everyone else the outcome only (status, output, message), not config, stdout or stderr. input is delivered as the payload of a manual event: execute({ event: 'manual', payload: input, workspaceId, triggeredBy }); triggeredBy is absent on a public trigger and the run is billed to the action's author.

Parameters

Argument 1 (object, required):

FieldTypeRequiredDescription
actionIdObjectIdno
workspaceIdWorkspaceIdnoworkspaceId (former networkId)
keystringno
publicKeystringno

Argument 2 (any, optional):

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.action.trigger', [
  {
    actionId: '507f1f77bcf86cd799439011',
    workspaceId: '507f1f77bcf86cd799439011', // workspaceId (former networkId)
  },
  '...', // argument 2
]);
console.log(result);

Returns

FieldTypeRequiredDescription
_idObjectIdyes
actionIdObjectIdno
workspaceIdWorkspaceIdyesworkspaceId (former networkId)
eventmanual | phase.activity-created | phase.activity-updated | phase.activity-moved | workspace.member-joined | workspace.member-left | schedule.runyes
testbooleanno
triggeredByObjectIdno
configobjectnoSee below.
argumentsstringno
statusqueued | running | completed | runtime_error | timeout | output_limit | infra_error | cancelled | config_error | deniedyes
execRunIdstringno
exitCodenumberno
stdoutstringno
stderrstringno
outputanyno
messagestringno
wallTimeMsnumberno
creatednumberyes
finishedAtnumberno

config (object):

FieldTypeRequiredDescription
namestringno
codestringyes
packageJsonstringno
allowNetstring[]no
credentialIdscredentialId[]no
limitsobjectnoSee below.

config.limits (object):

FieldTypeRequiredDescription
wallTimeMsintegerno

Auth: callable without authentication.

Errors: on failure returns the standard Hailer error object { code, msg, details?, retryAfter?, debug? }. retryAfter is a delay in milliseconds.

v3.action.triggers ​

Description

List the trigger events an action can bind to. Each definition names the event and the key parameters in order: the key is the event followed by the parameter values, joined with ":" (phase.activity-created:<workflowId>:<phaseId>; workspace.member-joined has no parameters).

Parameters

Undocumented

This endpoint declares no argument schema in the source yet.

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.action.triggers', []);
console.log(result);

Returns

Array of objects:

FieldTypeRequiredDescription
eventstringyes
paramsstring[]yes

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, retryAfter?, debug? }. retryAfter is a delay in milliseconds.

v3.action.update ​

Description

Update an action. Workspace admins and owners only. Partial: only provided fields change; null clears description, key, packageJson, allowNet, limits, maxRunsPerHour, runners, triggers or schedule. triggers replaces the whole list; schedule replaces the schedule and restarts it from now. Changed credentials are re-validated against the workspace. enabled: false is the kill switch - a disabled action refuses to run on any trigger. rotatePublicKey: true replaces publicKey with a new random one, invalidating the old; public: true on an action without one generates it.

Parameters

Argument 1 (ObjectId, required):

Argument 2 (object, required):

FieldTypeRequiredDescription
namestringno
descriptionstringno
keystringno
publicbooleanno
rotatePublicKeybooleanno
enabledbooleanno
codestringno
packageJsonstringno
allowNetstring[]no
credentialIdscredentialId[]no
limitsobjectnoSee below.
maxRunsPerHourintegerno
runnersstring[]no
triggersstring[]no
scheduleobjectnoSee below.

limits (object):

FieldTypeRequiredDescription
wallTimeMsintegerno

schedule (object):

FieldTypeRequiredDescription
cronstringyes
tzstringnoOne of 597 values, e.g. Africa/Abidjan, Africa/Accra, Africa/Addis_Ababa, Africa/Algiers, Africa/Asmara.

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.action.update', [
  '507f1f77bcf86cd799439011', // ObjectId (required)
  {
    name: 'string',
    description: 'string',
  },
]);
console.log(result);

Returns

boolean

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, retryAfter?, debug? }. retryAfter is a delay in milliseconds.

Hailer Developer Documentation · v1.8.0