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

Created by rubenfiszel 56 days ago Viewed 7555 times 0 Points

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 { WebClient } from "https://deno.land/x/slack_web_api@1.0.0/mod.ts";
import type { Resource } from "https://deno.land/x/windmill@v1.70.1/mod.ts";

export async function main(
  message: string,
  name: String,
  channel: string,
  slack: Resource<"slack">,
) {
  const web = new WebClient(slack.token);
  const flow_id = Deno.env.get("WM_FLOW_JOB_ID");
  const text = 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}`;
  await web.chat.postMessage({
    channel,
    text,
  });
  return { message, flow_id };
}

Submitted by rubenfiszel 56 days ago

Edited 27 days ago

No comments yet

Login to be able to comment