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 1046 days ago Picked 3 times
Submitted by admin Deno
Verified 197 days ago
1
import { getResumeUrls } from "https://deno.land/x/[email protected]/mod.ts";
2
import { WebClient } from "https://deno.land/x/[email protected]/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