Skip to main content
Version: 6.2.0

Logic

Interactor® logic is populated in a corresponding event file. Each file is named [event].[language name]. For example, a general execution based on javascript will be named execute.js. Currently, only Javascript is supported.

Each logic will have different expectations depending on what component is being configured.

Predefined variables

  • input
    • data: input data for execution that user put on their requestBody in API call. Configured in schema.variables of data.json
    • query: input data for execution that user put on their query parameters in API call.
  • service
    • token: token for the service api execution
    • token_name: name for identifying the token
    • url: service url (optional)
    • virtual: virtual token
    • fn: user defined service function
    • vars: platform service variables

Expected result

  • output configured in schema.output of data.json

Automation configuration:

  • Trigger: create.js
  • Trigger: delete.js

Automation triggered:

  • Trigger: trigger.js
  • Action: execute.js
  • Condition: execute.js

Event:

  • Event: route.js
  • Event: response.js

Following JS packages are built into the deployment

  {
"axios": "^1.6.2",
"body-parser": "^1.20.2",
"express": "^4.18.2",
"lodash": "^4.17.21",
"node-cache": "^5.1.2",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"xml2js": "^0.6.2",
"jsonwebtoken": "^9.0.2"
}

Additional packages may be included by changing deployment files. For example, assuming lodash was not builtin, if lodash was being custom added,

Docker

FROM interactor/interactor-language-javascript:latest

WORKDIR /usr/src/app

# ENV INPUT_VAR=input
# ENV DEPS_VAR=$

RUN npm install lodash

COPY deps.js .

RUN npm ci --omit=dev

deps.js

import lodash from 'lodash'
export default { lodash }

Lodash can now be used in logic as follows.

return $.lodash.shuffle([1,2,3])