Skip to content

Commit 94779d8

Browse files
committed
update docs and remove all references to slack webhooks
1 parent f95cecf commit 94779d8

File tree

7 files changed

+20
-56
lines changed

7 files changed

+20
-56
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Run the `_build/default/src/notabot.exe` binary. The following commands are supp
2222

2323
- `run`: Launch the HTTP server
2424
- `check_gh <GH_PAYLOAD>`: read a Github notification from a file and display the actions that will be taken (used for testing)
25-
- `check_slack <SLACK_PAYLOAD> <SLACK_WEBHOOK>`: read a Slack notification from a file and send it to a webhook (used for testing)
25+
- `check_slack <SLACK_PAYLOAD>`: read a Slack notification from a file and send it to a channel (used for testing)
2626

2727
### Documentation
2828

documentation/config_docs.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ A **label rule** specifies whether or not a Slack channel should be notified, ba
7979
|-|-|-|-|
8080
| `allow` | whitelist of labels that should match the rule | Yes | all labels allowed if no list provided |
8181
| `ignore` | blacklist of labels that shouldn't match the rule | Yes | - |
82-
| `channel` | channel to use as webhook if the rule is matched | No | - |
82+
| `channel` | channel to notify if the rule is matched | No | - |
8383

8484
## Prefix Options
8585

@@ -116,7 +116,7 @@ A **prefix rule** specifies whether or not a Slack channel should be notified, b
116116
|-|-|-|-|
117117
| `allow` | whitelist of file prefixes that should match the rule | Yes | all prefixes allowed if no list provided |
118118
| `ignore` | blacklist of file prefixes that shouldn't match the rule | Yes | - |
119-
| `channel` | channel to use as webhook if the rule is matched | No | - |
119+
| `channel` | channel to notify if the rule is matched | No | - |
120120

121121
## Status Options
122122

documentation/secret_docs.md

+7-31
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,20 @@ A secrets file stores sensitive information. Unlike the repository configuration
88

99
```json
1010
{
11-
"slack_hooks": [
12-
{
13-
"url": "https://slack_webhook_url",
14-
"channel": "default"
15-
},
16-
{
17-
"url": "https://slack_webhook_url",
18-
"channel": "aa"
19-
},
20-
{
21-
"url": "https://slack_webhook_url",
22-
"channel": "backend"
23-
},
24-
{
25-
"url": "https://slack_webhook_url",
26-
"channel": "all-push-events"
27-
},
28-
{
29-
"url": "https://slack_webhook_url",
30-
"channel": "frontend-bot"
31-
},
32-
{
33-
"url": "https://slack_webhook_url",
34-
"channel": "aa-git"
35-
},
36-
{
37-
"url": "https://slack_webhook_url",
38-
"channel": "siren"
39-
}
40-
]
11+
"slack_client_id": "",
12+
"slack_client_secret": ""
4113
}
4214
```
4315

4416
| value | description | optional | default |
4517
|-|-|-|-|
46-
| `slack_hooks` | list of channel names (`channel`) and their corresponding webhook endpoint (`url`) | No | - |
4718
| `gh_token` | specify to grant the bot access to private repositories; omit for public repositories | Yes | - |
4819
| `gh_hook_token` | specify to ensure the bot only receives GitHub notifications from pre-approved repositories | Yes | - |
20+
| `slack_client_id` | slack client ID, used for [oauth](https://api.slack.com/authentication/oauth-v2) authentication; can be found in your slack app's [management page](https://api.slack.com/apps) | No | - |
21+
| `slack_client_secret` | slack client secret, used for [oauth](https://api.slack.com/authentication/oauth-v2) authentication; can be found in your slack app's [management page](https://api.slack.com/apps) | No | - |
22+
| `slack_signing_secret` | specify to verify incoming slack requests; can be found in your slack app's [management page](https://api.slack.com/apps) | Yes | - |
23+
| `slack_oauth_state` | specify some unique value to maintain state b/w oauth request and callback and prevent CSRF (see [RFC6749](https://tools.ietf.org/html/rfc6749#section-4.1.1)) | Yes | - |
24+
| `slack_access_token` | slack bot token obtained via [oauth](https://api.slack.com/authentication/oauth-v2), enabling message posting to the workspace; if not provided initially, the first sucessful oauth exchange will update this field both in memory and on disk | Yes | - |
4925

5026
## `gh_token`
5127

lib/config.atd

-6
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ type config = {
3030
?main_branch_name : string nullable; (* the name of the main branch; used to filter out notifications about merges of main branch into other branches *)
3131
}
3232

33-
(* This specifies the Slack webhook to query to post to the channel with the given name *)
34-
type webhook = {
35-
url : string; (* webhook URL to post the Slack message *)
36-
channel : string; (* name of the Slack channel to post the message *)
37-
}
38-
3933
(* This is the structure of the secrets file which stores sensitive information, and
4034
shouldn't be checked into version control. *)
4135
type secrets = {

lib/slack.atd

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
type webhook_notification_field = {
1+
type notification_field = {
22
?title: string nullable;
33
value: string;
44
}
55

6-
type webhook_notification_attachment = {
6+
type notification_attachment = {
77
fallback: string nullable;
88
?mrkdwn_in: string list nullable;
99
?color: string nullable;
@@ -14,7 +14,7 @@ type webhook_notification_attachment = {
1414
?title: string nullable;
1515
?title_link: string nullable;
1616
?text: string nullable;
17-
?fields: webhook_notification_field list nullable;
17+
?fields: notification_field list nullable;
1818
?image_url: string nullable;
1919
?thumb_url: string nullable;
2020
?ts: int nullable;
@@ -39,25 +39,25 @@ type text_object = {
3939
text: string;
4040
}
4141

42-
type webhook_notification_text_block = {
42+
type notification_text_block = {
4343
notification_type <json name="type"> : notification_section_block_type;
4444
text: text_object;
4545
}
4646

47-
type webhook_notification_divider_block = {
47+
type notification_divider_block = {
4848
notification_type <json name="type"> : notification_divider_block_type;
4949
}
5050

51-
type webhook_notification_block = [
52-
Text of webhook_notification_text_block
53-
| Divider of webhook_notification_divider_block
51+
type notification_block = [
52+
Text of notification_text_block
53+
| Divider of notification_divider_block
5454
] <json adapter.ocaml="Atdgen_runtime.Json_adapter.Type_field">
5555

5656
type notification = {
5757
channel: string;
5858
?text: string nullable;
59-
?attachments: webhook_notification_attachment list nullable;
60-
?blocks: webhook_notification_block list nullable;
59+
?attachments: notification_attachment list nullable;
60+
?blocks: notification_block list nullable;
6161
}
6262

6363
(* expected payload when exchanging oauth code for access token *)

lib/slack.ml

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ open Slack_j
77

88
let log = Log.from "slack"
99

10-
type channel_hook = string
11-
1210
let empty_attachments =
1311
{
1412
mrkdwn_in = None;

src/notabot.ml

-4
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,6 @@ let gh_payload =
9696
let doc = "JSON file containing a github webhook payload" in
9797
Arg.(required & pos 0 (some file) None & info [] ~docv:"GH_PAYLOAD" ~doc)
9898

99-
let slack_webhook_url =
100-
let doc = "slack webhook url" in
101-
Arg.(required & pos 0 (some string) None & info [] ~docv:"SLACK_WEBHOOK" ~doc)
102-
10399
let slack_payload =
104100
let doc = "JSON file containing a slack notification" in
105101
Arg.(required & pos 1 (some file) None & info [] ~docv:"SLACK_PAYLOAD" ~doc)

0 commit comments

Comments
 (0)