Packages

an Elixir client library for IFTTT's Webhooks

Current section

Files

Jump to
ifttt_webhook lib ifttt_webhook.ex
Raw

lib/ifttt_webhook.ex

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