Workflow Activities

The /operations endpoint allows you to access Workflow Activities which are the operations that can be performed within a workflow.

The DSL is used to define workflows. It is a JSON object that describes the steps of the workflow. The steps can be either activities or child workflows.

Execute Interaction

The executeInteraction activity executes an existing interaction.

Parameters

ParameterData TypeDescription
interactionstringThe ID of the interaction to execute.
dataRecord<string, any>The input data for the interaction.
configInteractionExecutionConfigurationThe execution configuration for the interaction.

Example

{
    "name": "executeInteraction",
    "title": "Execute Interaction",
    "description": "Execute an existing interaction",
    "params": {
        "interaction": "<INTERACTION_ID>",
        "data": {
            "text": "My input text"
        },
        "config": {
            "environment": "<ENVIRONMENT_ID>",
            "model": "<MODEL_ID>"
        }
    },
    "output": "interactionResult"
}

Get Content Objects

The getContentObjects activity retrieves a list of existing content objects.

Parameters

ParameterData TypeDescription
queryRecord<string, any>The query to use to retrieve the content objects.
selectstringA string of space separated field names. Prefix a field name with "-" to exclude it from the result.
limitnumberThe maximum number of content objects to retrieve.

Example

{
    "name": "getContentObjects",
    "title": "Get Content Objects",
    "description": "Retrieve a list of existing content objects",
    "params": {
        "query": {
            "type": "<TYPE_ID>"
        },
        "select": "name properties metadata",
        "limit": 10
    },
    "output": "retrievedObjects"
}

Get Content Object

The getContentObject activity retrieves an existing content object.

Parameters

ParameterData TypeDescription
idstringThe ID of the content object to retrieve.
selectstringA string of space separated field names. Prefix a field name with "-" to exclude it from the result.

Example

{
    "name": "getContentObject",
    "title": "Get Content Object",
    "description": "Retrieve an existing content object",
    "params": {
        "id": "<OBJECT_ID>",
        "select": "name properties metadata"
    },
    "output": "retrievedObject"
}

Create Content Object

The createContentObject activity creates a new content object.

Parameters

ParameterData TypeDescription
typestringThe ID of the content type.
parentstringThe ID of the parent object.
locationstringThe path of the parent object.
contentContentSourceThe content source.
propertiesRecord<string, any>The object properties.
metadataRecord<string, any>The object metadata.
external_idstringThe external ID of the object.

Example

{
    "name": "createContentObject",
    "title": "Create Content Object",
    "description": "Create a new content object",
    "params": {
        "type": "<TYPE_ID>",
        "parent": "<PARENT_ID>",
        "location": "<LOCATION>",
        "content": {
            "source": "<SOURCE_URL>",
            "type": "<MIME_TYPE>",
            "name": "<FILE_NAME>"
        },
        "properties": {
            "title": "My new object"
        },
        "metadata": {
            "type": "document"
        },
        "external_id": "<EXTERNAL_ID>"
    },
    "output": "newObjectId"
}

Update Content Object

The updateContentObject activity updates an existing content object.

Parameters

ParameterData TypeDescription
idstringThe ID of the content object to update.
propertiesRecord<string, any>The object properties to update.
metadataRecord<string, any>The object metadata to update.
external_idstringThe external ID of the object to update.

Example

{
    "name": "updateContentObject",
    "title": "Update Content Object",
    "description": "Update an existing content object",
    "params": {
        "id": "<OBJECT_ID>",
        "properties": {
            "title": "My updated object"
        },
        "metadata": {
            "type": "document"
        },
        "external_id": "<EXTERNAL_ID>"
    }
}

Delete Content Object

The deleteContentObject activity deletes an existing content object.

Parameters

ParameterData TypeDescription
idstringThe ID of the content object to delete.

Example

{
    "name": "deleteContentObject",
    "title": "Delete Content Object",
    "description": "Delete an existing content object",
    "params": {
        "id": "<OBJECT_ID>"
    }
}

Get Content Types

The getContentTypes activity retrieves a list of existing content types.

Parameters

ParameterData TypeDescription
queryRecord<string, any>The query to use to retrieve the content types.
selectstringA string of space separated field names. Prefix a field name with "-" to exclude it from the result.
limitnumberThe maximum number of content types to retrieve.

Example

{
    "name": "getContentTypes",
    "title": "Get Content Types",
    "description": "Retrieve a list of existing content types",
    "params": {
        "query": {
            "is_chunkable": true
        },
        "select": "name object_schema",
        "limit": 10
    },
    "output": "retrievedTypes"
}

Get Content Type

The getContentType activity retrieves an existing content type.

Parameters

ParameterData TypeDescription
idstringThe ID of the content type to retrieve.
selectstringA string of space separated field names. Prefix a field name with "-" to exclude it from the result.

Example

{
    "name": "getContentType",
    "title": "Get Content Type",
    "description": "Retrieve an existing content type",
    "params": {
        "id": "<TYPE_ID>",
        "select": "name object_schema"
    },
    "output": "retrievedType"
}

Get Interaction Runs

The getInteractionRuns activity retrieves a list of existing interaction runs.

Parameters

ParameterData TypeDescription
queryRecord<string, any>The query to use to retrieve the interaction runs.
selectstringA string of space separated field names. Prefix a field name with "-" to exclude it from the result.
limitnumberThe maximum number of interaction runs to retrieve.

Example

{
    "name": "getInteractionRuns",
    "title": "Get Interaction Runs",
    "description": "Retrieve a list of existing interaction runs",
    "params": {
        "query": {
            "interaction": "<INTERACTION_ID>"
        },
        "select": "name parameters result",
        "limit": 10
    },
    "output": "retrievedRuns"
}

Get Interaction Run

The getInteractionRun activity retrieves an existing interaction run.

Parameters

ParameterData TypeDescription
idstringThe ID of the interaction run to retrieve.
selectstringA string of space separated field names. Prefix a field name with "-" to exclude it from the result.

Example

{
    "name": "getInteractionRun",
    "title": "Get Interaction Run",
    "description": "Retrieve an existing interaction run",
    "params": {
        "id": "<RUN_ID>",
        "select": "name parameters result"
    },
    "output": "retrievedRun"
}

HTTP Request

The httpRequest activity makes an HTTP request.

Parameters

ParameterData TypeDescription
urlstringThe URL to make the request to.
methodstringThe HTTP method to use.
headersRecord<string, string>The headers to send with the request.
bodystringThe body to send with the request.

Example

{
    "name": "httpRequest",
    "title": "HTTP Request",
    "description": "Make an HTTP request.",
    "params": {
        "url": "https://example.com",
        "method": "GET",
        "headers": {
            "Content-Type": "application/json"
        },
        "body": JSON.stringify({
            "foo": "bar"
        })
    },
    "output": "httpResponse"
}

Set Variable

The setVariable activity sets a workflow variable.

Parameters

ParameterData TypeDescription
namestringThe name of the variable to set.
valueanyThe value to set the variable to.

Example

{
    "name": "setVariable",
    "title": "Set Variable",
    "description": "Set a workflow variable.",
    "params": {
        "name": "myVariable",
        "value": "Hello world!"
    }
}

Get Variable

The getVariable activity retrieves a workflow variable.

Parameters

ParameterData TypeDescription
namestringThe name of the variable to retrieve.

Example

{
    "name": "getVariable",
    "title": "Get Variable",
    "description": "Retrieve a workflow variable.",
    "params": {
        "name": "myVariable"
    },
    "output": "myVariableValue"
}

Conditional

The conditional activity executes a workflow step if a condition is met.

Parameters

ParameterData TypeDescription
conditionbooleanThe condition to evaluate.
ifDSLWorkflowStepThe workflow step to execute if the condition is met.
elseDSLWorkflowStepThe workflow step to execute if the condition is not met.

Example

{
    "name": "conditional",
    "title": "Conditional",
    "description": "Execute a workflow step if a condition is met.",
    "params": {
        "condition": {
            "$eq": {
                "myVariable": "Hello world!"
            }
        },
        "if": {
            "name": "log",
            "params": {
                "message": "The condition is met!"
            }
        },
        "else": {
            "name": "log",
            "params": {
                "message": "The condition is not met!"
            }
        }
    }
}

Loop

The loop activity executes a workflow step multiple times.

Parameters

ParameterData TypeDescription
timesnumberThe number of times to execute the workflow step.
stepDSLWorkflowStepThe workflow step to execute.

Example

{
    "name": "loop",
    "title": "Loop",
    "description": "Execute a workflow step multiple times.",
    "params": {
        "times": 10,
        "step": {
            "name": "log",
            "params": {
                "message": "Hello world!"
            }
        }
    }
}

Parallel

The parallel activity executes multiple workflow steps in parallel.

Parameters

ParameterData TypeDescription
stepsDSLWorkflowStep[]The workflow steps to execute in parallel.

Example

{
    "name": "parallel",
    "title": "Parallel",
    "description": "Execute multiple workflow steps in parallel.",
    "params": {
        "steps": [
            {
                "name": "log",
                "params": {
                    "message": "Hello world!"
                }
            },
            {
                "name": "sleep",
                "params": {
                    "duration": 1000
                }
            }
        ]
    }
}

Log

The log activity logs a message to the workflow execution log.

Parameters

ParameterData TypeDescription
messagestringThe message to log.

Example

{
    "name": "log",
    "title": "Log",
    "description": "Log a message to the workflow execution log.",
    "params": {
        "message": "Hello world!"
    }
}

Sleep

The sleep activity pauses the workflow execution for a specified amount of time.

Parameters

ParameterData TypeDescription
durationnumberThe duration of the pause in milliseconds.

Example

{
    "name": "sleep",
    "title": "Sleep",
    "description": "Pause the workflow execution for a specified amount of time.",
    "params": {
        "duration": 1000
    }
}

Was this page helpful?