You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-32Lines changed: 38 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,46 +7,50 @@ Slack Ruby Bot Server
7
7
8
8
Build a complete Slack bot service with Slack button integration, in Ruby.
9
9
10
-
# Table of Contents
10
+
##Table of Contents
11
11
12
12
-[What is this?](#what-is-this)
13
13
-[Stable Release](#stable-release)
14
14
-[Make Your Own](#make-your-own)
15
-
-[Storage](#storage)
16
-
-[MongoDB](#mongodb)
17
-
-[ActiveRecord](#activerecord)
18
15
-[Usage](#usage)
19
-
-[API](#api)
20
-
-[App](#app)
21
-
-[Service Manager](#service-manager)
22
-
-[Lifecycle Callbacks](#lifecycle-callbacks)
23
-
-[Service Timers](#service-timers)
24
-
-[Extensions](#extensions)
25
-
-[Service Class](#service-class)
26
-
-[HTML Templates](#html-templates)
27
-
-[Access Tokens](#access-tokens)
16
+
-[Storage](#storage)
17
+
-[MongoDB](#mongodb)
18
+
-[ActiveRecord](#activerecord)
19
+
-[OAuth Scopes](#oauth-scopes)
20
+
-[Slack App](#slack-app)
21
+
-[API](#api)
22
+
-[App](#app)
23
+
-[Service Manager](#service-manager)
24
+
-[Lifecycle Callbacks](#lifecycle-callbacks)
25
+
-[Service Timers](#service-timers)
26
+
-[Extensions](#extensions)
27
+
-[Service Class](#service-class)
28
+
-[HTML Templates](#html-templates)
29
+
-[Access Tokens](#access-tokens)
28
30
-[Sample Bots Using Slack Ruby Bot Server](#sample-bots-using-slack-ruby-bot-server)
29
31
-[Slack Bots with Granular Permissions](#slack-bots-with-granular-permissions)
30
32
-[Legacy Slack Bots](#legacy-slack-bots)
31
33
-[Copyright & License](#copyright--license)
32
34
33
-
###What is this?
35
+
## What is this?
34
36
35
37
A library that contains a web server and a RESTful [Grape](http://github.com/ruby-grape/grape) API serving a Slack bot to multiple teams. Use in conjunction with [slack-ruby-bot-server-events](https://github.com/slack-ruby/slack-ruby-bot-server-events) to build a complete Slack bot service, or [slack-ruby-bot-server-rtm](https://github.com/slack-ruby/slack-ruby-bot-server-rtm) to build a Class RealTime Slack bot. Your customers can use a Slack button to install the bot.
36
38
37
-
###Stable Release
39
+
## Stable Release
38
40
39
41
You're reading the documentation for the **next** release of slack-ruby-bot-server. Please see the documentation for the [last stable release, v1.0.0](https://github.com/slack-ruby/slack-ruby-bot-server/blob/v1.0.0/README.md) unless you're integrating with HEAD. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
40
42
41
-
###Make Your Own
43
+
## Make Your Own
42
44
43
-
We recommend you get started from a [slack-ruby-bot-events-sample](https://github.com/slack-ruby/slack-ruby-bot-server-events-sample) app to bootstrap your project.
45
+
This library alone will only register a new bot, but will not include any bot functionality. To make something useful, we recommend you get started from a [slack-ruby-bot-events-sample](https://github.com/slack-ruby/slack-ruby-bot-server-events-sample) app to bootstrap your project.
46
+
47
+
## Usage
44
48
45
49
### Storage
46
50
47
51
A database is required to store teams.
48
52
49
-
### MongoDB
53
+
####MongoDB
50
54
51
55
Use MongoDB with [Mongoid](https://github.com/mongodb/mongoid) as ODM. Configure the database connection in `mongoid.yml`. Add the `mongoid` gem in your Gemfile.
52
56
@@ -57,7 +61,7 @@ gem 'mongoid-scroll'
57
61
gem 'slack-ruby-bot-server'
58
62
```
59
63
60
-
### ActiveRecord
64
+
####ActiveRecord
61
65
62
66
Use ActiveRecord with, for example, PostgreSQL via [pg](https://github.com/ged/ruby-pg). Configure the database connection in `postgresql.yml`. Add the `activerecord`, `pg`, `otr-activerecord` and `cursor_pagination` gems to your Gemfile.
63
67
@@ -69,15 +73,7 @@ gem 'otr-activerecord'
69
73
gem 'cursor_pagination'
70
74
```
71
75
72
-
### Usage
73
-
74
-
Start with the [slack-ruby-bot-events-sample](https://github.com/slack-ruby/slack-ruby-bot-server-events-sample) sample, which contain a couple of custom commands, necessary dependencies and tests, then [create a new Slack App](https://api.slack.com/applications/new).
75
-
76
-

77
-
78
-
Follow Slack's instructions, note the app client ID and secret, give the bot a default name, etc. The redirect URL should be the location of your app. For local testing purposes use a public tunneling service such as [ngrok](https://ngrok.com/) to expose local port 9292.
79
-
80
-
Within your application, edit your `.env` file and add `SLACK_CLIENT_ID=...` and `SLACK_CLIENT_SECRET=...` in it.
76
+
### OAuth Scopes
81
77
82
78
Configure your app's [OAuth scopes](https://api.slack.com/legacy/oauth-scopes) as needed by your application.
83
79
@@ -89,6 +85,16 @@ end
89
85
90
86
The "Add to Slack" button uses the standard OAuth code grant flow as described in the [Slack docs](https://api.slack.com/docs/oauth#flow). Once clicked, the user is taken through the authorization process at Slack's site. Upon successful completion, a callback containing a temporary code is sent to the redirect URL you specified. The endpoint at that URL contains code that persists the bot token each time a Slack client is instantiated for the specific team.
91
87
88
+
### Slack App
89
+
90
+
Create a new Slack App [here](https://api.slack.com/applications/new).
91
+
92
+

93
+
94
+
Follow Slack's instructions, note the app client ID and secret, give the bot a default name, etc. The redirect URL should be the location of your app. For local testing purposes use a public tunneling service such as [ngrok](https://ngrok.com/) to expose local port 9292.
95
+
96
+
Within your application, edit your `.env` file and add `SLACK_CLIENT_ID=...` and `SLACK_CLIENT_SECRET=...` in it.
97
+
92
98
Run `bundle install` and `foreman start` to boot the app. Navigate to [localhost:9292](http://localhost:9292). You should see an "Add to Slack" button. Use it to install the app into your own Slack team.
93
99
94
100
### API
@@ -252,14 +258,14 @@ end
252
258
253
259
By default the implementation of [Team](lib/slack-ruby-bot-server/models/team) stores the value of the token with all the requested OAuth scopes in both `token` and `activated_user_access_token` (for backwards compatibility). If a legacy Slack bot integration `bot_access_token` is present, it is stored as `token`, and `activated_user_access_token`is the token that has all the requested OAuth scopes.
254
260
255
-
###Sample Bots Using Slack Ruby Bot Server
261
+
## Sample Bots Using Slack Ruby Bot Server
256
262
257
-
####Slack Bots with Granular Permissions
263
+
### Slack Bots with Granular Permissions
258
264
259
265
*[slack-ruby-bot-server-events-sample](https://github.com/slack-ruby/slack-ruby-bot-server-events-sample), a generic sample
260
266
*[slack-rails-bot-starter](https://github.com/CrazyOptimist/slack-rails-bot-starter), an all-in-one Rails starter kit
261
267
262
-
####Legacy Slack Bots
268
+
### Legacy Slack Bots
263
269
264
270
*[slack-ruby-bot-server-sample](https://github.com/slack-ruby/slack-ruby-bot-server-sample), a generic sample
265
271
*[slack-sup](https://github.com/dblock/slack-sup), see [sup.playplay.io](https://sup.playplay.io)
@@ -270,7 +276,7 @@ By default the implementation of [Team](lib/slack-ruby-bot-server/models/team) s
270
276
*[slack-strava](https://github.com/dblock/slack-strava), see [slava.playplay.io](https://slava.playplay.io)
271
277
*[slack-arena](https://github.com/dblock/slack-arena), see [arena.playplay.io](https://arena.playplay.io)
272
278
273
-
###Copyright & License
279
+
## Copyright & License
274
280
275
281
Copyright [Daniel Doubrovkine](http://code.dblock.org) and Contributors, 2015-2020
0 commit comments