Skip to content

Commit 0896e16

Browse files
committed
slack: use hook if available, regardless of oauth token presence
doc needs updating
1 parent e4932da commit 0896e16

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/api_remote.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ module Slack : Api.Slack = struct
7777
let build_query_error url e = build_error @@ sprintf "error while querying %s: %s" url e in
7878
let secrets = Context.get_secrets_exn ctx in
7979
let headers, url, webhook_mode =
80+
match Context.hook_of_channel ctx msg.channel with
81+
| Some url -> [], Some url, true
82+
| None ->
8083
match secrets.slack_access_token with
8184
| Some access_token -> [ bearer_token_header access_token ], Some "https://slack.com/api/chat.postMessage", false
82-
| None -> [], Context.hook_of_channel ctx msg.channel, true
85+
| None -> [], None, false
8386
in
8487
match url with
8588
| None -> Lwt.return @@ build_error @@ sprintf "no token or webhook configured to notify channel %s" msg.channel

0 commit comments

Comments
 (0)