Vaartix (vaartix v0.1.0)

Copy Markdown View Source

The official Elixir client for Vaartix, the transactional email API built in India.

client = Vaartix.client()   # reads VAARTIX_API_KEY
{:ok, %{"id" => id}} =
  Vaartix.Emails.send(client, %{
    from: "Acme <orders@acme.in>",
    to: "priya@example.com",
    subject: "Your order is confirmed",
    html: "<p>Thanks for your order!</p>"
  })

Every function returns {:ok, result} or {:error, %Vaartix.Error{}}. Results are the API's JSON as maps with string keys. Keys you pass can be snake_case atoms (reply_to, scheduled_at) or the API's camelCase.

Summary

Functions

Create a client. A nil api_key reads VAARTIX_API_KEY.

Functions

client(api_key \\ nil, opts \\ [])

@spec client(String.t() | nil, keyword()) :: Vaartix.Client.t()

Create a client. A nil api_key reads VAARTIX_API_KEY.

Options: :base_url, :receive_timeout (ms, default 30_000), and :req_options passed to Req (for example [plug: ...] or [adapter: ...] in tests).