IFTTT Webhooks v0.2.0 IftttWebhook.API View Source

Handles the sending of webhooks to IFTTT

Link to this section Summary

Functions

Builds the URL to access IFTTT

sends a webhook to IFTTT using HTTPotion, values must be a list of up to 3 values. More values will be ommitted when sending the request

Link to this section Functions

Builds the URL to access IFTTT

Examples

iex> IftttWebhook.API.build_url("foo", "bar")
"https://maker.ifttt.com/trigger/bar/with/key/foo"
Link to this function send(key, event, values) View Source
send(binary, binary, list) ::
  {:ok, binary} |
  {:error, :invalid_key} |
  {:error, :unknown}

sends a webhook to IFTTT using HTTPotion, values must be a list of up to 3 values. More values will be ommitted when sending the request.

Examples

iex> IftttWebhook.API.send("my-secret-key", "my-event", [])
{:ok, "Congratulations! You've fired the my-event event"}

iex> IftttWebhook.API.send("my-secret-key", "my-event-with-body", [13.0])
{:ok, "Congratulations! You've fired the my-event-with-body event"}

iex> IftttWebhook.API.send("wrong-key", "my-event", [])
{:error, :invalid_key}

iex> IftttWebhook.API.send("unknown-error-key", "my-event", [])
{:error, :unknown}