0
Ask channel for approval Approval
One script reply has been approved by the moderators Verified

Ask a whole channel for approval of a flow

Created by admin 703 days ago Viewed 17862 times
0
Submitted by admin Deno
Verified 703 days ago
1
import { getResumeUrls } from "https://deno.land/x/windmill@v1.85.0/mod.ts";
2
import { WebClient } from "https://deno.land/x/slack_web_api@1.0.3/mod.ts";
3

4
type Slack = {
5
  token: string;
6
};
7
export async function main(
8
  slack: Slack,
9
  channel: string,
10
  text = "A flow is requesting an approval to be resumed",
11
) {
12
  const web = new WebClient(slack.token);
13

14
  const { approvalPage } = await getResumeUrls(`channel-${channel}`);
15
  await web.chat.postMessage({
16
    channel,
17
    text: text + " <" + approvalPage + "|approval page>",
18
  });
19
}
20