Skip to main content

03.05.3 Processing and Transforming Data from the Previous Node

export default async function run({execution_id, input, data}) {
// const - is the syntax for creating a constant
// SurName - the name of the constant
// data["{{1.body.Surname}}"] - the value of the constant. The expression is added automatically when you click on "SurName" in the Data window.
const SurName = data["{{1.body.Surname}}"];
const Name = data["{{1.body.Name}}"];
const FullName = Name +' '+ SurName;
const Email = data["{{1.body.Email}}"];
const LastAction = data["{{1.body.LastAction}}"];
const message = \`Hi, ${FullName}! The last time you visited Latenode ${LastAction}.\`;

// JSON assembly
const resultRawJSON = JSON.stringify({
"from_email": "[email protected]",
"to": Email,
"subject": "Latenode",
"text": message,
});

//Returning values
return {
resultRawJSON
}
}