Giter Site home page Giter Site logo

slack-bot-list's Introduction

slack-bot-list

Goal

The goal of this repo is to be a boilerplate for anyone who would like to deploy a simple slack list bot to AWS and set it up with Slack.

With this app, we want to:

  • Persist a multiple list database
  • Support following commands:
    • Show list
    • Add to list
    • Remove from list
    • Clear list
    • Help with list commands
  • Create an endpoint to manage the list in the cloud
  • Create a slack command to help teams create/maintain lists

What you'll need

Before you get started, make sure you have access to the following

Get started

Install dependencies

Ensure your node version is v14.x or above

$ yarn install

Initialize Serverless

After you create your Serverless account, with the command below you'll be asked to login

$ yarn serverless

Install local Dynamodb database

You may need to install Java SE8 for local dynamodb to work

$ yarn serverless dynamodb install

Spin up local server with a fresh database

$ yarn start

Setup with Slack

AWS Credentials

Follow this great serverless article to help you get your AWS credentials

Deploy with Serverless

All you need to do now is to deploy with serverless, and it handles the rest! Database and lambdas will be created for you and you'll get API endpoints!

$ yarn serverless deploy

Slack

Now the fun part!

Now that you have an endpoint, we'll now create a Slack App. First you will go to https://api.slack.com/apps/ and click on Create New App select "From an app manifest". It's in beta but should work just fine.

Copy and paste the below manifest into the step where it asks for it. (Be sure to fill in the missing data)

{
    "_metadata": {
        "major_version": 1,
        "minor_version": 1
    },
    "display_information": {
        "name": "Lists"
    },
    "features": {
        "bot_user": {
            "display_name": "MyBot",
            "always_online": false
        },
        "slash_commands": [
            {
                "command": "/list",
                "url": "<YOUR_NEW_ENDPOINT_HERE>",
                "description": "Create list of items (todos, topics, etc)",
                "usage_hint": "help",
                "should_escape": false
            }
        ]
    },
    "oauth_config": {
        "scopes": {
            "bot": [
                "commands"
            ]
        }
    },
    "settings": {
        "org_deploy_enabled": false,
        "socket_mode_enabled": false,
        "token_rotation_enabled": false
    }
}

Once the app is created, all that is left is to install the app into your workspace (should be prompted for this after wizard).

All Done!

Now you should be able to go into any channel and send the following message:

/list show

🥳🥳🥳

slack-bot-list's People

Contributors

pnarielwala 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.