This is a basic Elixir wrapper for version 3 of the MailChimp API.
First, add MailChimp lib to your mix.exs
dependencies:
def deps do
[{:mailchimp, "~> 0.0.7"}]
end
and run $ mix deps.get
. Now, list the :mailchimp
application as your
application dependency:
def application do
[applications: [:mailchimp]]
end
Put your API key in your config.exs file:
config :mailchimp,
api_key: "your api-us10"
or
Application.put_env(:mailchimp, :api_key, "your apikey-us12")
Start a new process:
Mailchimp.start_link
Mailchimp.Account.get!()
Mailchimp.Account.get! |> Mailchimp.Account.lists!
Mailchimp.List.create_member(list, "[email protected]", :subscribed, %{}, %{})
Mailchimp.Campaign.create!(:regular)