Slacker is an OTP application for sending messages to slack.
If available in Hex, the package can be installed as:
-
Add slacker to your list of dependencies in
mix.exs
:def deps do [{:slacker, "~> 0.0.1"}] end
-
Ensure slacker is started before your application:
def application do [applications: [:slacker]] end
-
Configure the slack connection in
config/config.exs
config :slacker, :slack, enabled: true, url: "https://slack.com/api", url_action: "/chat.postMessage", channel: "devops", botname: "ops"
-
Configure the slack API key in
config/<env>.exs
config :slacker, :slack, token: ""
Slacker.Slack.send_message("<message goes here>")
The message must be a string so if there is any doubt that it is not a string do the following:
Slacker.Slack.send_message("#{inspect <value-to-send>}")