Send the error to discord ( discord) - failure module
One script reply has been approved by the moderators Verified

Created by rubenfiszel 59 days ago Viewed 54 times 1 Point

Send the error to a discord webhook channel

No comments yet

Login to be able to comment
Points: 0
deno
One script reply has been approved by the moderators
Ap­pro­ved
import discordwebhook from "https://deno.land/x/discordwebhook/mod.ts";
import type { Resource } from 'https://deno.land/x/windmill@v1.70.1/mod.ts'

export async function main(discord_webhook: Resource<'discord_webhook'>, message: string, name: string) {
    const flow_id = Deno.env.get("WM_FLOW_JOB_ID")
    message = `Flow [${flow_id}](${Deno.env.get("WM_BASE_URL")}/run/${flow_id}?workspace=${Deno.env.get("WM_WORKSPACE")}) had an error:\n${name}: ${message}`
    const webhook = new discordwebhook(discord_webhook.webhook_url);
    const ret = await webhook.createMessage(message);
    return ret;
}

Submitted by rubenfiszel 59 days ago

Edited 27 days ago

No comments yet

Login to be able to comment