Make your notification standardized with a common format
const standardNotifier = require('./notification-standardizer');
const input = {
'agentId': agentId, // agentId is unique for each project
'agentName': agentName, // the project name or application's name
'scriptOrg': scriptOrg, // the project code name (eg: 'phantombuster', 'botscrapper', 'instagram-scraper')
'runDuration': runDuration, // run duration in milliseconds
'resultObject': resultObject, // string with the response payload
'exitMessage': exitMessage, // the reason why the agent ended ("finished"|"killed"|"global timeout"|"org timeout"|"agent timeout"|"unknown")
'exitCode': exitCode // 1 on error 0 on success
};
const jsonObject = standardNotifier.generateJsonObjectAndSendWebhook(input);