Giter Site home page Giter Site logo

slack-integrator's Introduction

Introduction

Application allows you to easly create Slack integrations.

Technologies

Postgres
React
Bootstrap

Setup

  1. We use rvm in this project, so when you clone your repository you should have gemset created.
  2. Setup .env file with values (some of them you need to obtain from slack integration - incoming/outcoming webhook):
DATABASE_URL
TEST_DATABASE_URL
RESERVATION_INCOMING_WEBHOOK
RESERVATION_CHANNEL
RACK_ENV
RESERVATION_OUTGOING_TOKEN
PULL_REQUEST_CHANNEL
PULL_REQUEST_INCOMING_WEBHOOK
PULL_REQUEST_OUTGOING_TOKEN
GITHUB_TOKEN - token from some 'master' user on the github
REPOSITORY_URL - example: `https://github.com/`
  1. gem install bundler
  2. bundle
  3. rake db:create
  4. rake db:migrate
  5. Application can use users whitelisting. Create authorized_users.yml in configurations folder and list users which should be whitelisted for registration. Uncomment proper line in register_user.rb.
  6. to run server: rackup

Usage of the example reservation app

After you filled in proper env variables you need and added integrations on your slack panel, you can invoke the command from you slack channel (I used slash commands).

Format of the text you type after slash command is: DD/MM-HH-HH

Usage of the pull request automatic assigment

First of all you need to fill in proper .env variables and choose the channel you want to add integration to. On the slack side you need to setup incoming webhook and slash commands - as outgoing token. Also rememmber that you have to provide GITHUB_TOKEN. It is the alpha version of the integration, so it should be changed later to more generic way of authorization. Pull request will be assigned to each user that will register in the system.

Usage of the integration: /your_slash_command_from_slack <url_to_the_pull_request>

Development

If you want to improve or add some integrations check issues or simply create one.

New slack integration

Application structure has been prepared to easly add new integrations.

  1. Create your_integration_name.rb file in apps folder.
  2. Create a service witch your funcionality in services folder.
  3. If you need to create a model for some object create it in models folder, create a migration and add it to models.rb file.
  4. Create slack configuration in configurations folder.
  5. Initialize a bot in roda-app.rb with opts[:your_bot_name] = Slackbotsy::Bot.new(YOUR_CONFIG)
  6. You can now use this bot to post message with PostToSlack.say(:your_bot_name, message). Note that posting to slack works only in production enviroment. To change this, go into app/services/post_to_slack.rb.

Food integration

  1. Create file 'places.yml'
  2. Add there your restaurants. Schema: name: full_name: '' phone: ' schema: '' menu: '' Where: name is a word called in slack to order from that place schema is suggested example of order
  3. Run rake places:create

Tests

rake db:create RACK_ENV=test rake db:migrate RACK_ENV=test rspec spec

Migrations

migrations are generated using a rake task. To generate your migration invoke rake generate:migration['Create events'] under some shells like zsh you need to escape [, call it like this rake generate:migration\['Hehe Axzsdasdasd'\]

License

MIT

slack-integrator's People

Contributors

hirokiraj avatar mbroderson avatar mc-bro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slack-integrator's Issues

Refactor PostToSlack

We need to refactor the call of the method. We need to append if production? at the end of the call.

I suggest to move the if into the service itself. So we have one point of control.

New integration - remote work

If someone is to work at home a particular day he is able to post the info on the general channel (to be specified via config) and on every private group he is participant of.

Migrations problem

We need to fix the problem with numerating migrations.

Problem:
Two devs created different migrations with the same number. It causing problems upon merge.

Filter params for reservation

It would be nice to upgrade filter_params method in services/create_reservation.

For now, it just use split and save splitted value to the database so it can save values like 1800 or 111. We would want to have hour values only. Test for this method is needed aswell.

Github pull request integration

Problem:
When coworkers create a pull request, they need to assign it to someone. They usually do this by sending them link to the pull request in a private message. Some people receive more pull requests that anyone else.

Idea:
The idea is to to have a channel that helps with assigning the pull request.
Example:
I created a pull request in a project X. I want to assign it to someone.
I enter the slack channel, type:
review <link_to_pull_request>,
review is assigned pseudo randomly (between reviewers that has less pull requests assigned than each other).

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.