DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Enterprise AI Trend Report: Gain insights on ethical AI, MLOps, generative AI, large language models, and much more.

2024 Cloud survey: Share your insights on microservices, containers, K8s, CI/CD, and DevOps (+ enter a $750 raffle!) for our Trend Reports.

PostgreSQL: Learn about the open-source RDBMS' advanced capabilities, core components, common commands and functions, and general DBA tasks.

AI Automation Essentials. Check out the latest Refcard on all things AI automation, including model training, data security, and more.

Related

  • Empowering Developers Through Collaborative Vulnerability Management: Insights From VulnCon 2024
  • An Explanation of Jenkins Architecture
  • API Appliance for Extreme Agility and Simplicity
  • Setup With Pritunl

Trending

  • The Power of Generative AI: How It Is Revolutionizing Business Process Automation
  • Deploying Heroku Apps To Staging and Production Environments With GitLab CI/CD
  • The Data Streaming Landscape 2024
  • 10 Tips To Improve Python Coding Skills in 2024
  1. DZone
  2. Popular
  3. Open Source
  4. How to Save and Search Your (Free-Tier) Slack History

How to Save and Search Your (Free-Tier) Slack History

Keep your messages around!

By 
John Lafleur user avatar
John Lafleur
·
Feb. 24, 21 · Tutorial
Like (5)
Save
Tweet
Share
2.9K Views

Join the DZone community and get the full member experience.

Join For Free

The Slack free tier saves only the last 10K messages. For social Slack instances, it may be impractical to upgrade to a paid plan to retain these messages. Similarly, for an open-source project like Airbyte where we interact with our community through a public Slack instance, the cost of paying for a seat for every Slack member is prohibitive.

However, searching through old messages can be really helpful. Losing that history feels like some advanced form of memory loss. What was that joke about Java 8 Streams? This contributor question sounds familiar—haven't we seen it before? But you just can't remember!

This tutorial will show you how you can, for free, use Airbyte to save these messages (even after Slack removes access to them). It will also provide you a convenient way to search through them.

Specifically, we will export messages from your Slack instance into an open-source search engine called MeiliSearch. We will be focusing on getting this setup running from your local workstation. We will mention at the end how you can set up a more productionized version of this pipeline.

We want to make this process easy, so while we will link to some external documentation for further exploration, we will provide all the instructions you need here to get this up and running.

1. Set Up MeiliSearch

First, let's get MeiliSearch running on our workstation. MeiliSearch has extensive docs for getting started. For this tutorial, however, we will give you all the instructions you need to set up MeiliSearch using Docker.

Shell
 




x
9


 
1
  docker run -it --rm \
2
 
3
    -p 7700:7700 \
4

          
5
    -v $(pwd)/data.ms:/data.ms \
6

          
7
    getmeili/meilisearch
8
 


That's it!

MeiliSearch stores data in $(pwd)/data.ms, so if you prefer to store it somewhere else, just adjust this path.

2. Replicate Your Slack Messages to MeiliSearch

a. Set Up Airbyte

Make sure you have Docker and Docker Compose installed. If you haven’t set Docker up, follow the instructions here to set it up on your machine. Then, run the following commands:

Shell
 




x
7


 
1
git clone https://github.com/airbytehq/airbyte.git
2
 
3
cd airbyte
4
 
5
docker-compose up


If you run into any problems, feel free to check out our more extensive getting started for more help.

Once you see an Airbyte banner, the UI is ready to go at http://localhost:8000/. Once you have set your user preferences, you will be brought to a page that asks you to set up a source. In the next step, we'll go over how to do that.

b. Set Up Airbyte’s Slack Source Connector

In the Airbyte UI, select Slack from the dropdown. We provide step-by-step instructions for setting up the Slack source in Airbyte here. These will walk you through how to complete the form on this page.


By the end of these instructions, you should have created a Slack source in the Airbyte UI. For now, just add your Slack app to a single public channel (you can add it to more channels later). Only messages from that channel will be replicated.

The Airbyte app will now prompt you to set up a destination. Next, we will walk through how to set up MeiliSearch.

c. Set Up Airbyte’s MeiliSearch Destination Connector

Head back to the Airbyte UI. It should still be prompting you to set up a destination. Select "MeiliSearch" from the dropdown. For the host field, set: http://localhost:7700. The api_key can be left blank.

d. Set Up the Replication

On the next page, you will be asked to select which streams of data you'd like to replicate. We recommend unchecking "files" and "remote files" since you won't really be able to search them easily in this search engine.


For frequency, we recommend every 24 hours.

3. Search MeiliSearch

After the connection has been saved, Airbyte should start replicating the data immediately. When it completes you should see the following:

When the sync is done, you can sanity check that this is all working by making a search request to MeiliSearch. Replication can take several minutes depending on the size of your Slack instance.

Shell
 




xxxxxxxxxx
1


 
1
curl 'http://localhost:7700/indexes/messages/search' --data '{ "q": "<search-term>" }'


For example, I have the following message in one of the messages that I replicated: "welcome to airbyte"

Shell
 




xxxxxxxxxx
1


 
1
curl 'http://localhost:7700/indexes/messages/search' --data '{ "q": "welcome to" }'
2

          
3
  # => {"hits":[{"_ab_pk":"7ff9a858_6959_45e7_ad6b_16f9e0e91098","channel_id":"C01M2UUP87P","client_msg_id":"77022f01-3846-4b9d-a6d3-120a26b2c2ac","type":"message","text":"welcome to airbyte.","user":"U01AS8LGX41","ts":"2021-02-05T17:26:01.000000Z","team":"T01AB4DDR2N","blocks":[{"type":"rich_text"}],"file_ids":[],"thread_ts":"1612545961.000800"}],"offset":0,"limit":20,"nbHits":2,"exhaustiveNbHits":false,"processingTimeMs":21,"query":"test-72"}


4. Search via a UI

Making curl requests to search your Slack History is a little clunky, so we have modified the example UI that MeiliSearch provides in their docs to search through the Slack results.

Download (or copy and paste) this HTML file to your workstation. Then, open it using a browser. You should now be able to write search terms in the search bar and get results instantly!


5. "Productionizing" Saving Slack History

You can find instructions for how to host Airbyte on various cloud platforms here.

Documentation on how to host MeiliSearch on cloud platforms can be found here.

If you want to use the UI mentioned in the section above, we recommend statically hosting it on S3, GCS, or equivalent.

Slack (software) History (command) Open source

Published at DZone with permission of John Lafleur. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Empowering Developers Through Collaborative Vulnerability Management: Insights From VulnCon 2024
  • An Explanation of Jenkins Architecture
  • API Appliance for Extreme Agility and Simplicity
  • Setup With Pritunl

Partner Resources


Comments

ABOUT US

  • About DZone
  • Send feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: