Incoming Webhooks

Overview

WorkflowGen features an incoming webhook application that allows users to interact with WorkflowGen from external sources by exchanging JSON payloads using HTTP POST requests. The application supports multiple types of operations, such as creating a new request, completing an action, and some process deployment operations like creating a new process from an XPDL.

Technical requirements

In addition to the standard WorkflowGen installation, the following components are required:
For information on the installation procedure, see the WorkflowGen Technical Guide.

Configuration

Maximum query content length

The maximum query content length for incoming webhooks can be set by configuring the maxAllowedContentLength property in the WorkflowGen web.config file. The following example shows how to configure this property as 1 MB (note that the value should always be specified in bytes, so the value in the example is 1,024,000 bytes). The default value is 30,000,000 bytes.
1
<system.webServer>
2
<security>
3
<requestFiltering>
4
<requestLimits maxAllowedContentLength="1024000" />
5
</requestFiltering>
6
</security>
7
</system.webServer>
Copied!

Input file allowed folders

You can configure the local or remote folder paths where files used by FILE type parameters are located using the Input file allowed folders setting In the Webhooks section on the Configuration Panel Integration tab. (Alternately, you can add the folder names separated by commas to the HooksInputFileAllowedFolders parameter in the WorkflowGen web.config file.)
When using file uploads, you don't need to include the original file folder.
To disallow input file allowed folders, leave this field empty (or the parameter undefined). To allow certain folders only, enter comma-separated values according to the table below:
Value
Description
Empty
No folders allowed
*
All folders allowed
c:\*
All folders on drive c:
c:\Inetpub\*
All subfolders in a specific folder
c:\Inetpub\folder*
All c:\Inetpub folders whose names start with folder 📌 Examples:
    c:\Inetpub\folder1
    c:\Inetpub\folder1\abc
    c:\Inetpub\folder2
c:\Inetpub\folder2\abc\def
Specific folder only

Input file allowed HTTP URLs

You can configure allowed HTTP URLs for input files using the Input file allowed HTTP URLs setting in the Webhooks section on the Control Panel Integration tab. (Alternately, you can add the folder names separated by commas to the HooksInputFileAllowedHttpUrls parameter in the WorkflowGen web.config file.)
To disallow file uploads using HTTP and/or HTTPS URLs, leave the field empty (or the parameter undefined). To allow certain URLs only, enter comma-separated values according to the table below:
Value
Description
Empty
No HTTP or HTTPS URLs allowed
*
All HTTP and HTTPS URLs allowed
https://*
HTTPS URLs only
http://*
HTTP URLs only
http://mydomain/*
HTTP from a specific domain only
http://mydomain/folder/*
HTTP from a specific folder only
http://mydomain/folder*
All files and folders whose names start with folder 📌 Examples:
    http://mydomain/folderfile.jpg
    http://mydomain/folder/file.jpg
    http://mydomain/folder2/file.jpg
http://mydomain/folder/file.jpg
Specific file only

Maximum input file size

In the Webhooks section on the Integration tab in the Administration Module Configuration Panel, enter the maximum input file size in kilobytes in the Maximum input file size (kB) field.
Alternately, you can set the maximum input file content size in kilobytes as the value of the HooksMaxInputFileSize parameter in the WorkflowGen web.config file.

Maximum input file content size

When working with FILE type parameters content encoded in base64, you must enter the maximum input file content size in kilobytes in the Maximum input file content size (kB) field in the Webhooks section on the Integration tab in the Administration Module Configuration Panel.
Alternately, you can set the maximum input file content size in kilobytes as the value of the HooksMaxInputFileContentSize parameter in the WorkflowGen web.config file.
FILE type data content is only recommended for small files under 1 MB.

Performance tuning

WorkflowGen is installed with the following default webhooks settings (located under iisnode in \wfgen\hooks\web.config):
1
nodeProcessCountPerApplication="1"
2
maxConcurrentRequestsPerProcess="1024"
Copied!
With these settings, only one node.exe instance will handle HTTP requests. This should be sufficient in most cases, but you can optimize performance if needed by adjusting these values based on the number of potential concurrent requests.

Creating an incoming webhook application

To create a new incoming webhook application in your WorkflowGen application, click the Add Application button on the Applications page. Then, choose Incoming webhook from the Application type drop-down list, enter the Name and Description, and click Save.
The Applications page will now display your incoming webhook application information, including the application URL. This is the URL you should use to send WorkflowGen incoming webhooks. The last component of this URL corresponds to a token that WorkflowGen will use to identify your incoming webhooks.
You should fill in the Impersonate username textbox with the WorkflowGen username you use to perform your desired operations. Be aware that your impersonated user must have your asked-operation-required rights to complete the action; if not, you will receive a security error on your response payload. As well, if the impersonate username is not set, the workflow engine service default identity will be used (as defined in the Security section on the Integration tab in the Configuration Panel).
    The generated URL and its associated token must remain private and not exposed to end-users in client-side (in JavaScript, for example). You should treat the token with the same level of security as you would a password.
    If the token used in the incoming webhook URL is missing or invalid, a 404 status code will be returned. If the associated user is invalid, archived, or inactive, a 403 status code will be returned. In both cases, the response will contain a descriptive error message.

Sending data in JSON

The incoming webhook application receives your HTTP POST request payload formatted as a JSON object.
Using the URL provided, you can post HTTP requests from external applications (e.g. Postman) to WorkflowGen in order to execute the available operations in your WorkflowGen application. For operations that require you to provide an object ID, the object ID value can be retrieved by using the GraphQL API. In most cases, object numbers can be used instead of IDs in operation payloads.
In case of an error, you will get a response payload providing error details such as:
1
{
2
"error": "Advantys.Workflow.ServiceFacade: CreateRequest error: A process ID or name is required"
3
}
Copied!

Curl example

The requests should respect the structure shown in this example, where operation refers to the name of the operation to execute, and args contains the input node that groups all of the request parameters to perform the operation.
To create a new request, the processName parameter is required. The processVersion parameter is optional and is used to find the correct process you want to use to create your request.

Request payload:

1
curl -u yourusername -X POST -H "Content-Type: application/json" -d '{
2
"operation": "createRequest",
3
"args": {
4
"input": {
5
"processName": "2_LEVELS_APPROVAL",
6
"processVersion": 1
7
}
8
}
9
}' http://localhost/wfgen/hooks/yourtoken
Copied!

Response payload:

The response payload will be structured as follows:
1
{
2
"clientMutationId": null,
3
"requestId": "UmVxdWVzdDoxNzI4",
4
"number": 10,
5
"onBehalfOf": null,
6
"onBehalfOfUserName": null
7
}
Copied!

Parameters

Parameter
Description
processName
Process name (required)
processVersion
Process version, used to find the correct process you want to use to create the request
clientMutationId
This parameter will be null if the request creator did not define it in the request payload
requestId
ID of newly created request
number
Number of newly created request
onBehalfOf
This parameter contains the delegator ID; however, if the request was not created in delegation mode, its value will be null
onBehalfOfUserName
This parameter contains the delegator username; however, if the request was not created in delegation mode, its value will be null

OpenAPI v2 endpoints

As of version 7.17.0, incoming webhooks now offer a new endpoint that supports the OpenAPI v2 specification for operation definitions and another endpoint for operation execution. This allows for seamless integration with other OpenAPI-ready solutions such as Swagger, Microsoft Flow, Azure Logic Apps and Postman.

Webhook operation definitions

Use this endpoint to retrieve webhook operation definitions based on the OpenAPI v2 specification (in JSON format).
1
URI: /wfgen/hooks/openapi/v2
Copied!

Webhook operation execution

Use this endpoint to execute a webhook operation using HTTP POST, replacing :operation with the name of the incoming webhook operation (e.g. createRequest).
1
URI: /wfgen/hooks/operations/:operation
Copied!

Required parameters

    :operation: Name of the incoming webhook operation defined in the URI ✏️ Note: The operation name is not required inside the request payload.
    x-wfgen-hooktoken: Webhook token value specified in the HTTP request header, which is the same token value as used in a classic incoming webhooks URL
    Properties with an asterisk * next to their name
Other required or optional parameters specific to the webhook operation might be needed.

Request operations

Create a new request

To create a new request from the webhooks API, make sure that sub-process mode is enabled with public access on the target process. (See the Process form section in the WorkflowGen Administration Guide for more information.)

Request payload:

1
{
2
"operation": "createRequest",
3
"args": {
4
"input": {
5
"processName": "2_LEVELS_APPROVAL",
6
"processVersion": 1
7
}
8
}
9
}
Copied!

Response payload:

1
{
2
"clientMutationId": null,
3
"requestId": "UmVxdWVzdDoxNzI4",
4
"number": 1728,
5
"onBehalfOf": null,
6
"onBehalfOfUserName": null
7
}
Copied!
A parameter's array can be included in the createRequest operation payload. Be aware that a data with the same name and data type must previously exist in the process for each parameter in the array to store the parameter's value. The following example shows how to send parameters corresponding to the four supported data types (TEXT, NUMERIC, DATETIME, and FILE).

Request payload:

1
{
2
"operation": "createRequest",
3
"args": {
4
"input": {
5
"processName": "2_LEVELS_APPROVAL",
6
"processVersion": 1,
7
"parameters": [
8
{
9
"name": "TEXT",
10
"textValue": "My text parameter"
11
},
12
{
13
"name": "NUMERIC",
14
"numericValue": 5
15
},
16
{
17
"name": "DATE",
18
"dateTimeValue": "2017-02-23T20:46:00Z"
19
},
20
{
21
"name": "FILE",
22
"fileValue": {
23
"name": "TestFile.txt",
24
"contentType": "text/plain",
25
"size": 616,
26
"url": "file:///c:/TestFile.txt",
27
"updatedAt": "2017-02-21T15:06:38Z"
28
}
29
}
30
]
31
}
32
}
33
}
Copied!

Response payload:

1
{
2
"clientMutationId": null,
3
"requestId": "UmVxdWVzdDoxNzY1",
4
"number": 1765,
5
"onBehalfOf": null,
6
"onBehalfOfUserName": null
7
}
Copied!

Properties

Property
Type
Description
clientMutationId
String
Client mutation identifier
processId
Base64-encoded string
Process identifier with the pattern [Process:1] where 1 is the process identifier from the database
processName
String
Process name
processVersion
Int
Process version, used to find the correct process you want to use to create the request
isTest
Boolean
Indicates if the process is in test
parameters
Array
Array of parameters (see Parameter definitions)
onBehalfOf
Base64-encoded string
User identifier that is used by the user to perform the mutation on behalf of another person, with the pattern [User:1] where 1 is the user identifier from the database

Update a request dataset

A request dataset context can be updated by adding a parameter array. In this case a request number or a request ID should be provided.
This operation requires users to have system access to perform it. This can be configured in the System operations allowed users field under Security on the Integration tab in the Configuration Panel.

Request payloads:

1
{
2
"operation": "updateRequestDataset",
3
"args": {
4
"input": {
5
"number": 1750,
6
"parameters": [
7
{
8
"name": "NEW_PARAMETER",
9
"textValue": "My parameter"
10
}
11
]
12
}
13
}
14
}
Copied!
1
{
2
"operation": "updateRequestDataset",
3
"args": {
4
"input": {
5
"id": "UmVxdWVzdDoxMDAw",
6
"parameters": [
7
{
8
"name": "NEW_PARAMETER",
9
"textValue": "My parameter"
10
}
11
]
12
}
13
}
14
}
Copied!

Response payload:

1
{
2
"clientMutationId": null,
3
"requestId": "UmVxdWVzdDoxNzIx",
4
"parameters": [
5
{
6
"name": "NEW_PARAMETER",
7
"textValue": "My parameter"
8
}
9
]
10
}
Copied!
For more information on FILE parameter manipulations when sent within incoming webhook payloads, see the File upload section.

Properties

Property
Type
Description
clientMutationId
String
Client mutation identifier
id
Base64-encoded string
Request identifier with the pattern [Request:1] where 1 is the request identifier from the database
number
Int
Request number
parameters
Array
Array of parameters (see Parameter definitions)

Cancel a request

You can cancel a request by using the request number or the request ID.

Request payloads:

1
{
2
"operation": "cancelRequest",
3
"args": {
4
"input": {
5
"number": 1728
6
}
7
}
8
}
Copied!
1
{
2
"operation": "cancelRequest",
3
"args": {
4
"input": {
5
"id": "UmVxdWVzdDoxNzI4"
6
}
7
}
8
}
Copied!

Response payload:

1
{
2
"clientMutationId": null,
3
"requestId": "UmVxdWVzdDoxNzI4",
4
"number": 1728,
5
"onBehalfOf": null,
6
"onBehalfOfUserName": null
7
}
Copied!

Properties

Property
Type
Description
clientMutationId
String
Client mutation identifier
id
Base64-encoded string
Request identifier with the pattern [Request:1] where 1 is the request identifier from the database
number
Int
Request number
notifyParticipant
Boolean
Indicates if participant members have to be notified
onBehalfOf
Base64-encoded string
User identifier that is used by the user to perform the mutation on behalf of another person, with the pattern [User:1] where 1 is the user identifier from the database

Delete a request

A request can be deleted by using the request number or the request ID.

Request payloads:

1
{
2
"operation": "deleteRequest",
3
"args": {
4
"input": {
5
"number": 1728
6
}
7
}
8
}
Copied!
1
{
2
"operation": "deleteRequest",
3
"args": {
4
"input": {
5
"id": "UmVxdWVzdDoxNzI4"
6
}
7
}
8
}
Copied!

Response payload:

1
{
2
"clientMutationId": null
3
}
Copied!

Properties

Property
Type
Description
clientMutationId
String
Client mutation identifier
id
Base64-encoded string
Request identifier with the pattern [Request:1] where 1 is the request identifier from the database
number
Int
Request number

Action operations

Complete an action

To complete an action, provide the request number and the action number, or the action ID.

Request payloads:

1
{
2
"operation": "completeAction",
3
"args": {
4
"input": {
5
"requestNumber": 1765,
6
"number": 1,
7
"parameters": [
8
{
9
"name": "NEW_PARAMETER",
10
"textValue": "My parameter"
11
}
12
]
13
}
14
}
15
}
Copied!
1
{
2
"operation": "completeAction",
3
"args": {
4
"input": {
5
"id": "QWN0aW9uOjE3NTktLS0x"
6
}
7
}
8
}
Copied!

Response payload:

1
{
2
"clientMutationId": null,
3
"actionId": "QWN0aW9uOjE3NTktLS0x",
4
"number": 1,
5
"requestNumber": 1759,
6
"onBehalfOf": null,
7
"onBehalfOfUserName": null
8
}
Copied!
To complete an action, a parameter array can be included in the request payload arguments.

Request payload:

1
{
2
"operation": "completeAction",
3
"args": {
4
"input": {
5
"requestNumber": 1765,
6
"number": 1,
7
"parameters": [
8
{
9
"name": "NEW_PARAMETER",
10
"direction": "IN",
11
"type": "TEXT",
12
"textValue": "My parameter"
13
}
14
]
15
}
16
}
17
}
Copied!

Response payload:

1
{
2
"clientMutationId": null,
3
"actionId": "QWN0aW9uOjE3NjUtLS0x",
4
"number": 1,
5
"requestNumber": 1765,
6
"onBehalfOf": null,
7
"onBehalfOfUserName": null
8
}
Copied!

Properties

Property
Type
Description
clientMutationId
String
Client mutation identifier
id
Base64-encoded string
Action identifier with the pattern [Action:1---2] where 1 is the request identifier from the database and 2 is the action identifier from the database
requestNumber
Int
Request number
number
Int
Action number
activityName
String
Activity name
parameters
Array
Array of parameters (see Parameter definitions)
onBehalfOf
Base64-encoded string
User identifier that is used by the user to perform the mutation on behalf of another person, with the pattern [User:1] where 1 is the user identifier from the database

Complete a form action

Request payload:

1
{
2
"operation": "completeFormAction",
3
"args": {
4
"input": {
5
"requestNumber": 1765,
6
"number": 1,
7
"parameters": [
8
{
9
"name": "NEW_PARAMETER",
10
"textValue": "My parameter"
11
}
12
]
13
}
14
}
15
}
Copied!

Response payload:

1
{
2
"clientMutationId": null,
3
"actionId": "QWN0aW9uOjE3NjUtLS0x",
4
"number": 1,
5
"requestNumber": 1765,
6
"onBehalfOf": null,
7
"onBehalfOfUserName": null
8
}
Copied!

Properties

Property
Type
Description
clientMutationId
String
Client mutation identifier
id
Base64-encoded string
Action identifier with the pattern [Action:1---2] where 1 is the request identifier from the database and 2 is the action identifier from the database
requestNumber
Int
Request number
number
Int
Action number
activityName
String
Activity name
parameters
Array
Array of parameters (see Parameter definitions)
onBehalfOf
Base64-encoded string
User identifier used by the user to perform the mutation on behalf of another person with the pattern [User:1] where 1 is the user identifier from the database

Cancel an action

To cancel an action, provide the request number and the action number, or the action ID. The following conditions must be met:
    The viewer and the user (if they don't share the same identity, as in delegation mode) must have access to the request.
    The action must be open.
    The action must have a cancel or default exception defined in the transition.
    The viewer is:
      an administrator or process folder manager OR
      a supervisor with cancellation rights OR
      the action assignee.

Request payloads:

1
{
2
"operation": "cancelAction",
3
"args": {
4
"input": {
5
"requestNumber": 1759,
6
"number": 2
7
}
8
}
9
}
Copied!
1
{
2
"operation": "cancelAction",
3
"args": {
4
"input": {
5
"id": "QWN0aW9uOjEwMDAtLS0x"
6
}
7
}
8
}
Copied!

Response payload:

1
{
2
"clientMutationId": null,
3
"actionId": "QWN0aW9uOjE3NTktLS0y",
4
"number": 2,
5
"requestNumber": 1759,
6
"onBehalfOf": null,
7
"onBehalfOfUserName": null
8
}
Copied!

Properties

Property
Type
Description
clientMutationId
String
Client mutation identifier
id
Base64-encoded string
Action identifier with the pattern [Action:1---2] where 1 is the request identifier from the database and 2 is the action identifier from the database
requestNumber
Int
Request number
number
Int
Action number
type
String
Cancellation type:
    CANCEL: Cancellation exception
    ERROR: Error exception
exception: {
message*,
source
}
Object {
String, String }
Exception:
    Exception message
    Exception source
onBehalfOf
Base64-encoded string
User identifier used by the user to perform the mutation on behalf of another person with the pattern [User:1] where 1 is the user identifier from the database

Cancel a request's actions by name

All of the actions with the same name in a request can be cancelled at the same time by using their name in this operation payload. The following conditions are met:
    The viewer and the user (if they do not share the same identity, as in delegation mode) must have access to the request.
    The action must be open.
    The action must have a cancel or default exception defined in the transition.
    The viewer is:
      an administrator or a process folder manager OR
      a supervisor with cancellation rights OR
      the action assignee.

Request payload:

1
{
2
"operation": "cancelRequestActionsByName",
3
"args": {
4
"input": {
5
"requestNumber": 4399,
6
"activityName": "Initiates"
7
}
8
}
9
}
Copied!

Response payload:

1
{
2
"clientMutationId": null,
3
"actionIds": [
4
"QWN0aW9uOjQzOTktLS0x",
5
"QWN0aW9uOjQzOTktLS0y",
6
"QWN0aW9uOjQzOTktLS0z"
7
],
8
"onBehalfOf": null,
9
"onBehalfOfUserName": null
10
}
Copied!

Properties

Property
Type
Description
clientMutationId
String
Client mutation identifier
requestNumber
Int
Request number
activityName*
String
Activity name
type
String
Cancellation type:
    CANCEL: Cancellation exception
    ERROR: Error exception
exception: {
message*,
source
}
Object {
String, String }
Exception:
    Exception message
    Exception source
onBehalfOf
Base64-encoded string
User identifier used by the user to perform the mutation on behalf of another person with the pattern [User:1] where 1 is the user identifier from the database

Assign an action

To assign an action, provide the request number and the action number, or the action ID; you must also provide the assigneeUserName or the assigneeId.

Request payloads:

1
{
2
"operation": "assignAction",
3
"args": {
4
"input": {
5
"requestNumber": 1751,
6
"number": 2,
7
"assigneeUserName": "johnsmith"
8
}
9
}
10
}
Copied!
1
{
2
"operation": "assignAction",
3
"args": {
4
"input": {
5
"id": "QWN0aW9uOjEwMDAtLS0x",
6
"assigneeId": "QXNzaWduZWU6MQ=="
7
}
8
}
9
}
Copied!

Response payload:

1
{
2
"clientMutationId": null,
3
"actionId": "QWN0aW9uOjE3NTEtLS0y",
4
"number": 2,
5
"requestNumber": 1751,
6
"onBehalfOf": null,
7
"onBehalfOfUserName": null
8
}
Copied!

Properties

Property
Type
Description
clientMutationId
String
Client mutation identifier
id
Base64-encoded string
Action identifier with the pattern [Action:1---2] where 1 is the request identifier from the database and 2 is the action identifier from the database
assigneeId*
Base64-encoded string
User identifier of the person assigned to the action with the pattern [User:1] where 1 is the user identifier from the database
requestNumber
Int
Request number
number
Int
Action number
onBehalfOf
Base64-encoded string
User identifier used by the user to perform the mutation on behalf of another person with the pattern [User:1] where 1 is the user identifier from the database

Cancel an action assignment

To cancel an action assignment, you should provide the request number and the action number, or the action ID.

Request payloads:

1
{
2
"operation": "cancelActionAssignment",
3
"args": {
4
"input": {
5
"requestNumber": 1751,
6
"number": 2
7
}
8
}
9
}
Copied!
1
{
2
"operation": "cancelActionAssignment",
3
"args": {
4
"input": {
5
"id": "QWN0aW9uOjEwMDAtLS0x"
6
}
7
}
8
}
Copied!

Response payload:

1
{
2
"clientMutationId": null,
3
"actionId": "QWN0aW9uOjE3NTEtLS0y",
4
"number": 2,
5
"requestNumber": 1751,
6
"onBehalfOf": null,
7
"onBehalfOfUserName": null
8
}
Copied!

Properties

Property
Type
Description
clientMutationId
String
Client mutation identifier
id
Base64-encoded string
Action identifier with the pattern [Action:1---2] where 1 is the request identifier from the database and 2 is the action identifier from the database
requestNumber
Int
Request number
number
Int
Action number
onBehalfOf
Base64-encoded string
User identifier used by the user to perform the mutation on behalf of another person with the pattern [User:1] where 1 is the user identifier from the database

End-user operations

Create a new favorite

The incoming webhook application lets users add processes and views to their favorites lists using the process or view IDs.

Request payload:

1
{
2
"operation": "createFavorite",
3
"args": {
4
"input": {
5
"itemId": "UHJvY2VzczoxMTA="
6
}
7
}
8
}
Copied!
The above code will create a favorite using the process or view description, but adding a custom description is also possible, as shown in the following example:

Request payload:

1
{
2
"operation": "createFavorite",
3
"args": {
4
"input": {
5
"itemId": "UHJvY2VzczoxMTA=",
6
"description": "My custom description"
7
}
8
}
9
}
Copied!

Response payload:

1
{
2
"clientMutationId": null,
3
"favoriteId": "RmF2b3JpdGU6MTQ="
4
}
Copied!

Properties

Property
Type
Description
clientMutationId
String
Client mutation identifier
itemId*
Base64-encoded string
Process or view identifier with the pattern [Process:1] or [View:1] where 1 is the identifier from the database
description
String
Favorite description

Update a favorite

The incoming webhook application lets users update an existing favorite process or view by using its favorite ID.

Request payload:

1
{
2
"operation": "updateFavorite",
3
"args": {
4
"input": {
5
"id": "RmF2b3JpdGU6MTQ=",
6
"description": "Updated description"
7
}
8
}
9
}
Copied!

Response payload:

1
{
2
"clientMutationId": null,
3
"favoriteId": "RmF2b3JpdGU6MTQ="
4
}
Copied!

Properties

Property
Type
Description
clientMutationId
String
Client mutation identifier
id*
Base64-encoded string
Favorite identifier with the pattern [Favorite:1] where 1 is the favorite identifier from the database
description
String
Favorite description

Delete a favorite

The incoming webhook application lets users delete an existing favorite process or view from their favorites list by using its favorites ID.

Request payload:

1
{
2
"operation": "deleteFavorite",
3
"args": {
4
"input": {
5
"id": "RmF2b3JpdGU6MTQ="
6