Building an App for Removing Multiple Slack's Files - The Koch Family
The Koch Family The Koch Family

Latest news

جاري التحميل ...

Building an App for Removing Multiple Slack's Files

You're a developer. What do you do in your spare time? One of my most excited task for sharpening my skills is starting build a pet project.

Motivation

Slack is cool! It's free. It supports for team collaboration very well.

However, my team only has storage limits due to a free account. We got a warning message as below:
Your file was uploaded — it’s safe and sound in Slack. Unfortunately your team doesn’t have any storage space left. To get more space, you can upgrade to a paid account or delete some of your older files.
Since my team plan of upgrading to a paid account is still up in the air, I intended to go with "deleting some of our older files" first. (But we will, Slack. You are great!)

Play Around

I got started by googling keyword "remove slack files". Here it is:
https://get.slack.help/hc/en-us/articles/218159688-Delete-shared-files

Uh huh! But I only could delete one file at a time.
We're afraid it's not possible to bulk delete files. We know that your business data is important to you — that's why we offer API methods to help you manage them.
How about removing the multiple files? Yeah! Slack is very cool again. They provide an API that I am able to bulk delete files:
https://api.slack.com/methods#files

Accordingly, I'm able to firstly call method "files.list" to obtain all files then I just need to loop the list to remove each file with method "file.delete".

Taking a look to the Slack API, I saw what I need to prepare is a "token" for building a very simple application.

In order to obtain a token, I just need to follow the following article. ;)
https://get.slack.help/hc/en-us/articles/215770388-Create-and-regenerate-API-tokens

Let's go! I have made a test method "files.list" with Postman. Woo hoo! It worked.

Get Down To It

Now, I easily could build a REST client app to achieve this goal. With Java, I used Jersey as REST client API. The following are my steps:

  1. Setup environment: Eclipse, Git, JDK, Maven, Tomcat.
  2. Build a JSF Maven-based app and run on Tomcat 8
  3. Write a service to call the methods needed "files.list" and "files.delete"
  4. Refactor and put to Github. ;)


This is just my first draft, I'm still on my way to improve it. Anybody who wants to join me, you're are very welcome. ;)

The source code is here: https://github.com/vnnvanhuong/slack_bulk_files_remover

Comments



If you like the content of our blog, we hope to stay in constant communication, just enter your email to subscribe to the blog's express mail to receive new blog updates, and you can send a message by clicking on the button next ...

إتصل بنا

About the site

author The Koch Family <<  Welcome! I'm so glad that you stopped by Your Modern Family blog. Together, we will talk about raising kids, organizing the home and saving money! and Tips & tricks and more…

< Learn more ←

Blog stats

Sparkline 2513183

All Copyrights Reserved

The Koch Family

2020