Spanish Total.js
English
Documentation For AI agents
Contents

Common

General components that send, change, split, merge, delay and print messages.

.md GitHub
On this page

General components that send, change, split, merge, delay and print messages. This page holds the catalogue group Common.

Each entry lists the inputs and outputs of the component, its main settings and the text of its readme. To add a component to a FlowStream, see Download components.

API

component

code.html · version 4

Runs your own JavaScript code for each message.
ParameterTypeDescription
outputs? Number Number of outputs. Default: 1
name? String Name. Default: Code
code? String The JavaScript code that runs for each message.

Inputs: input (Input).

Outputs: output (Output); more come from the settings of the node.

This component executes a custom JavaScript code as it is.

To send data to the default output use send(somedata);

To send data to specific output when number of outputs > 1 use $.send('outputX', somedata) where X is output index, see example bellow:

  • first output--> send(somedata) or $.send('output', somedata)
  • second output --> $.send('output2', somedata)
  • ...
  • 5th output --> $.send('output5', somedata)
  • etc.
component

comment.html · version 1

Shows a short Markdown comment on the canvas.
ParameterTypeDescription
text? String The comment, in Markdown. Default: Add a custom comment...

Inputs: none.

Outputs: none.

This component renders a small markdown comment inside the body.

component

counter.html · version 1

Counts incoming messages.

Inputs: input (Input).

Outputs: none.

The component counts incoming messages.

component

datamapper.html · version 1

Renames the properties of the incoming data.
ParameterTypeDescription
extend? Boolean Only extend the incoming payload. Default: false

Inputs: input (Input).

Outputs: output (Output).

This component remaps payload properties.

component

datasorter.html · version 3

Sends each message to the output whose condition it meets.
ParameterTypeDescription
conditions? Array The conditions. Each condition has its own output. Default: []
if? String Condition.

Inputs: input (Input).

Outputs: they come from the settings of the node.

The component sorts data according to the custom defined conditions. You can define unlimited count of outputs with various conditions.

component

delay.html · version 4

Delays each message.
ParameterTypeDescription
delay? Number Delay. Default: 1000

Inputs: input (Input).

Outputs: output (Output).

When several messages wait, the component sends the newest one first, then one message after each delay.

The component delays processing of a message.

component

downloader.html · version 2

Downloads a file from a URL address.
ParameterTypeDescription
output? String Output. One of: file (File), base64 (BASE64), datauri (Data URI), buffer (Buffer). Default: file
path? String Assign response to the path. Default: value
urlpath? String Path for reading URL address. Default: url

Inputs: input (Input).

Outputs: output (Output), error (Error).

The component downloads the file from the URL address as it is.

Input

{
    url: 'https://example.com/file.jpg', // file url
}

Output

{
    value: '/tmp/xyz.bin',
    ...
}

The file will be automaticaly deleted once the message is destroyed.

component

duplicator.html · version 1

Sends each incoming message several times.
ParameterTypeDescription
count? Number Count. Default: 1
repo? Boolean Duplicate repository. Default: true
refs? Boolean Duplicate references. Default: true
vars? Boolean Duplicate variables. Default: true
data? Boolean Duplicate data. Default: true

Inputs: input (Input).

Outputs: output (Output).

This component duplicates incoming messages according to the configuration settings.

component

end.html · version 1

Ends the incoming message.

Inputs: input (Input).

Outputs: none.

The component destroys the incoming message.

component

extend.html · version 3

Adds new properties to the incoming data.
ParameterTypeDescription
path? String Load data from the specific property/field.

Inputs: input (Input).

Outputs: output (Output).

This component extends the current message by adding new properties.

component

feedtodelay.html · version 1

Forwards only the last message after a quiet period.
ParameterTypeDescription
timeout? String Timeout in seconds.
resend? String Keep resending.

Inputs: input (Input).

Outputs: output (Output).

The incomming message will only be forwarded after the timeout. Only the last message is forwarded, so any previously received messages are lost.

If messages are comming in within the given timeout period this component will never forward any message.

The timeout is activated by the first message.

The maximum timeout is 2147483 seconds, which is about 24.8 days.

Example usage:

    • A sensor is supposed to send data every minute, use this component to notify you that there is a problem with receiving message.
    • HTTP request comes in and it takes too much time to respond? Use this component to notify you about it.
component

flashback.html · version 4

Remembers data so that you can repeat the action.

Inputs: input (Input).

Outputs: output (Output).

The component remembers the data for repeating the action.

component

forward.html · version 1

Forwards messages, for use with colored connections.

Inputs: input (Input).

Outputs: output (Output).

The component send message next only. It's targeted for colorized connections to targeted to the same input.

  • The data will Flow only from input a specific color (except black)
  • The color black is a universal color and it will transport everything
component

request.html · version 8

Makes an HTTP request and sends the response.
ParameterTypeDescription
url? String URL address.
method? String Method. One of: GET, POST, PUT, DELETE, PATCH. Default: GET
dnscache? Boolean Enable DNS cache. Default: true
insecure? Boolean Allow insecure connection. Default: false
secret? String Total.js Encryption/Decryption secret.
xhr? Boolean Add XHR header. Default: false
parse? Boolean Parse Response to Object. Default: true
timeout? Number Timeout. Default: 10000
limit? Number
  1. size.
Default: 512000
headers? Object Headers. Default: {}
cookies? Object Cookies. Default: {}
serialize? Object Data serialization. One of: json (JSON), urlencoded (URL encode), buffer (Buffer). Default: null
send? String Send to output. One of: all (Everything), response (Response body), chunks (Chunks of buffer), headers (Headers only), status (Status code). Default: all
path? String Read path.
path2? String Write path.
patherr? String Error path.

Inputs: payload (Payload).

Outputs: response (Response), error (Error).

The component makes a HTTP request. The response data will be serialized as the payload.

Response:

{
    status: Number,
    headers: { key: value },
    cookies: { key: value },
    host: String,
    body: String/Object/Buffer
}
component

jsonschemavalidator.html · version 1

Validates incoming data against a JSON schema.
ParameterTypeDescription
schema? String JSON schema.

Inputs: input (Input), schema (Schema).

Outputs: output (Output), schema (Schema), error (Error).

JSON schema documentation

Inputs

  • input validates data and send the result to output if no error, otherwise send error to error output
  • schema reads the schema and send it to the schema output
component

livestats.html · version 1

Shows statistics of incoming messages live.
ParameterTypeDescription
interval? Number Interval (ms). Default: 1000
color? String Color. Default: #E73CF7

Inputs: input (Counter).

Outputs: none.

Live Stats Component

Keep an eye on incoming messages in a snap!

component

logger.html · version 1

Logs information about incoming data.
ParameterTypeDescription
id? String Message ID. Default: id
name? String Log name. Default: {{ data.name }}
status? String Log step. Default: Step 1
remove? String Remove logs older than. Default: 1 year

Inputs: input (Input), error (Error).

Outputs: error (Error), output (Output).

The component logs information about incoming data.

component

macro.html · version 1

Transforms data with the Total.js Macro language.
ParameterTypeDescription
code? String The code in the Total.js Macro language. Default: RETURN DATA
clear? String Clear temporary data.

Inputs: input (Input).

Outputs: output (Output).

The macro component uses Total.js Macro language that allows you to write much simple code like in JavaScript. Macros are targeted for small data transformation.

  • you don't need to solve Upper/Lower case
  • return EXPRESSION will return data and send them next
  • data keyword contains a message data
  • temp keyword can contain a persistent temporary data

Example:

IF DATA>20 AND DATA<35
    RETURN DATA * 5
FI
component

map-array.html · version 1

Keeps only the listed properties of each object in an array.
ParameterTypeDescription
array? String Return an Array of Arrays (Default: Array of Objects).

Inputs: input (Input).

Outputs: output (Output).

This component can iterate over an array and only take properties listed in the configuration. The input must be an array of objects!

Example data

[
    { sensor: { temperature: 25, humidity: 50, ... some more properties }},
    { sensor: { temperature: 24, humidity: 55, ... some more properties }},
    { sensor: { temperature: 23, humidity: 60, ... some more properties }}
]

Example configuration

  • sensor.temperature -> temp
  • sensor.humidity -> hum

Example output

[
    { temp: 25, hum: 50 },
    { temp: 24, hum: 55 },
    { temp: 23, hum: 60 }
]

If Return an Array of Arrays is checked then

each of the Map properties will be pushed to a new array, see example bellow

Example given the data above and this configuration:

Return an Array of Arrays -> checked

Map:

  • sensor.temperature
  • sensor.humidity

Example output:

[
    [25, 50],
    [24, 55],
    [23, 60],
]
component

merge.html · version 1

Merges incoming data into an array.
ParameterTypeDescription
limit? Number Limit. Default: 0
timeout? Number Timeout. Default: 2000

Inputs: input (Input).

Outputs: output (Output).

The component merges incoming data into an array.

component

merginputs.html · version 1.1.0

Merges the data of several inputs into one object.
ParameterTypeDescription
inputs? Array The inputs to merge. Default: []
clear? String Clear cache.
path? String Path.
assign? String Assign to the path.
required? String Required.

Inputs: they come from the settings of the node.

Outputs: output (Output).

This component merges multiple inputs into one object.

component

modified.html · version 1

Compares incoming data with the previous data.

Inputs: input (Input).

Outputs: modified (Modified), notmodified (Not modified).

The component compares incoming data with previous data.

component

modify.html · version 3

Sets, moves or removes properties of the incoming data.
ParameterTypeDescription
rules? Array The rules that change the data, applied in order. Default: []

Inputs: input (Input).

Outputs: output (Output).

This component allows you to set/modify/move/remove properties of the incomming data.

For eaxample, to set the message data to a string Hello world select Message data in the rule dropdown and leave the text field empty.

Then in the bellow dropdown select string and enter the desired string in the text field.

Result:

  • before: $.data -> 'Hello world'
  • after: $.data -> 'New string'

Expression

Available params are: data, repo, variables ,variables2

Where data is message.data, repo is message.repo --> Documentation

And variables are local variables which can be set in the Variables dialog accessible on the main toolbar(the button between Plus icon and Bug icon)

For example, we want message data to be the value of (data.value + variables.offset)

Result:

  • before: $.data --> { value: 100 } / variables --> { offset: 20, ... many other properties }
  • after: $.data -> { value: 120 }

The expression: data.value + variables.offset

Important

  • Remove -> Message data / Message repo -> <empty path> will set Message data / Message repo to null;
  • Remove -> Local variables / Global variables -> <empty path> will be ignored but Remove -> Local variables / Global variables -> myVar will work.
  • Set -> Message data -> some.path to: Message data -> some.other.path will add another property to the incoming data and rest of the data will remain untouched
  • Set -> Message data -> <empty path> to: Message data -> some.path will essentialy overwrite the incomming data, after this there's no longer access to original data(same goes for repo)
component

print.html · version 9

Prints incoming data in JSON format on the node.
ParameterTypeDescription
repo? Boolean Shows repository. Default: false
data? Boolean Shows data. Default: true
once? Boolean Print the data once as an example. Default: false
length? Number
  1. length.
Default: 0
color? String Color.

Inputs: input (Input).

Outputs: none.

The component prints incoming data in a JSON format.

component

printhtml.html · version 2

Renders incoming data as HTML on the node.
ParameterTypeDescription
template? String The HTML template. Default: <b>{{ value }}</b>

Inputs: input (Input).

Outputs: none.

The component converts HTML-formatted data in the component body. You can easily visualise any data. The data is rendered on the server.

component

printjson.html · version 2

Prints incoming data in JSON format.
ParameterTypeDescription
repo? Boolean Shows repository. Default: false
data? Boolean Shows data. Default: true

Inputs: input (Input).

Outputs: none.

The component prints incoming data in a JSON format.

component

printtext.html · version 1

Prints incoming data as plain text.
ParameterTypeDescription
path? String Path. Default: response

Inputs: input (Input).

Outputs: none.

The component prints text as plain text format.

component

secrets.html · version 1

Creates secret variables from the incoming data.

Inputs: input (Input).

Outputs: none.

The component creates secret variables from the input message data. You can read data easily via {key} in the component's settings. Keys and their values must be of String type.

{
    key1: value1,
    key2: value2,
    keyN: valueN
}
component

sendandwait.html · version 1

Sends the data and then waits for a set time.
ParameterTypeDescription
timeout? Number Interval. Default: 1

Inputs: input (Input).

Outputs: output (Output).

This component sends the data next, and then waits for a defined period.

component

stepper.html · version 1

Holds incoming messages until you release them.

Inputs: input (Input).

Outputs: output (Output).

The component postpones incoming messages. Releasing messages must be done by hand.

component

stringoperations.html · version 1

Applies string operations to the incoming data.
ParameterTypeDescription
operation? String Operation. One of: capitalize (Capitalize), lowercase (Lower Case), uppercase (Upper Case), slug (Slug), deburr (Remove diacritic), reverse (Reverse), spaces (Remove spaces). Default: lowercase

Inputs: input (Input).

Outputs: output (Output).

This components can apply string operation to your components.

  • input: String
  • output: String
component

switch.html · version 4

Sends each message to the output of the first condition it meets.
ParameterTypeDescription
conditions? Array The conditions. Each condition has its own output, in the same order. Default: [{"operator":"eq","value":"Hello world","type":"string"}]

Inputs: input (Input).

Outputs: output1 (Output #1); more come from the settings of the node.

Source and Path

Use the Source dropdown to select where to look for the value to use in the conditions check.

Set a Path if the value is not the data itself. It supports dot notation: position.longitude or sensor.0.value for arrays, it does not support sensor[0].value.

Expression supports javascript syntax. Should return a value which will be used in condition check as data. Available variables: data, repo, variables, variables2

Expressions example:

data.value - variables.offset

Conditions

Each of the Conditions corresponds to an output in the exact same order. First condition -> First output.

Operator

Not all operators work on all data types. For example it is not possible to use > or < for strings, etc.

index of only works for data of type array or string.

Expression operator

In this case the type field is ignored and the expression in the value field must return true or false. Available variables: data, repo, variables, variables2.

Expressions operator example:

data.value > variables.threshold;

or with a conditions

if (typeof data.value !== 'number') return false; else return data.value > parseInt(variables.threshold);

Expression type

The expression in the value field must return a value which will be used in the given operation. Available variables: data, repo, variables, variables2.

Expressions example:

data.value - variables.offset

Between operator only works with datatype number and the value must be two comma separated values. e.g.: 2,4 so the condition becomes val > 2 && val < 4

component

telemetry.html · version 4

Shows values of the incoming data in a template on the node.
ParameterTypeDescription
paths? Object Properties to show in the template. Default: {}
interval? Object Update interval (in ms). Default: null
format? String Date format. Default: dd.MM.yyyy HH:mm:ss
extend? String Extend previous data?

Inputs: input (Input).

Outputs: none.

The component shows data in a template.

Hovering over the value shows the last update time.

Assuming this incomming data:

{
    speed: 1,
    nested: { value: 2 },
    array: [{ value: 3 }]
}

The paths bust be defined as:

speed         // -> 1
nested.value  // -> 2
array.0.value // -> 3
component

teleport.html · version 3

Moves a message to another Teleport component without a connection.
ParameterTypeDescription
name? String Name.
color? String Color. Default: #B9261A

Inputs: they come from the settings of the node.

Outputs: they come from the settings of the node.

The component can teleport (input) message to another teleport (output) component.

component

textenricher.html · version 1

Fills a text template with values from the incoming data.
ParameterTypeDescription
prop? String Read. Default: content
text? String Text. Default: {value}
path? String Write. Default: content

Inputs: input (Input).

Outputs: output (Output).

This component enriches a text property according to the template defined in the configuration. The {value} placeholder is replaced with the corresponding value from the payload.

component

throttle.html · version 1

Sends only a limited number of messages.
ParameterTypeDescription
limit? Number Limit. Default: 1
delay? Number Delay (milliseconds). Default: 0

Inputs: input (Input).

Outputs: output (Outputs).

The component sends only limited count of messages.

component

transform.html · version 1

Sends data to a transform output and continues with the answer.
ParameterTypeDescription
path? String Transform value according to this path.
assign? String Assign response to the path.

Inputs: input (Input).

Outputs: transform (Transform), output (Output).

This component can transform message data.

component

transformer.html · version 1

Changes incoming data with your own code.
ParameterTypeDescription
code? String The JavaScript code that changes the data. Default: data.name = data.name.toUpperCase()
clear? Boolean Clear repository object. Default: false

Inputs: input (Input).

Outputs: output (Output).

With this component you can easily modify incoming data. Then the data content is delivered. For storing temporary/persistent data you can use repo {Object} and refs {Object} variables.

Example 1:

// "data" is a reference to message data
data.name = data.name.toUpperCase();

Example 2:

data = data.toUpperCase();

Example 3:

var tmp = data;
data = {};
data.name = tmp.Name;
component

urldownload.html · version 2

Downloads the content of a URL address.
ParameterTypeDescription
prop? String URL address property. Default: url
path? String Save response to. Default: response

Inputs: input (Input).

Outputs: output (Output), error (Error).

The component downloads content from the given URL.

Payload:

https://www.totaljs.com

or

{
    url: 'https://www.totaljs.com'
}
component

xmlparser.html · version 1

Parses XML from a string.

Inputs: input (Input).

Outputs: output (Output), error (Error).

Parse XML from string.

  • Input: {String}
  • Ouput: {String}
Made in Europe