taoensso.telemere.slack
handler:slack
clj
(handler:slack {:keys [conn-opts post-opts output-fn], :or {conn-opts {:api-url "https://slack.com/api", :token nil}, post-opts {:channel-id nil, :username nil}, output-fn (utils/format-signal-fn)}})
Experimental, subject to change.
Needs `clj-slack`, Ref. <https://github.com/julienXX/clj-slack>.
Returns a signal handler that:
- Takes a Telemere signal (map).
- Writes the signal as a string to specified Slack channel.
Can output signals as human or machine-readable (edn, JSON) strings.
Default handler dispatch options (override when calling `add-handler!`):
`:min-level` - `:info`
`:rate-limit` -
[[5 (enc/msecs :mins 1)] ; Max 5 posts in 1 min
[10 (enc/msecs :mins 15)] ; Max 10 posts in 15 mins
[15 (enc/msecs :hours 1)] ; Max 15 posts in 1 hour
[30 (enc/msecs :hours 6)] ; Max 30 posts in 6 hours
]
Options:
`:output-fn` - (fn [signal]) => string, see `format-signal-fn` or `pr-signal-fn`
`:conn-opts` - Map of connection opts given to `clj-slack.chat/post-message`
Examples:
{:token "MY-TOKEN"}
{:token "MY-TOKEN", :api-url "https://slack.com/api"}
`:post-opts` - Map of post opts given to `clj-slack.chat/post-message`
Examples:
{:channel-id "C12345678", :username "MY_BOT"}
Tips:
- See `clj-slack` docs for more info on its options.