|
|
|
@ -301,6 +301,7 @@ export async function invokeWebhook(
|
|
|
|
|
subject: parseBody(notification?.payload?.subject, newData), |
|
|
|
|
html: parseBody(notification?.payload?.body, newData), |
|
|
|
|
}); |
|
|
|
|
if (process.env.NC_AUTOMATION_LOG_LEVEL === 'ALL') { |
|
|
|
|
hookLog = { |
|
|
|
|
...hook, |
|
|
|
|
fk_hook_id: hook.id, |
|
|
|
@ -310,6 +311,7 @@ export async function invokeWebhook(
|
|
|
|
|
triggered_by: user?.email, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'URL': |
|
|
|
|
{ |
|
|
|
@ -323,6 +325,7 @@ export async function invokeWebhook(
|
|
|
|
|
newData |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (process.env.NC_AUTOMATION_LOG_LEVEL === 'ALL') { |
|
|
|
|
hookLog = { |
|
|
|
|
...hook, |
|
|
|
|
fk_hook_id: hook.id, |
|
|
|
@ -343,6 +346,7 @@ export async function invokeWebhook(
|
|
|
|
|
triggered_by: user?.email, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
{ |
|
|
|
@ -357,6 +361,7 @@ export async function invokeWebhook(
|
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (process.env.NC_AUTOMATION_LOG_LEVEL === 'ALL') { |
|
|
|
|
hookLog = { |
|
|
|
|
...hook, |
|
|
|
|
fk_hook_id: hook.id, |
|
|
|
@ -366,10 +371,12 @@ export async function invokeWebhook(
|
|
|
|
|
triggered_by: user?.email, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e); |
|
|
|
|
if (['ERROR', 'ALL'].includes(process.env.NC_AUTOMATION_LOG_LEVEL)) { |
|
|
|
|
hookLog = { |
|
|
|
|
...hook, |
|
|
|
|
type: notification.type, |
|
|
|
@ -380,6 +387,7 @@ export async function invokeWebhook(
|
|
|
|
|
error: JSON.stringify(e), |
|
|
|
|
triggered_by: user?.email, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
if (throwErrorOnFailure) throw e; |
|
|
|
|
} finally { |
|
|
|
|
if (hookLog) { |
|
|
|
|