Giter Club home page Giter Club logo

slackbot's Introduction

Slack Random Reviewer

A slack slash command for nominating a reviewer for a code review.

General Form:

/random-reviewer {list of names/slack usernames seperated by a comma or space or nothing for slack usernames} x{number of reviewers to select} for {link or extra info}

Note: x{number of reviewers to select} is optional

Note: for and the text following it is optional

Examples:

/random-reviewer Bob John Fred: No need to use slack usernames if you don't want to.

/random-reviewer @Bob, @John, @Fred: You can use slack usernames if you want them to be alerted to their nomination.

/random-reviewer @Bob, John Fred: You can mix and match too. Mix and match the separator (comma or space) as well if you desire.

/rangom-reviewer Bon, John, Fred x2: You can nominate more than one reviewer if you like.

/random-reviewer Bob John Fred for http://link.com: You can append a link to the review using for.

/random-reviewer Bob John Fred for A super empowering review!!: It doesn't have to be a link either.

/random-reviewer Bob John Fred x2 for The best review today!!: You can use the counter and for together.

Install

npm install

Running

npm start

Testing

npm test

Usage

The API expects a payload in the form

{ 
  "text": "{user list} x{count} for {link/info}",
  "user_id": "(Optional) ID of the slack user who used the command e.g. 'U12345'",
  "channel_id": "(Optional) ID of the slack channel the command was used in"
}

Try POST http://localhost:8306/random-reviewer With body:

{ 
  "text": "User1, User2 for http://link.com"
}

AWS

There is a Swagger spec for this project in the aws directory.

  • Create a Lambda function using index-lambda.js as the entry point. You will also need to add splitter.js and handler.js.
  • Deploy your lambda function and change the swagger x-amazon-apigateway-integration URI to point at your lambda.
  • Change {{api-id}} to be the ID of your REST API.
  • Import the swagger spec into API Gateway.
  • Deploy your api to a stage called prod.
  • Create a slack slash command and point it at your API Gateway endpoint. e.g: https://{{rest-api-id}}.execute-api.{{region}}.amazonaws.com/prod/random-reviewer

Heroku

  • Push this repo to Heroku (there's already a Procfile)
  • Create a slack slash command and point it at your Heroku endpoint. e.g: https://{{app-name}}.herokuapp.com/random-reviewer

slackbot's People

Contributors

ed0906 avatar

Watchers

James Cloos avatar  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.