Kickbox

CircleCI

A [Kickbox] (https://kickbox.io/) API client written in Elixir.

Installation

The package can be installed as:

  1. Add kickbox to your list of dependencies in mix.exs:
```elixir
def deps do
  # Get from hex
  [{:kickbox, "~> 0.1.0"}]
  # Or use the latest from master
  [{:kickbox, github: "pablo-co/kickbox-elixir"}]
end
```
  1. Ensure kickbox is started before your application:
```elixir
def application do
  [applications: [:kickbox]]
end
```
  1. Add your Kickbox API key to your config
> You can set the `KICKBOX_API_KEY` environment variable or can set it
> manually:

```elixir
# In your configuration file:
#  * General configuration: config/config.exs
#  * Recommended production only: config/prod.exs

config :kickbox, :kickbox_api_key, api_key: "my_api_key"
```

Verifying emails

You call Kickbox.verify/2 with an email and an optional keyword list to query the kickbox service.

# Just verify email
Kickbox.verify("some_email@email.com")

# Verify email specifying a max timeout of 9 seconds
Kickbox.verify("some_email@email.com", timeout: 9000)

# In general
Kickbox.verify(email_string, options)

You can then check the Kickbox.Verification struct for information regarding the queried email.

verification = Kickbox.verify("some_email@email.com")

verification.valid?
# false

verification.reason
# invalid_domain

See Vertication struct for more information.

Options

The valid options are:

options is a keyword list which gets converted to URL params, thus you can use any key/value you want (Note: These should be valid API params or they might get ignored by Kickbox).

Verification struct

Kickbox.verify/2 returns a Kickbox.Verification struct which contains information regarding the verification of the email.

You can see all the latest documentation and a more complete explanation at Kickbox' API Documentation.