LoopsEx.Events (LoopsEx v0.1.0)

View Source

Trigger email sending with events.

Summary

Types

Response type returned by Loops API calls

Functions

Send an event to trigger emails via Loops.

Types

response()

@type response() :: LoopsEx.Client.response()

Response type returned by Loops API calls

Functions

send_event(params)

@spec send_event(map()) :: response()

Send an event to trigger emails via Loops.

Parameters

  • params (map): must include:
    • email or userId to identify the contact.
    • eventName (string): the name of the event.
    • Optional eventProperties (map): event-specific data.
    • Optional mailingLists (map): mailing list subscriptions.

Returns

  • {:ok, %{"success" => true}} on success.
  • {:error, {status_code, response_body}} on failure.

Example

iex> LoopsEx.Events.send_event(%{
"email" => "john@example.com",
"eventName" => "signup",
"eventProperties" => %{"plan" => "Pro"}
})
{:ok, %{"success" => true}}