Skip to content

rajivharlalka/go-space

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation




Intro

Ever felt short of file storage while using slack? I (we at KOSS) did. So Dibya Das made Imagery.

So after tinkering around with Golang, wanted to learn by doing and Imagery had some issues due to some api changes on slack. So what could be better than re-writing the entire thing on go 🚀.

Go-space is a slack-bot which helps to free slack storage by uploading the image to imgur and replacing the image with the link. Just need to add him to the channel and you are good to go.

  • Currently supports only images
  • both private and public channels can be used on.
  • react the bots message with :cross: to delete the message.

Demo

demo

Installation

Using Docker

To create a docker file and push to dockerhub

git clone https://github.com/rajivharlalka/go-space.git
cd go-space
docker build -t <dockerhub-username>/go-space:v1 .
docker push <dockerhub-username>/go-space:v1

Run docker file

Environment Requirements

SLACKBOT_ACCESS_TOKEN=<BOT TOKEN>
SLACKUSER_ACCESS_TOKEN=<USER TOKEN>
IMGUR_CLIENT_ID=<KEY>

It runs on port 3000 inside docker, so that port has been exported.

docker run -dp 3000:3000 -e IMGUR_CLIENT_ID=<IMGUR_CLIENT_ID> -e SLACKBOT_AUTH_TOKEN=<SLACKBOT_AUTH_TOKEN> -e SLACKUSER_AUTH_TOKEN=<SLAKCUSER_AUTH_TOKEN> <DOCKERHUB-USERNAME>/imagery:v1

Now, configure the app on slack dev for permissions and webhooks.

  • Add <base-url>/app to event subscriptions, and add file_shared and reaction_added to Subscribe bot Events.
  • Add channels:history ,chat:write,files:read,files:write,groups:history,incoming-webhook and reactions:read to Bot Token scope.
  • Add channels:history,files:read,files:write,chat:write and groups:history to user token scopes.
  • Add <base-url>/activity-route to interactivity to subscribe for button presses.

Usage

API Endpoints

/app - the base route for event subscription endpoint.
/activity-route - route for handling user activity through buttons.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Thanks to Chirag Ghosh for helping me out in completing this 😄

License

MIT

About

A Slack Bot to clear slack storage space of images

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published