Web Hook

Type: webhook

This handler makes an HTTP(S) POST to a remote web service. It automatically passes along any relevant information about the workflow, task or transition so that your web service can get to work.

The config for this handler looks like this:

{
    "url": "http://myserver:port/controller"
}

In addition, you can supply username and password properties in support of Basic authentication to your listener endpoint:

{
    "url": "http://myserver:port/controller",
    "username": "username",
    "password": "password"
}

And you can specifty the http method the webhook is sent as. The default is POST. Note that GET and DELETE requests will not contain the payload which contains the relevant information about the workflow, therefore POST and PUT are recommended.

{
    "url": "http://myserver:port/controller",
    "method": "PUT"
}

For workflow events, the payload looks like this:

{
    "workflow": {
        "_doc": "<workflowId>",
        "modelId": "<modelId>",
        "modelVersion": "<modelVersion>",
        "resources": {
            "resourceId": {
                "_doc": "<resourceId>"
            },
            ...
        },
        "data": {
            ...
        }
    },
    "event": "<eventId>"
}

For task events, the payload includes the workflow properties, plus:

{
    "task": {
        "_doc": "<taskId>",
        "type": "<taskType>",
        "workflowNodeId": "<workflowNodeId>",
        "data": {
            ...
        },
        "resources": {
            "resourceId": {
                "_doc": "<resourceId>"
            },
            ...
        },
        "assignee": {
            "domainId": "<domainId>",
            "_doc": "<principalId>",
            "name": "<name>",
            "email": "<email>"
        }
    }
}

For transition events, the payload includes the workflow properties, plus:

{
    "source": {
        "_doc": "<taskId>",
        "type": "<taskType>",
        "workflowNodeId": "<workflowNodeId>",
        "data": {
            ...
        },
        "resources": {
            "resourceId": {
                "_doc": "<resourceId>"
            },
            ...
        },
        "assignee": {
            "domainId": "<domainId>",
            "_doc": "<principalId>",
            "name": "<name>"
        }
    },
    "target": {
        "_doc": "<taskId>",
        "type": "<taskType>",
        "workflowNodeId": "<workflowNodeId>",
        "data": {
            ...
        },
        "resources": {
            "resourceId": {
                "_doc": "<resourceId>"
            },
            ...
        },
        "assignee": {
            "domainId": "<domainId>",
            "_doc": "<principalId>",
            "name": "<name>"
        }
    },
    "transition": "<transitionId>"
}

The web hook listener will by default be sent an HTTP POST request with content type "application/json". The listener should return a JSON response (empty) with a status of 200. The response should be of type "application/json". At present, the response is ignored by the Cloud CMS server.

The SDK includes a sample webhook server.

At a future point, conditional logic based on web hook response will be introduced.