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