API Documentation - hellosign/helloworks-nodejs-sdk GitHub Wiki
new HelloWorks(config)
Create a new HelloWorks SDK client instance in order to make HelloWorks API requests from your Node.js app. In most cases, only one instance should exist per application.
-
config
Object-
apiKeyId
stringThe HelloWorks API key ID.
-
apiKeySecret
stringThe HelloWorks API key secret.
-
-
Instantiate a new HelloWorks SDK client.
const client = new HelloWorks({ apiKeyId: 'AbCd1234AbCd1234', apiKeySecret: 'WxYz7890WxYz7890WxYz7890WxYz7890WxYz7890' });
client.token.getToken(options)
Gets a new JWT token.
Note: If you are using this SDK, the JWT token needed to make authorized API calls is generated behind the scenes. Only use this method if you specifically need to generate a new one. This will not update the JWT token used internally.
-
options
Object-
apiKeyId
stringYour HelloWorks API key ID.
-
apiKeySecret
stringYour HelloWorks API key secret.
-
{
token: String,
expires_at: Number
}
-
Gets a new JWT token. More information about this endpoint can be found in the HelloWorks API Documentation.
client.token.getToken({ apiKeyId: 'AbCd1234AbCd1234', apiKeySecret: 'WxYz7890WxYz7890WxYz7890WxYz7890WxYz7890' }).then(({ token, expires_at }) => { // ... });
client.workflowInstances.createInstance(options)
Creates a new workflow instance from the workflow with the given ID and the given set of options. More information about this endpoint can be found in the HelloWorks API Documentation.
-
options
Object-
workflowId
stringThe ID of the Workflow that you want to create an instance of.
-
participants
Array.<Participant>The participants parameters and its options for each of the roles. The initial role that's available is named
signer
. -
mergeFields
Object (optional)The merge fields for the Workflow Instance. This should be a nested object with Step IDs, field names, and values. See below for details.
-
callbackUrl
string (optional)HTTPS URL for receiving a callback
POST
upon completion of the workflow instance. -
redirectUrl
string (optional)URL to redirect the user to upon completion of a signer step.
-
documentDelivery
boolean (optional)Flag that this will mute notifications and allow teams to fetch an authenticated url.
Defaults to
false
.
-
{
id: String,
mode: String,
steps: Step[]
}
See Type: Step.
-
Create a new workflow instance.
client.workflowInstances.createInstance({ workflowId: 'AbCd1234AbCd1234', participants: { signer: { type: 'email', value: '[email protected]', fullName: 'Lauren Ipsum' } } }).then((instance) => { // ... });
-
Create a new workflow instance with additional options.
client.workflowInstances.createInstance({ workflowId: 'AbCd1234AbCd1234', participants: { signer: { type: 'email', value: '[email protected]', fullName: 'Lauren Ipsum', }, }, mergeFields: { signerName_28XkWu: 'Lauren Ipsum', }, callbackUrl: 'https://example.com/callback', redirectUrl: 'https://example.com/success', documentDelivery: true }).then((instance) => { // ... });
client.workflowInstances.getInstance(options)
Gets the information for a given workflow instance. More information about this endpoint can be found in the HelloWorks API Documentation.
-
options
Object-
instanceId
stringThe workflow instance ID.
-
-
Completed workflow
{ id: String, workflow_id: String, status: String, type: 'workflow_stopped', mode: String, audit_trail_hash: String, document_hashes: { [Document ID]: String, // ... }, data: { [Document ID]: { [Field]: String, // ... }, // ... } }
-
Pending workflow
{ id: String, workflow_id: String, status: String }
-
Cancelled workflow
{ id: String, workflow_id: String, status: String, mode: String, data: { [Document ID]: { [Field]: String, // ... }, // ... } }
-
Get the information on a workflow instance.
client.workflowInstances.getInstance({ instanceId: 'AbCd1234AbCd1234' }).then((instance) => { // ... });
client.workflowInstances.getInstanceSteps(options)
Gets the instances steps for a given workflow instance. More information about this endpoint can be found in the HelloWorks API Documentation.
-
options
Object-
instanceId
stringThe workflow instance ID.
-
Step[]
See Type: Step.
-
Get the instance steps for a workflow instance.
client.workflowInstances.getInstanceSteps({ instanceId: 'AbCd1234AbCd1234' }).then((stepsArr) => { // ... });
client.workflowInstances.getInstanceAuditTrail(options)
Gets the audit trail for a given workflow instance as a buffer for easy downloading. More information about this endpoint can be found in the HelloWorks API Documentation.
-
options
Object-
instanceId
stringThe workflow instance ID.
-
Buffer
-
Download the workflow instance audit trail to
file.pdf
.const fs = require('fs'); client.workflowInstances.getInstanceAuditTrail({ instanceId: 'AbCd1234AbCd1234' }).then((buffer) => { fs.writeFile('file.pdf', buffer, (err) => { // ... }); });
client.workflowInstances.getInstanceDocument(options)
Gets a document for a given workflow instance as a buffer for easy downloading. More information about this endpoint can be found in the HelloWorks API Documentation.
-
options
Object-
instanceId
stringThe workflow instance ID.
-
documentId
stringThe workflow instance document ID.
-
Buffer
-
Download the workflow instance document to
file.pdf
.const fs = require('fs'); client.workflowInstances.getInstanceDocument({ instanceId: 'AbCd1234AbCd1234', documentId: 'WxYz' }).then((buffer) => { fs.writeFile('file.pdf', buffer, (err) => { // ... }); });
client.workflowInstances.cancelInstance(options)
Cancels a given workflow instance. More information about this endpoint can be found in the HelloWorks API Documentation.
-
options
Object-
instanceId
stringThe workflow instance ID.
-
-
Cancel a workflow instance.
client.workflowInstances.cancelInstance({ instanceId: 'AbCd1234AbCd1234' }).then(() => { // ... });
-
type
stringThe type of notification to send.
email
orphone
. -
value
stringThe value corresponding to the
type
. If thetype
isemail
, thevalue
should be the email of the recipient, or the phone number if thetype
isphone
. -
fullName
stringThe full name of the associated
type
andvalue
.
-
step
stringThe unique step ID.
-
role
stringThe name of the role that will be completing the task.
-
participant
stringThe signer's full name.
-
url
stringThe unauthenticated url that can be used to start entering information.