Files
Superalgos/Integrations/Projects/Superalgos/Function-Libraries/WebhookFunctions.js
T
2020-11-20 14:17:04 +01:00

23 lines
784 B
JavaScript

function newSuperalgosFunctionLibraryWebhookFunctions() {
thisObject = {
sendTestMessage: sendTestMessage
}
return thisObject
function sendTestMessage(node, callBackFunction) {
let testMessage = UI.projects.superalgos.utilities.nodeConfig.loadPropertyFromNodeConfig(node.payload, 'testMessage')
let letURL = UI.projects.superalgos.utilities.nodeConfig.loadPropertyFromNodeConfig(node.payload, 'webhookURL')
httpRequest(testMessage, letURL, onResponse)
function onResponse(err) {
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE)
} else {
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
}
}
}
}