A Slack Bot to clear slack storage space of images
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.
:cross:
to delete the message.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
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.
<base-url>/app
to event subscriptions, and add file_shared
and reaction_added
to Subscribe bot Events.channels:history
,chat:write
,files:read
,files:write
,groups:history
,incoming-webhook
and reactions:read
to Bot Token scope.channels:history
,files:read
,files:write
,chat:write
and groups:history
to user token scopes.<base-url>/activity-route
to interactivity to subscribe for button presses./app
- the base route for event subscription endpoint.
/activity-route
- route for handling user activity through buttons.
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 😄