Code Monkey home page Code Monkey logo

storage-bot's Introduction

Table of Contents

About

This is an easy to use Slack App for downloading all messages in public channels of your Slack workspaces. This Slack App or Storage Bot as I like to call it, will store all messages in all public channels along with pertinent information such as timestamps and message sender. We accomplish this by utilizing Slack's SDK Bolt to extract conversation information and store them accordingly to a database of choice. You will need Admin access to add the Slack App to the Slack workspace.

Installation

  1. Clone this repo and run npm i

  2. Create Slack App

  3. Select "From an app manifest"

  4. Pick the workspace you want to use storage -bot

  5. Paste YAML code

    Click to expand

    YAML code

    display_information:
      name: storage
    features:
      bot_user:
        display_name: storage
        always_online: false
    oauth_config:
      scopes:
        bot:
          - app_mentions:read
          - channels:history
          - channels:read
          - chat:write
          - commands
          - im:history
          - im:read
          - im:write
          - users:read
    settings:
      event_subscriptions:
        bot_events:
          - message.im
      interactivity:
        is_enabled: true
      org_deploy_enabled: false
      socket_mode_enabled: true
      token_rotation_enabled: false
  6. Create App

  7. In "Basic Information", scroll down to "App-Level Tokens" and generate a token with scope "connections: write" and "authorization:read". You can name the token whatever you like - for example, test. Copy the generated token (starts with xapp)

  8. Create a .env file at root and set APP_TOKEN = xapp token from the previous step.

  9. Scroll up to "App Credentials". There will be a field called Signing Secret. Copy this token and in your .env file, set SLACK_SIGNING_SECRET = your Signing Secret.

  10. Under "Settings", click on "Install App". Once installed, you will be given a Bot User OAuth Token. In your .env file, set SLACK_BOT_TOKEN = Bot User OAuth Token (this token starts with xoxb)

  11. In the .env file set your URI = to the URI of whichever postgres you are using

    Expand for PostgreSQL setup example using ElephantSQL
  12. Invite Storage bot to the channels that you want to store the conversation histories of by using the slash command /invite in each of those channels

How to use

After you have setup the bot on Slack App, installed the Slack App into the workspace and setup the database, you can now run your bot. You will do this by messaging the bot (in this case storage bot) your commands. You will need to enter the following commands in order.

Channel ID

channel ids
  • retrieves unique id of every public channel in Slack workspace and stores them in an array

Channel Name

channel names
  • stores channel name, id and relevant information in channel table

User ID

user id
  • stores user id information such as alias and timezone in userid table

Conversations

all conversations
  • stores all conversations in every channel that the bot is in and other information such as username, channel name and date in conversation table

Timestamps

conversation timestamp
  • stores timestamp information for each conversation such as day, month, year, minute, sec, hour in timestamp table

storage-bot's People

Contributors

micjun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.