Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Send a message to Slack incoming webhook in Clojure.
(ns slack
(:require [clj-http.client :as client]
[ :as json]))
(defn send-to-slack
"Sends a simple message to slack using an 'incoming webhook'.
url will be of form: .
(Exact url you should use will appear on the slack integration page)
text will be any valid message.
This implementation could be expanded if you wanted to specify channel, username, etc.
For more information see: . (You'll need a slack account
to see that)"
[url text]
(client/post url {:form-params {:payload (json/write-str {:text text})}}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment