defmodule IftttWebhook do use Application alias IftttWebhook.API @api_key Application.get_env(:ifttt_webhook, :api_key, "") @doc false def start(_type, []) do Supervisor.start_link([ {Task.Supervisor, name: IftttWebhook.TaskSupervisor} ], strategy: :one_for_one) end @doc """ Sends an event to the webhook including the values given """ @spec send_async(binary, list) :: :ok def send_async(event, values) when is_list(values) do Task.Supervisor.start_child(IftttWebhook.TaskSupervisor, fn -> API.send(@api_key, event, values) end) :ok end end