You are reading the documentation for an outdated Corteza release. 2024.9 is the latest stable Corteza release.

Workflow Processing

When your integration gateway endpoint requires additional processing and the built-in processers do not suffice, you can bind a workflow to the endpoint to handle requests.

To bind a workflow to an integration gateway route, you first need to properly configure the workflow, and then bind it to the route’s workflow processer.

Workflow Configuration

If you wish for a workflow to be executable by the integration gateway, the workflow must define a proper trigger.

To configure your workflow:
  1. Create a new workflow or edit an existent workflow. Refer to the workflow documentation for details.

  2. Assure that the workflow in question defines a trigger with the resource of System and an event of onManual.

Reading a Request Body via Function

The way the http.Request is wrapped allows us to use it in the JS environment processing function (see more at JavaScript processing) or the function designed specifically for request body content fetching.

The screenshot shows the base workflow definition via read request body function.
Figure 1. The screenshot shows the base workflow definition via read request body function.

Find the workflow for this example in the hyperlink.

Reading a Request Body via JS

The screenshot shows the base workflow definition via JS function.
Figure 2. The screenshot shows the base workflow definition via JS function.

Find the workflow for this example in the hyperlink.

The input Javascript source can be as simple as:
try {
    return JSON.parse(readRequestBody(input));
} catch (e) {
    return 'could not parse request body: ' + e.message
}
The body that is read could also be used as a string and later parsed in the subsequent workflow steps:
try {
    return readRequestBody(input);
} catch (e) {
    return 'could not read request body: ' + e.message
}

Integration Gateway Route Configuration

To bind a workflow to the integration gateway endpoint:
  1. Create a new integration gateway endpoint or edit an existing endpoint. Refer to the integration gateway documentation for details.

  2. Add a workflow processer to the endpoint.

  3. Select the workflow you wish to bind from the dropdown in the modal window.

  4. Confirm the selection and press on the save button to update the endpoint.

The screenshot shows the route configuration with workflow processer added.
Figure 3. The screenshot shows the route configuration with workflow processer added.
The screenshot shows the workflow processer configuration.
Figure 4. The screenshot shows the workflow processer configuration.

Testing

To test if the integration gateway route and the workflow are properly interacting, initiate an HTTP request using Postman or any other tool such as cURL.

Refer to the curl examples for details.