Skip to content

botnikstudios/slack-archive-bot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slack ArchiveBot

A bot that can search your slack message history. Makes it possible to search further back than 10,000 messages.

Installation

  1. Clone this repo.

  2. Install the requirements:

     pip install -r requirements.txt
    
  3. Export your team's slack history. Download the archive and export it to a directory. Then run import_archive.py on the directory. For example:

     python import_archive.py export
    

    This will create a file slack.sqlite.

  4. Create a new bot user on your slack channel and get the API key. Start the bot with:

     export BOT_DI=<BOT_ID> BOT_CHANNEL_ID=<BOT_CHANNEL_ID> SLACK_API_TOKEN=<API_TOKEN> && python archivebot.py
    

    Where API_TOKEN is the token you got when creating the bot user.

    Alternatively, when running on a server, to make sure archivebot keeps running after logging out, use:

    BOT_ID=<BOT_ID> BOT_CHANNEL_ID=<BOT_CHANNEL_ID> SLACK_API_TOKEN=<API_TOKEN> nohup python archivebot.py &

See ./nohup.out for output. Kill the process with kill <pid>

Archiving New Messages

When running, ArchiveBot will continue to archive new messages for any channel it is invited to. To add the bot to your channels:

    /invite @ArchiveBot

If @ArchiveBot is the name you gave you bot user.

Searching

To search the archive, direct message (DM) @ArchiveBot with the search query. For example, sending the word "pizza" will return the first 10 messages that contain the word "pizza". There are a number of parameters that can be provided to the query. The full usage is:

    <query> from:<user> in:<channel> sort:asc|desc limit:<number>

    query: The text to search for.
    user: If you want to limit the search to one user, the username.
    channel: If you want to limit the search to one channel, the channel name.
    sort: Either asc if you want to search starting with the oldest messages,
        or desc if you want to start from the newest. Default asc.
    limit: The number of responses to return. Default 10.

Contributing

Contributions are more than welcome. From bugs to new features. I threw this together to meet my team's needs, but there's plenty I've overlooked.

License

Code released under the MIT license.

About

A bot that will archive your slack messages and make them searchable. No more 10,000 message search limit.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%