Send Message to Channel

slack

Script slack Verified

by admin ยท 7/28/2022

The script

Submitted by hugo989 Bun
Verified 2 days ago
1
import { WebClient } from "@slack/web-api";
2

3
type Slack = {
4
  token: string;
5
};
6
export async function main(text: string, channel: string, slack: Slack) {
7
  const web = new WebClient(slack.token);
8

9
  await web.chat.postMessage({
10
    channel,
11
    text,
12
  });
13
}
14

Other submissions
  • Submitted by admin Deno
    Created 380 days ago
    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(text: string, channel: string, slack: Slack) {
    7
      const web = new WebClient(slack.token);
    8
    
    
    9
      await web.chat.postMessage({
    10
        channel,
    11
        text,
    12
      });
    13
    }
    14
    
    
  • Submitted by wangjian.cd865 Deno
    Created 1118 days ago
    1
    // import * as wmill from 'https://deno.land/x/windmill/index.ts'
    2
    
    
    3
    export async function main(x: string) {
    4
        return x
    5
    }
  • Submitted by choonfeng.sng05571 Deno
    Created 981 days ago
    1
    // import * as wmill from 'https://deno.land/x/windmill/index.ts'
    2
    
    
    3
    export async function main(x: string) {
    4
        return x
    5
    }