findkiko / slack2particle

Wire a Slack outgoing webhook to a Particle API call via a Sinatra+Thin translator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A Minimal Sinatra webapp to Glue outgoing slack webhooks to particle inbound API.

This middle layer is neccessary because outgoing Slack webhooks don't offer customisation that would enable wiring webhooks directly to another API.

Note: Slack webhooks are served over TLS only, this project is designed to sit behind a webserver (such as an nginx "proxy_pass" clause) that terminates the SSL and passes requests to this app via localhost (or an internal LAN).

Prerequisites

  • Ruby
  • gem install bundler
  • A proxy webserver such as nginx with SSL configured (see section below on configuration for nginx specifically).

Installing

  • clone this repository.
  • cd slack2particle && bundle install
  • cp .env.{example,production}
  • Replace the dummy data in .env.production with your specific secrets. (See your Slack and Particle config pages)
  • Configure web server to pass requests from your endpoint to port 3000.

Running

  • bundle exec thin start

TODO

(see github issues)

See Also

Nginx configuration

location /supersecretendpoint {
       proxy_set_header  X-Real-IP  $remote_addr;
       proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $http_host;
       proxy_redirect off;
       proxy_pass http://localhost:3000;
}

License

MIT

About

Wire a Slack outgoing webhook to a Particle API call via a Sinatra+Thin translator

License:MIT License


Languages

Language:Ruby 100.0%