Delete Message

Script slack Verified

by aureliejagg29 ยท 6/6/2022

The script

Submitted by hugo989 Bun
Verified 5 days ago
1
import { WebClient } from "@slack/web-api";
2
/*
3
@param: {string} channel - Channel containing the message to be deleted.
4
@param: {string} timestamp - Timestamp of the message to be deleted.
5
*/
6

7
type Slack = {
8
  token: string;
9
};
10
export async function main(
11
  slack_auth: Slack,
12
  channel: string,
13
  timestamp: string
14
) {
15
  const web = new WebClient(slack_auth.token);
16

17
  let response = await web.chat.delete({
18
    channel: channel,
19
    ts: timestamp,
20
  });
21

22
  return { response: response };
23
}
24

Other submissions
  • Submitted by rossmccrann Deno
    Created 383 days ago
    1
    import { WebClient } from "https://deno.land/x/[email protected]/mod.ts";
    2
    /*
    3
    @param: {string} channel - Channel containing the message to be deleted.
    4
    @param: {string} timestamp - Timestamp of the message to be deleted.
    5
    */
    6
    
    
    7
    type Slack = {
    8
      token: string;
    9
    };
    10
    export async function main(
    11
      slack_auth: Slack,
    12
      channel: string,
    13
      timestamp: string
    14
    ) {
    15
      const web = new WebClient(slack_auth.token);
    16
    
    
    17
      let response = await web.chat.delete({
    18
        channel: channel,
    19
        ts: timestamp,
    20
      });
    21
    
    
    22
      return { response: response };
    23
    }
    24