nwc-sdk v1.1.14
nwc-sdk
Welcome to the unofficial Nintex Workflow Cloud SDK repoistory. This SDK can be used to programmatically interact with the Nintex Workflow Cloud platfrorm.
Disclaimer: This is an unofficial, community driven effort, not officially supported ny Nintex.
The sdk is created using typescript, with all available type and interface definitions included.
How to use the SDK
- For each NWC tenant you want to access via the SDK, you need to create an App
- Go to Settings > Apps and tokens
- Click the Add App button
- Name your app with something that relates to the nwc sdk usage - i.e. nwcdsk. You can choose whatever name you want. If required, provide a description as well.
- Add the sdk to your node.js project using npm: npm -i nwc-sdk
- For each tenant, create a json file in your project with the following contents - i.e. myTenantName.json:
{
"clientId": "{The client id of the app you created}",
"clientSecret": "{The client secret of the app you created}",
"region" : "{Your tenant's region | us, eu, au}",
"tenantName": "{The name of your tenant}"
}
- In your project, import the json file into a variable:
import * as tenantConnectionConfig from './myTenantName.json';
- Connect to your tenant:
import { NWCTenant } from 'nwc-sdk';
async function connect() {
const tenant = new NWCTenant();
await tenant.connect(tenantConnectionConfig);
return tenant;
}
- You can also create the connection configuration programmatically:
import { INWCConnectionInfo } from 'nwc-sdk';
const tenantConnectionConfig = {
"clientId": "{The client id of the app you created}",
"clientSecret": "{The client secret of the app you created}",
"region" : "{Your tenant's region | us, eu, au}",
"tenantName": "{The name of your tenant}"
} : INWCConnectionInfo
Supported SDK functions
The following functions are available on the NWCTenant class - the class representing a Nintex Workflow Cloud tenancy
connect
public async connect(connectionInfo :INWCTenantConnectionInfo, retrieveTenantData: boolean = true ) : Promise<void>
Connects to the tenant and retrieves the following details - based on the value of the retrieveTenantData parameter
- tenant information
- available connectors
- configured connections
- configured datasources
- workflows
retrieveTenantData
public async retrieveTenantData()
Retrieves the following tenant details of a connected tenant:
- available connectors
- configured connections
- configured datasources
- workflows
getWorkflow
public async getWorkflow(workflowId: string) : Promise<INWCWorkflowInfo> {
Retrieves the data of a workflow, based on the workflow id.
getWorkflowSource
public async getWorkflowSource(workflowId: string) : Promise<INWCWorkflowSource>
Retrieves the source definition of a workflow, based on the workflow id.
deleteWorkflowSource
public async deleteWorkflowSource(workflowId: string) : Promise<void>
Deletes the workflow with the corresponding workflowId
checkIfWorkflowExists
public async checkIfWorkflowExists(workflowName:string) : Promise<boolean>
Checks if a workflow with the provided name exists on a tenant
exportWorkflow
public async exportWorkflow(workflowId: string) : Promise<string>
Generates a non-expiring export key for the provided workflowId
importWorkflow
public async importWorkflow(workflowExportKey: string, workflowName: string)
Imports a workflow with a pre-generated export key using the provided workflow name
publishWorkflow
public async publishWorkflow(workflowId: string, payload:INWCWorkflowPublishPayload)
Publishes a draft workflow with the providedId
getConnectionsOfConnector
public getConnectionsOfConnector(connectorName: string, includeInvalid: boolean = false): INWCConnectionInfo[]
Retrieves all configured connections of a connector. The includeInvalid parameter can be used to include invalid connections - i.e. connections with expired credentials.