Search... Ctrl + K

Send information about approved job to channel (slack)
One script reply has been approved by the moderators Verified

Created by mrl5 37 days ago Used 18 times 0 Points

This script can be used as a flow step that follows approval step

No comments yet

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.24.1/mod.ts";

export async function main(
  channel: string,
  slack: Resource<"slack">,
  approvers: string[],
) {
  const web = new WebClient(slack.token);
  const jobUrl = new URL(`/run/${Deno.env.get('WM_FLOW_JOB_ID')}`, Deno.env.get('WM_BASE_URL'));
  const text = `Flow job ${jobUrl} (${Deno.env.get('WM_FLOW_PATH')}) run by ${Deno.env.get(
    'WM_USERNAME',
  )} was approved by ${approvers.join(', ')}`

  await web.chat.postMessage({
    channel,
    text,
  });
}

Submitted by mrl5 37 days ago

Edited 37 days ago

No comments yet