Example
Open URL in browser
http://localhost:3333/webhooks/order/234
This option allows custom javascript code execution.
For example this script will execute Advanced ETL Processor package
const execFileSync = require("child_process").execFileSync;
try {
// This script might hung so always specify a timeout
const fileToExecute = '"C:\\Program Files (x86)\\DB Software Laboratory\\Advanced ETL Processor Enterprise\\aetlcl.exe"';
const objectId = 6687;
const parameters = [objectId];
const timeout = 60; //seconds
const stdout = execFileSync(fileToExecute, parameters, { shell: true, timeout: timeout * 1000 });
} catch (e) {
logger.error(e.message);
return 500;
}
return 200;const fs = require("fs");
const { spawn } = require("child_process");
try {
const WORKING_DIRECTORY = "C:\\Program Files\\DB Software Laboratory\\Advanced ETL Processor Enterprise\\";
const fileToExecute = "C:\\Program Files\\DB Software Laboratory\\Advanced ETL Processor Enterprise\\aetlcl.exe";
const objectId = 8687;
const parameters = [objectId, logId];
logger.info(parameters);
spawn(fileToExecute, parameters, { cwd: WORKING_DIRECTORY, detached: true });
return 200;
} catch (err) {
logger.error(`Caught an error: ${err.message ? err.message : err}`);
return 500; // Any error caught here results in a 500 status
}begin
SetVariable('<EventId>',CommandLineParameter(2));
Result:=True;
end;const fs = require("fs");
const { spawn } = require("child_process");
try {
const WORKING_DIRECTORY = "C:\\Temp\\";
// Path to the JSON file
const jsonFilePath = `${WORKING_DIRECTORY}${logId}.json`;
const jsonString = JSON.stringify(body, null, 4);
// Write JSON data to a file
fs.writeFileSync(jsonFilePath, jsonString, "utf8");
logger.info(`File written successfully to: ${jsonFilePath}`);
// Python executable and parameters
const pythonExecutablePath = `python`; // Use 'python' from PATH
const parameters = ["test.py", jsonFilePath];
// Execute the Python script without waiting for completion within specified working directory
spawn(pythonExecutablePath, parameters, { cwd: WORKING_DIRECTORY, detached: true });
return 200;
} catch (err) {
logger.error(`Caught an error: ${err.message ? err.message : err}`);
return 500; // Any error caught here results in a 500 status
}logger.debug(logId);
logger.debug(method);
logger.debug(originalUrl);
logger.debug(JSON.stringify(body, null, 4));
logger.debug(JSON.stringify(headers, null, 4));
return 200;const data = {
token: "abc",
challenge: "123",
type: "url_verification",
};
res.status(200).json(data);
return -1;const dataSource = require("../../connection");
const rep = dataSource.getRepository("EventLog");
try {
const record = { char_field_03: "test" };
rep.update({ id: logId }, record);
return 200;
} catch (err) {
logger.error(`Caught an error: ${err.message ? err.message : err}`);
return 500; // Any error caught here results in a 500 status
}Confused? Ask question on our ETL Forum