📜 ⬆️ ⬇️

How to deploy for your team an archive of slack messages with synchronization and search

I myself am a supporter of the idea that if you like a product, then you need to buy it and with your money support programmers.
But sometimes it happens that the company cannot spend money on this software or does not want to. It is especially difficult to pay from $ 100 per month when there are free analogues or if the chats are used for non-commercial purposes.

I will describe how you can deploy a service to store the history of all your team’s public posts on slack and get rid of the main, unpleasant, sometimes disruptive restrictions - up to 10k of your team’s most recent messages (you can only search and search among 10,000 recent messages)

Among the ready-made solutions are:


In more detail I will tell about the last decision, I liked it the most.
')
As you can easily see, the main idea belongs to Lê Việt Hồng ( github.com/suoinguon ) I took his decision as a basis and began to add various features there.
Since this is a regular Django application, then adding new features there was very easy to add.

Compared with the original now appeared:


Among the further plans I would like to note:


Server creation


And now to the point, let's unfold this project.
First we need a virtual server. For small teams, a minimal configuration will suffice.

For example, what can be launched quickly and cheaply:
vscale.io


www.digitalocean.com


aws.amazon.com/ru/ec2

(if registering first
since the first year of one car will be free)

$ 0.0065 per hour
512mb
1 vcpu
Exbs disk


Total, you can get a separate server for 200 rubles per month or even free of charge for the first time.
I checked the script for Centos7 so when creating it, select it, find out its ip address or domain name and remember them, they will be required at the next step.

Register slack application



Next, we need to register the slack application to access the API.

  1. Go to api.slack.com/applications
  2. Create a new application


  3. Add the address of the newly created server to oauth redirects


  4. We keep Client ID and Client Secret




Run the application


  1. Connect via ssh to server
  2. Run the command
  3. curl -O https://raw.githubusercontent.com/menemy/slack-backup/master/provisioning_on_centos7.sh 
  4. Fix three settings at the beginning of the script.
  5. SLACK_CLIENT_ID = [your_client_id]
  6. SLACK_CLIENT_SECRET = [your_client_secret]
  7. DOMAIN = [your_domain]
  8. We fix the rights and run
  9. chmod 777 provisioning_on_amazonlinux.sh
  10. sudo ./provisioning_on_amazonlinux.sh
  11. Everything, after that the application is launched and available at your address, the history is synchronized every five minutes
  12. You need to go to the site and provide access to your slack account.


Optionally, restore message history


If you find out about this decision late - it does not matter, slack actually continues to store your history and allows you to upload the entire history as a zip archive.
But this is only for administrators group.

  1. Go to my.slack.com/services/export
  2. Create unload
  3. Wait for the end
  4. Reload the page and download the zip file
  5. Upload the file to the server and upload it to the / usr / local / src / slack-backup / full_history / folder
  6. Run the python command /usr/local/src/slack-backup/manage.py restore_backup
  7. Wait until the end, it may take time.




I would be glad if my efforts would be helpful. If you have questions about the work or need help with the installation I will be happy to help in the comments.

Source: https://habr.com/ru/post/313972/


All Articles