Giter Site home page Giter Site logo

slack-todo-bot's Introduction

Setup dev environment

Setup your local machine

  1. Install dependencies
    yarn install
    
  2. Create a folder to store secrets locally, also create the file to store environment variables
    mkdir secrets
    touch secrets/dev.env
    
  3. Setup ngrok
    1. Sign up in ngrok website: https://ngrok.com
    2. Install ngrok binary on Mac
      brew install ngrok/ngrok/ngrok
      
    3. Run ngrok to point to your local Node.js port, it's usually port 3000
      ngrok http 3000
      

Configure Slack

  1. Head to https://api.slack.com/apps
  2. Click "Create New App".
  3. Go to "OAuth & Permissions", click "Add an OAuth Scope", select "chat:write" and click "Save".
  4. Click "Create Bot Token".
  5. Copy the "Bot User OAuth Token" value and paste it in local file named secrets/dev.env. Please the value in the file in this format without the '<>' characters.
    SLACK_BOT_TOKEN=<THE_TOKEN_VALUE>
    
  6. Go to "Basic Information", copy the "Signing Secret" value. Paste it in the "secrets/dev.env" file without the '<>' characters.
    SLACK_SIGNING_SECRET=<THE_SIGNING_SECRET>
    
  7. Go to "App Manifest", make sure to select the YAML section, paste the content of your local slack-app-manifest.yml. Replace https://8113-5-254-162-15.eu.ngrok.io with the your ngrok URL. Click "Save Changes".

Configure Cloud Firestore

  1. Sign up for Firebase
  2. Create a new Firestore project
  3. In the Firebase console, open Project Settings > Service Accounts > Firebase Admin SDK.
  4. Click "Generate New Private Key", then confirm by clicking "Generate Key".
  5. Save the key file into secrets/ folder that you've created.
  6. Add a new environment variable in secrets/dev.env to point to the key file. Note, the value must be in absolute path.
    GOOGLE_APPLICATION_CREDENTIALS=/Users/kevin/GitHub/slack-todo-bot/secrets/firebaseAccountKey.json
    

Reference:

Finally

  1. Run the bot
    yarn dev
    

How to use?

You can use this slack bot with Slack commands in any channel or message. Supported Slack commands are:

  • /todo-i
  • /todo-add SOME_NEW_TODO_CONTENT
  • /todo-list <all | open | done>
  • /todo-done TODO_ITEM_ID
  • /todo-delete TODO_ITEM_ID

Alternatively, you can use it from "App Home". Just select "slack-todo-bot" in the sidebar.

Known issues

  • Cannot re-open a completed TODO item
  • Cannot edit the content of TODO item
  • Cannot delete the TODO item with UI, though you can delete with command /todo-delete
  • /todo-list command displays checkboxes in the message. User can check off the TODO item, but it will not update the item with a strike line
  • UI / command callbacks are mis-placed in views module. They should be in separate "middleware" modules.
  • Unit tests are missing
  • Slack limits the number of checkboxes to 10 at a time, the workaround right now is to group 10 checkboxes as an element, but that causes an extra line spacing between the groups

slack-todo-bot's People

Contributors

kevinlsk avatar

Watchers

 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.