You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
analytics/lib/plausible/slack.ex

20 lines
421 B
Elixir

defmodule Plausible.Slack do
@app_env System.get_env("APP_ENV") || "dev"
require Logger
def notify(text) do
Task.start(fn ->
case @app_env do
"prod" ->
HTTPoison.post!(webhook_url(), Poison.encode!(%{text: text}))
_ ->
Logger.debug(text)
end
end)
end
defp webhook_url() do
Keyword.fetch!(Application.get_env(:plausible, :slack), :webhook)
end
end