Skip to content

Insight ​

Insights: run, copy, and read insight data.

Endpoints ​

EndpointArgumentsReturns
v3.insight.copyinsightId: string, options: { name: string }unknown
v3.insight.createWorkspaceId, optionsobject
v3.insight.datainsightId: string, options?: { update?: boolean }object
v3.insight.listcid: stringobject[]
v3.insight.member.addinsightId: string, permissionItem: stringboolean
v3.insight.member.removeinsightId: string, permissionItem: stringboolean
v3.insight.previewworkspaceId: string, input: { query: string, sources: InsightSource[] }object
v3.insight.publicinsightKey: stringobject
v3.insight.queryworkspaceId: string, input: { query: string, sources: InsightSource[] }object
v3.insight.removeinsightId: stringunknown
v3.insight.updateinsightId: string, update: objectobject

v3.insight.copy ​

Description

Copy an insight with a new name

Parameters

Argument 1 (ObjectId, required): insightId

Argument 2 (object, required):

FieldTypeRequiredDescription
namestringnoVisible name

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.insight.copy', [
  '507f1f77bcf86cd799439011', // ObjectId (required)
  {
    name: 'string', // Visible name
  },
]);
console.log(result);

Returns

Undocumented

The return value is not described in the source yet.

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.insight.create ​

Description

Create a new insight with data sources and SQL query for analytics and reporting.

Parameters

Argument 1 (WorkspaceId, required): workspaceId (former networkId)

Argument 2 (object, optional):

FieldTypeRequiredDescription
namestringyesVisible name
publicbooleannoEnable Insight data to be fetched via v3.insight.public endpoint publicly Default: false.
sourcesobject[]yesTables in SQL See below.
querystringyesSQLite query string to work on the temporary tables built from sources

sources[] (object):

FieldTypeRequiredDescription
namestringyesTable name in SQL
workflowIdprocessIdyesWorkflow or Dataset Id to get activities from
fieldsobject[]yesColumns in SQL, set fieldId or meta as data mapping See below.
optionsobjectnoSee below.

sources[].fields[] (object):

FieldTypeRequiredDescription
namestringyesColumn name of table in SQL
fieldIdfieldIdnoColumn source fieldId, type will depend on field type Workflow or Dataset
phaseIdfieldIdnophaseId, used with meta: phaseLastMove
metastringnoColumn source meta-data One of: _id, uid, team, createdBy, name, created, updated, phaseId, phaseName, phaseLastMove, workflowId, workflowName, priority.

sources[].options (object):

FieldTypeRequiredDescription
phasesobject[]noUsed to translate phaseIds to human readable variable names See below.

sources[].options.phases[] (object):

FieldTypeRequiredDescription
namestringyesPhase Id map

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.insight.create', [
  '507f1f77bcf86cd799439011', // WorkspaceId (required)
  {
    name: 'string', // Visible name
    sources: [{
      name: 'string', // Table name in SQL
      workflowId: '507f1f77bcf86cd799439011', // Workflow or Dataset Id to get activities from
      fields: [{ /* ... */ }], // Columns in SQL, set `fieldId` or `meta` as data mapping
    }], // Tables in SQL
    query: 'string', // SQLite query string to work on the temporary tables built from sources
  },
]);
console.log(result);

Returns

FieldTypeRequiredDescription
_idObjectIdyesinsightId
hashbinaryno
createdtimestampyesTime (milliseconds since 1970-01-01 UTC)
updatedtimestampyesTime (milliseconds since 1970-01-01 UTC)
uiduserIdyesuserId
cidWorkspaceIdyesworkspaceId (former networkId)
membersobject[]yesSee below.
namestringyesVisible name
descriptionstringno
publicbooleanyesEnable Insight data to be fetched via v3.insight.public endpoint publicly
publicKeystringyesKey used to access an Insight when public is set to true
sourcesobject[]yesTables in SQL See below.
querystringyesSQLite query string to work on the temporary tables built from sources
presetsobject[]noSee below.
workflowSuiteobjectnoSee below.

members[] (object):

FieldTypeRequiredDescription
idstringyesnetwork_<networkId>, team_<teamId>, user_<userId>, group_<groupId>
infoobjectyesReseved
permissionsedit[]yes

sources[] (object):

FieldTypeRequiredDescription
namestringyesTable name in SQL
workflowIdprocessIdyesWorkflow or Dataset Id to get activities from
fieldsobject[]yesColumns in SQL, set fieldId or meta as data mapping See below.
optionsobjectnoSee below.

sources[].fields[] (object):

FieldTypeRequiredDescription
namestringyesColumn name of table in SQL
fieldIdfieldIdnoColumn source fieldId, type will depend on field type Workflow or Dataset
phaseIdfieldIdnophaseId, used with meta: phaseLastMove
metastringnoColumn source meta-data One of: _id, uid, team, createdBy, name, created, updated, phaseId, phaseName, phaseLastMove, workflowId, workflowName, priority.

sources[].options (object):

FieldTypeRequiredDescription
phasesobject[]noUsed to translate phaseIds to human readable variable names See below.

sources[].options.phases[] (object):

FieldTypeRequiredDescription
namestringyesPhase Id map

presets[] (object):

FieldTypeRequiredDescription
versionnumberno
namedefaultno
optionsobjectnoSee below.

presets[].options (object):

FieldTypeRequiredDescription
visibilityanyno
showanyno
filtersanyno
pivotanyno
tableanyno
drillDownanyno
chartobjectnoSee below.

presets[].options.chart (object):

FieldTypeRequiredDescription
typestringno

workflowSuite (object):

FieldTypeRequiredDescription
productIdObjectIdyesproductId
namestringyes
packageHashObjectIdyes
createdtimestampyesTime (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.insight.data ​

Description

Execute insight query and return data results for analytics visualization.

Parameters

Argument 1 (ObjectId, required): insightId

Argument 2 (Option, optional):

FieldTypeRequiredDescription
updatebooleannoIgnore cached data, and force to rebuild

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.insight.data', [
  '507f1f77bcf86cd799439011', // ObjectId (required)
  {
    update: false, // Ignore cached data, and force to rebuild
  },
]);
console.log(result);

Returns

FieldTypeRequiredDescription
headersstring[]yes
rowsstring[][]yesRows of data
timetimestampyesTimestamp when data was last updated

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.insight.list ​

Description

List all insights in a workspace that the user has access to

Parameters

Argument 1 (WorkspaceId, required): workspaceId (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.insight.list', [
  '507f1f77bcf86cd799439011', // WorkspaceId (required)
]);
console.log(result);

Returns

Array of objects:

FieldTypeRequiredDescription
_idObjectIdyesinsightId
createdtimestampyesTime (milliseconds since 1970-01-01 UTC)
updatedtimestampyesTime (milliseconds since 1970-01-01 UTC)
uiduserIdyesuserId
cidWorkspaceIdyesworkspaceId (former networkId)
membersobject[]yesSee below.
namestringyesVisible name
descriptionstringno
publicbooleanyesEnable Insight data to be fetched via v3.insight.public endpoint publicly
publicKeystringyesKey used to access an Insight when public is set to true
sourcesobject[]yesTables in SQL See below.
querystringyesSQLite query string to work on the temporary tables built from sources
presetsobject[]noSee below.
workflowSuiteobjectnoSee below.
hashanyno

members[] (object):

FieldTypeRequiredDescription
idstringyesnetwork_<networkId>, team_<teamId>, user_<userId>, group_<groupId>
infoobjectyesReseved
permissionsedit[]yes

sources[] (object):

FieldTypeRequiredDescription
namestringyesTable name in SQL
workflowIdprocessIdyesWorkflow or Dataset Id to get activities from
fieldsobject[]yesColumns in SQL, set fieldId or meta as data mapping See below.
optionsobjectnoSee below.

sources[].fields[] (object):

FieldTypeRequiredDescription
namestringyesColumn name of table in SQL
fieldIdfieldIdnoColumn source fieldId, type will depend on field type Workflow or Dataset
phaseIdfieldIdnophaseId, used with meta: phaseLastMove
metastringnoColumn source meta-data One of: _id, uid, team, createdBy, name, created, updated, phaseId, phaseName, phaseLastMove, workflowId, workflowName, priority.

sources[].options (object):

FieldTypeRequiredDescription
phasesobject[]noUsed to translate phaseIds to human readable variable names See below.

sources[].options.phases[] (object):

FieldTypeRequiredDescription
namestringyesPhase Id map

presets[] (object):

FieldTypeRequiredDescription
versionnumberno
namedefaultno
optionsobjectnoSee below.

presets[].options (object):

FieldTypeRequiredDescription
visibilityanyno
showanyno
filtersanyno
pivotanyno
tableanyno
drillDownanyno
chartobjectnoSee below.

presets[].options.chart (object):

FieldTypeRequiredDescription
typestringno

workflowSuite (object):

FieldTypeRequiredDescription
productIdObjectIdyesproductId
namestringyes
packageHashObjectIdyes
createdtimestampyesTime (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.insight.member.add ​

Description

Add member

Parameters

Argument 1 (ObjectId, required): insightId

Argument 2 (string, required): network_<networkId>, team_<teamId>, user_<userId>, group_<groupId>

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.insight.member.add', [
  '507f1f77bcf86cd799439011', // ObjectId (required)
  'string', // `network_<networkId>`, `team_<teamId>`, `user_<userId>`, `group_<groupId>` (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.insight.member.remove ​

Description

Remove member of process.

Parameters

Argument 1 (ObjectId, required): insightId

Argument 2 (string, required): network_<networkId>, team_<teamId>, user_<userId>, group_<groupId>

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.insight.member.remove', [
  '507f1f77bcf86cd799439011', // ObjectId (required)
  'string', // `network_<networkId>`, `team_<teamId>`, `user_<userId>`, `group_<groupId>` (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.insight.preview ​

Description

Preview insight query execution before saving - test data sources and SQL queries.

Parameters

Argument 1 (WorkspaceId, required): workspaceId (former networkId)

Argument 2 (object, optional):

FieldTypeRequiredDescription
querystringyesSQLite query string to work on the temporary tables built from sources
sourcesobject[]yesTables in SQL See below.

sources[] (object):

FieldTypeRequiredDescription
namestringyesTable name in SQL
workflowIdprocessIdyesWorkflow or Dataset Id to get activities from
fieldsobject[]yesColumns in SQL, set fieldId or meta as data mapping See below.
optionsobjectnoSee below.

sources[].fields[] (object):

FieldTypeRequiredDescription
namestringyesColumn name of table in SQL
fieldIdfieldIdnoColumn source fieldId, type will depend on field type Workflow or Dataset
phaseIdfieldIdnophaseId, used with meta: phaseLastMove
metastringnoColumn source meta-data One of: _id, uid, team, createdBy, name, created, updated, phaseId, phaseName, phaseLastMove, workflowId, workflowName, priority.

sources[].options (object):

FieldTypeRequiredDescription
phasesobject[]noUsed to translate phaseIds to human readable variable names See below.

sources[].options.phases[] (object):

FieldTypeRequiredDescription
namestringyesPhase Id map

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.insight.preview', [
  '507f1f77bcf86cd799439011', // WorkspaceId (required)
  {
    query: 'string', // SQLite query string to work on the temporary tables built from sources
    sources: [{
      name: 'string', // Table name in SQL
      workflowId: '507f1f77bcf86cd799439011', // Workflow or Dataset Id to get activities from
      fields: [{ /* ... */ }], // Columns in SQL, set `fieldId` or `meta` as data mapping
    }], // Tables in SQL
  },
]);
console.log(result);

Returns

FieldTypeRequiredDescription
headersstring[]yes
rowsstring[][]yesRows of data
detailsRecord<string, object>noSee below.

details.* (object):

FieldTypeRequiredDescription
headersstring[]noColumn names
rowsnumberyes

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.insight.public ​

Description

Get public insight data by insight key

Parameters

Argument 1 (InsightPublicKey, string, required): Key used to access an Insight when public is set to true

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.insight.public', [
  'string', // InsightPublicKey (required)
]);
console.log(result);

Returns

FieldTypeRequiredDescription
insightobjectnoSee below.
dataobjectnoSee below.

insight (object):

FieldTypeRequiredDescription
namestringno
presetsobject[]noSee below.

insight.presets[] (object):

FieldTypeRequiredDescription
versionnumberno
namedefaultno
optionsobjectnoSee below.

insight.presets[].options (object):

FieldTypeRequiredDescription
visibilityanyno
showanyno
filtersanyno
pivotanyno
tableanyno
drillDownanyno
chartobjectno

data (object):

FieldTypeRequiredDescription
headersstring[]yes
rowsstring[][]yesRows of data
timetimestampyesTimestamp when data was last updated

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.insight.query ​

Description

Execute a full insight query without saving. Returns all rows with no row-count cap. Not metered.

Parameters

Argument 1 (WorkspaceId, required): workspaceId (former networkId)

Argument 2 (object, required):

FieldTypeRequiredDescription
querystringyesSQLite query string to work on the temporary tables built from sources
sourcesobject[]yesTables in SQL See below.

sources[] (object):

FieldTypeRequiredDescription
namestringyesTable name in SQL
workflowIdprocessIdyesWorkflow or Dataset Id to get activities from
fieldsobject[]yesColumns in SQL, set fieldId or meta as data mapping See below.
optionsobjectnoSee below.

sources[].fields[] (object):

FieldTypeRequiredDescription
namestringyesColumn name of table in SQL
fieldIdfieldIdnoColumn source fieldId, type will depend on field type Workflow or Dataset
phaseIdfieldIdnophaseId, used with meta: phaseLastMove
metastringnoColumn source meta-data One of: _id, uid, team, createdBy, name, created, updated, phaseId, phaseName, phaseLastMove, workflowId, workflowName, priority.

sources[].options (object):

FieldTypeRequiredDescription
phasesobject[]noUsed to translate phaseIds to human readable variable names See below.

sources[].options.phases[] (object):

FieldTypeRequiredDescription
namestringyesPhase Id map

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.insight.query', [
  '507f1f77bcf86cd799439011', // WorkspaceId (required)
  {
    query: 'string', // SQLite query string to work on the temporary tables built from sources
    sources: [{
      name: 'string', // Table name in SQL
      workflowId: '507f1f77bcf86cd799439011', // Workflow or Dataset Id to get activities from
      fields: [{ /* ... */ }], // Columns in SQL, set `fieldId` or `meta` as data mapping
    }], // Tables in SQL
  },
]);
console.log(result);

Returns

FieldTypeRequiredDescription
headersstring[]yes
rowsstring[][]yesRows of data
detailsRecord<string, object>noSee below.

details.* (object):

FieldTypeRequiredDescription
headersstring[]noColumn names
rowsnumberyes

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.insight.remove ​

Description

Remove an insight

Parameters

Argument 1 (ObjectId, required): insightId

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.insight.remove', [
  '507f1f77bcf86cd799439011', // ObjectId (required)
]);
console.log(result);

Returns

Undocumented

The return value is not described in the source yet.

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.insight.update ​

Description

Update an existing insight

Parameters

Argument 1 (ObjectId, required): insightId

Argument 2 (object, required):

FieldTypeRequiredDescription
namestringnoVisible name
publicbooleannoEnable Insight data to be fetched via v3.insight.public endpoint publicly
sourcesobject[]noTables in SQL See below.
querystringnoSQLite query string to work on the temporary tables built from sources
presetsobject[]noSee below.

sources[] (object):

FieldTypeRequiredDescription
namestringyesTable name in SQL
workflowIdprocessIdyesWorkflow or Dataset Id to get activities from
fieldsobject[]yesColumns in SQL, set fieldId or meta as data mapping See below.
optionsobjectnoSee below.

sources[].fields[] (object):

FieldTypeRequiredDescription
namestringyesColumn name of table in SQL
fieldIdfieldIdnoColumn source fieldId, type will depend on field type Workflow or Dataset
phaseIdfieldIdnophaseId, used with meta: phaseLastMove
metastringnoColumn source meta-data One of: _id, uid, team, createdBy, name, created, updated, phaseId, phaseName, phaseLastMove, workflowId, workflowName, priority.

sources[].options (object):

FieldTypeRequiredDescription
phasesobject[]noUsed to translate phaseIds to human readable variable names See below.

sources[].options.phases[] (object):

FieldTypeRequiredDescription
namestringyesPhase Id map

presets[] (object):

FieldTypeRequiredDescription
versionnumberno
namedefaultno
optionsobjectnoSee below.

presets[].options (object):

FieldTypeRequiredDescription
visibilityanyno
showanyno
filtersanyno
pivotanyno
tableanyno
drillDownanyno
chartobjectnoSee below.

presets[].options.chart (object):

FieldTypeRequiredDescription
typestringno

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.insight.update', [
  '507f1f77bcf86cd799439011', // ObjectId (required)
  {
    name: 'string', // Visible name
    public: false, // Enable Insight data to be fetched via `v3.insight.public` endpoint publicly
  },
]);
console.log(result);

Returns

FieldTypeRequiredDescription
_idObjectIdyesinsightId
hashbinaryno
createdtimestampyesTime (milliseconds since 1970-01-01 UTC)
updatedtimestampyesTime (milliseconds since 1970-01-01 UTC)
uiduserIdyesuserId
cidWorkspaceIdyesworkspaceId (former networkId)
membersobject[]yesSee below.
namestringyesVisible name
descriptionstringno
publicbooleanyesEnable Insight data to be fetched via v3.insight.public endpoint publicly
publicKeystringyesKey used to access an Insight when public is set to true
sourcesobject[]yesTables in SQL See below.
querystringyesSQLite query string to work on the temporary tables built from sources
presetsobject[]noSee below.
workflowSuiteobjectnoSee below.

members[] (object):

FieldTypeRequiredDescription
idstringyesnetwork_<networkId>, team_<teamId>, user_<userId>, group_<groupId>
infoobjectyesReseved
permissionsedit[]yes

sources[] (object):

FieldTypeRequiredDescription
namestringyesTable name in SQL
workflowIdprocessIdyesWorkflow or Dataset Id to get activities from
fieldsobject[]yesColumns in SQL, set fieldId or meta as data mapping See below.
optionsobjectnoSee below.

sources[].fields[] (object):

FieldTypeRequiredDescription
namestringyesColumn name of table in SQL
fieldIdfieldIdnoColumn source fieldId, type will depend on field type Workflow or Dataset
phaseIdfieldIdnophaseId, used with meta: phaseLastMove
metastringnoColumn source meta-data One of: _id, uid, team, createdBy, name, created, updated, phaseId, phaseName, phaseLastMove, workflowId, workflowName, priority.

sources[].options (object):

FieldTypeRequiredDescription
phasesobject[]noUsed to translate phaseIds to human readable variable names See below.

sources[].options.phases[] (object):

FieldTypeRequiredDescription
namestringyesPhase Id map

presets[] (object):

FieldTypeRequiredDescription
versionnumberno
namedefaultno
optionsobjectnoSee below.

presets[].options (object):

FieldTypeRequiredDescription
visibilityanyno
showanyno
filtersanyno
pivotanyno
tableanyno
drillDownanyno
chartobjectnoSee below.

presets[].options.chart (object):

FieldTypeRequiredDescription
typestringno

workflowSuite (object):

FieldTypeRequiredDescription
productIdObjectIdyesproductId
namestringyes
packageHashObjectIdyes
createdtimestampyesTime (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.

Hailer Developer Documentation · v1.8.0