Namespace: hs/workflows

hs/workflows

A collection of methods related to the Workflows API

Methods

hs/workflows.createWorkflow (workflowBody)Promise asyncstatic

Create a new workflow

Name Type Description
workflowBody object

See developer docs for examples of workflow JSON

Returns:
Type Description
Promise
Example
const hs = new HubspotClient(props);
hs.workflows.createWorkflow(workflowBody).then(response => console.log(response));

hs/workflows.deleteWorkflow (id)Promise asyncstatic

Delete an existing workflow

Name Type Description
id int

The ID of the workflow you wish to delete

Returns:
Type Description
Promise
Example
const hs = new HubspotClient(props);
hs.workflows.deleteWorkflow(workflowBody).then(response => console.log(response));

hs/workflows.enrollContact (opts)Promise asyncstatic

Enroll a contact in a workflow

Name Type Description
opts object

Contact & workflow options

Properties:
Name Type Description
opts.workflowId int

The ID of the workflow you want to enroll the contact to.

opts.email int

The email address of the contact you wish to enroll.

Returns:
Type Description
Promise
Example
const hs = new HubspotClient(props);
hs.workflows.enrollContact(opts).then(response => console.log(response));

hs/workflows.getAll ()Promise asyncstatic

Get all workflows

Returns:
Type Description
Promise
Example
const hs = new HubspotClient(props);
hs.workflows.getAll().then(response => console.log(response));

hs/workflows.getEnrollments (id)Promise asyncstatic

Get workflow enrollments for the specified contact ID

Name Type Description
id int

Contact id to retrieve enrollments for

Returns:
Type Description
Promise
Example
const hs = new HubspotClient(props);
hs.workflows.getEnrollments(id).then(response => console.log(response));

hs/workflows.getWorkflow (workflowId)Promise asyncstatic

Get workflow by ID

Name Type Description
workflowId int
Returns:
Type Description
Promise
Example
const hs = new HubspotClient(props);
hs.workflows.getWorkflow(workflowId).then(response => console.log(response));

hs/workflows.getWorkflowEventLog (opts)Promise asyncstatic

Get a list of log events for a contact by workflow. For more information, checkout the developer docs.

Name Type Description
opts object

Filtering options

Properties:
Name Type Description
opts.vid int

The contact ID to filter on

opts.workflowId int

The ID of the workflow you want to get log events for

opts.types int

An array of event types

Returns:
Type Description
Promise
Example
const hs = new HubspotClient(props);
hs.workflows.getWorkflowEventLog({
        vid: 1283719823
        workflowId: 123239681612,
        types: ['ENROLLED']
      }).then(response => console.log(response));

hs/workflows.unenrollContact (opts)Promise asyncstatic

Unenroll a contact from a workflow

Name Type Description
opts object

Contact & workflow options

Properties:
Name Type Description
opts.workflowId int

The ID of the workflow you want to unenroll the contact from.

opts.email int

The email address of the contact you wish to unenroll.

Returns:
Type Description
Promise
Example
const hs = new HubspotClient(props);
hs.workflows.unenrollContact(opts).then(response => console.log(response));

hs/workflows.updateWorkflow (workflowBody)Promise asyncstatic

Update an existing workflow

Name Type Description
workflowBody object

See developer docs for examples of workflow JSON

Properties:
Name Type Description
opts.id int

The ID of the workflow you want to update.

opts.portalId int

The ID of the portal that the workflow resides on

Returns:
Type Description
Promise
Example
const hs = new HubspotClient(props);
hs.workflows.updateWorkflow(workflowBody).then(response => console.log(response));