export async function main(
workspace_id: string,
job_id: string, // The UUID of the job that errored
path: string, // The path of the script or flow that errored
is_flow: boolean, // Whether the runnable is a flow
error: object, // The error details
started_at: string, // The start datetime of the latest job that failed
trigger_path?: string, // The path of the trigger that errored in the format <trigger_type>/<trigger_path>
) {
const baseUrl = process.env["BASE_INTERNAL_URL"];
const token = process.env["WM_TOKEN"]
const fullUrl = `${baseUrl}/send_email_with_instance_smtp/${workspace_id}`
const body = JSON.stringify({ workspace_id, job_id, is_flow, error, started_at, path, trigger_path })
try {
await fetch(fullUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${token}`
},
body
})
} catch (error) {
console.error(`Error: ${error}`)
}
}Submitted by dieriba.pro916 406 days ago