0

Delete File

by
Published today

Delete a file by ID.

Script slack Verified

The script

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

3
/**
4
 * Delete File
5
 * Delete a file by ID. A bot token can delete only files it uploaded; a user token deletes the user's own files (admins: any). Needs files:write (bot default; tick it for a user token).
6
 */
7
export async function main(auth: RT.Slack, file: string) {
8
  const client = new WebClient(auth.token)
9
  return await client.files.delete({ file })
10
}
11