slack-api

Archive slack channels after 4 months of the last msg in channel


I am looking for a way to archive slack channels after 4 months of the last msg in channel.

I have look at the apps in the store and the functions slack has. There wasn't a solution for my request. I need to make it myself but not sure if i need to make a bot or app with api.

The idea is when a channel name has extensions say proj- in the name and the last msg in that channel is 4 months old. This channel need to be archive.


Solution

  • I use this: https://github.com/Symantec/slack-autoarchive

    I created a short bash script to call the slack-autoarchive.py script and then called that from a cron job once a day:

    export SLACK_TOKEN=[my token]
    export WHITELIST_KEYWORDS="bicycles,codecoverage,kernel,storage"
    export DRY_RUN=false
    export ADMIN_CHANNEL=general
    export DAYS_INACTIVE=120
    
    cd ~/Programs/Symantec/slack-autoarchive
    echo ==========================================
    date
    PYTHONIOENCODING=UTF-8 python slack-autoarchive.py
    echo 'Done!'