| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | |
| 6 | "github.com/slack-go/slack" |
| 7 | ) |
| 8 | |
| 9 | func main() { |
| 10 | api := slack.New("YOUR_TOKEN_HERE") |
| 11 | params := slack.FileUploadParameters{ |
| 12 | Title: "Batman Example", |
| 13 | //Filetype: "txt", |
| 14 | File: "example.txt", |
| 15 | //Content: "Nan Nan Nan Nan Nan Nan Nan Nan Batman", |
| 16 | } |
| 17 | file, err := api.UploadFile(params) |
| 18 | if err != nil { |
| 19 | fmt.Printf("%s\n", err) |
| 20 | return |
| 21 | } |
| 22 | fmt.Printf("Name: %s, URL: %s\n", file.Name, file.URL) |
| 23 | |
| 24 | err = api.DeleteFile(file.ID) |
| 25 | if err != nil { |
| 26 | fmt.Printf("%s\n", err) |
| 27 | return |
| 28 | } |
| 29 | fmt.Printf("File %s deleted successfully.\n", file.Name) |
| 30 | } |