Skip to content

Commit 46e4b95

Browse files
committed
add slack client
1 parent 31d9e59 commit 46e4b95

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

clojure/wheel/project.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
[org.flywaydb/flyway-core "5.2.4"]
1212
[com.taoensso/timbre "4.10.0"]
1313
[cheshire "5.9.0"]
14-
[toucan "1.14.0"]]
14+
[toucan "1.14.0"]
15+
[clj-http "3.10.0"]]
1516
:main ^:skip-aot wheel.core
1617
:target-path "target/%s"
1718
:profiles {:uberjar {:aot :all}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(ns wheel.slack.webhook
2+
(:require [clj-http.client :as http]
3+
[cheshire.core :as json]))
4+
5+
(defn post-message! [webhook-url text attachments]
6+
(let [body (json/generate-string {:text text
7+
:attachments attachments})]
8+
(http/post webhook-url {:content-type :json
9+
:body body})))
10+
11+
12+
(comment
13+
(post-message! webhook-url "ranging failed"
14+
[{:color :danger
15+
:fields [{:title "Channel Name"
16+
:value :tata-cliq
17+
:short true}
18+
{:title "Channel Id"
19+
:value "UA"
20+
:short true}
21+
{:title "Event Id"
22+
:value "2f763cf7-d5d7-492c-a72d-4546bb547696"}]}]))

0 commit comments

Comments
 (0)