Skip to content

Commit 13f330c

Browse files
committed
Improved README.
1 parent f919250 commit 13f330c

File tree

1 file changed

+38
-32
lines changed

1 file changed

+38
-32
lines changed

README.md

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,50 @@ Slack Ruby Bot Server
77

88
Build a complete Slack bot service with Slack button integration, in Ruby.
99

10-
# Table of Contents
10+
## Table of Contents
1111

1212
- [What is this?](#what-is-this)
1313
- [Stable Release](#stable-release)
1414
- [Make Your Own](#make-your-own)
15-
- [Storage](#storage)
16-
- [MongoDB](#mongodb)
17-
- [ActiveRecord](#activerecord)
1815
- [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)
2830
- [Sample Bots Using Slack Ruby Bot Server](#sample-bots-using-slack-ruby-bot-server)
2931
- [Slack Bots with Granular Permissions](#slack-bots-with-granular-permissions)
3032
- [Legacy Slack Bots](#legacy-slack-bots)
3133
- [Copyright & License](#copyright--license)
3234

33-
### What is this?
35+
## What is this?
3436

3537
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.
3638

37-
### Stable Release
39+
## Stable Release
3840

3941
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.
4042

41-
### Make Your Own
43+
## Make Your Own
4244

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
4448

4549
### Storage
4650

4751
A database is required to store teams.
4852

49-
### MongoDB
53+
#### MongoDB
5054

5155
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.
5256

@@ -57,7 +61,7 @@ gem 'mongoid-scroll'
5761
gem 'slack-ruby-bot-server'
5862
```
5963

60-
### ActiveRecord
64+
#### ActiveRecord
6165

6266
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.
6367

@@ -69,15 +73,7 @@ gem 'otr-activerecord'
6973
gem 'cursor_pagination'
7074
```
7175

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-
![](images/create-app.png)
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
8177

8278
Configure your app's [OAuth scopes](https://api.slack.com/legacy/oauth-scopes) as needed by your application.
8379

@@ -89,6 +85,16 @@ end
8985

9086
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.
9187

88+
### Slack App
89+
90+
Create a new Slack App [here](https://api.slack.com/applications/new).
91+
92+
![](images/create-app.png)
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+
9298
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.
9399

94100
### API
@@ -252,14 +258,14 @@ end
252258

253259
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.
254260

255-
### Sample Bots Using Slack Ruby Bot Server
261+
## Sample Bots Using Slack Ruby Bot Server
256262

257-
#### Slack Bots with Granular Permissions
263+
### Slack Bots with Granular Permissions
258264

259265
* [slack-ruby-bot-server-events-sample](https://github.com/slack-ruby/slack-ruby-bot-server-events-sample), a generic sample
260266
* [slack-rails-bot-starter](https://github.com/CrazyOptimist/slack-rails-bot-starter), an all-in-one Rails starter kit
261267

262-
#### Legacy Slack Bots
268+
### Legacy Slack Bots
263269

264270
* [slack-ruby-bot-server-sample](https://github.com/slack-ruby/slack-ruby-bot-server-sample), a generic sample
265271
* [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
270276
* [slack-strava](https://github.com/dblock/slack-strava), see [slava.playplay.io](https://slava.playplay.io)
271277
* [slack-arena](https://github.com/dblock/slack-arena), see [arena.playplay.io](https://arena.playplay.io)
272278

273-
### Copyright & License
279+
## Copyright & License
274280

275281
Copyright [Daniel Doubrovkine](http://code.dblock.org) and Contributors, 2015-2020
276282

0 commit comments

Comments
 (0)