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
Parameter | Data Type | Description |
---|---|---|
interaction | string | The ID of the interaction to execute. |
data | Record<string, any> | The input data for the interaction. |
config | InteractionExecutionConfiguration | The 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
Parameter | Data Type | Description |
---|---|---|
query | Record<string, any> | The query to use to retrieve the content objects. |
select | string | A string of space separated field names. Prefix a field name with "-" to exclude it from the result. |
limit | number | The 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
Parameter | Data Type | Description |
---|---|---|
id | string | The ID of the content object to retrieve. |
select | string | A 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
Parameter | Data Type | Description |
---|---|---|
type | string | The ID of the content type. |
parent | string | The ID of the parent object. |
location | string | The path of the parent object. |
content | ContentSource | The content source. |
properties | Record<string, any> | The object properties. |
metadata | Record<string, any> | The object metadata. |
external_id | string | The 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
Parameter | Data Type | Description |
---|---|---|
id | string | The ID of the content object to update. |
properties | Record<string, any> | The object properties to update. |
metadata | Record<string, any> | The object metadata to update. |
external_id | string | The 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
Parameter | Data Type | Description |
---|---|---|
id | string | The 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
Parameter | Data Type | Description |
---|---|---|
query | Record<string, any> | The query to use to retrieve the content types. |
select | string | A string of space separated field names. Prefix a field name with "-" to exclude it from the result. |
limit | number | The 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
Parameter | Data Type | Description |
---|---|---|
id | string | The ID of the content type to retrieve. |
select | string | A 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
Parameter | Data Type | Description |
---|---|---|
query | Record<string, any> | The query to use to retrieve the interaction runs. |
select | string | A string of space separated field names. Prefix a field name with "-" to exclude it from the result. |
limit | number | The 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
Parameter | Data Type | Description |
---|---|---|
id | string | The ID of the interaction run to retrieve. |
select | string | A 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
Parameter | Data Type | Description |
---|---|---|
url | string | The URL to make the request to. |
method | string | The HTTP method to use. |
headers | Record<string, string> | The headers to send with the request. |
body | string | The 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
Parameter | Data Type | Description |
---|---|---|
name | string | The name of the variable to set. |
value | any | The 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
Parameter | Data Type | Description |
---|---|---|
name | string | The 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
Parameter | Data Type | Description |
---|---|---|
condition | boolean | The condition to evaluate. |
if | DSLWorkflowStep | The workflow step to execute if the condition is met. |
else | DSLWorkflowStep | The 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
Parameter | Data Type | Description |
---|---|---|
times | number | The number of times to execute the workflow step. |
step | DSLWorkflowStep | The 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
Parameter | Data Type | Description |
---|---|---|
steps | DSLWorkflowStep[] | 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
Parameter | Data Type | Description |
---|---|---|
message | string | The 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
Parameter | Data Type | Description |
---|---|---|
duration | number | The 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
}
}