1
import { WebClient } from "https://deno.land/x/[email protected]/mod.ts";
2
3
type Slack = {
4
token: string;
5
};
6
export async function main(
7
message: string,
8
name: string,
9
channel: string,
10
slack: Slack,
11
) {
12
const web = new WebClient(slack.token);
13
const flow_id = Deno.env.get("WM_FLOW_JOB_ID");
14
const text = (message = `Flow [${flow_id}](${Deno.env.get(
15
"WM_BASE_URL",
16
)}/run/${flow_id}?workspace=${Deno.env.get(
17
"WM_WORKSPACE",
18
)}) had an error:\n${name}: ${message}`);
19
await web.chat.postMessage({
20
channel,
21
text,
22
});
23
return { message, flow_id };
24
}
25