View Source ActiveCampaign

Module Version Hex Docs License Last Updated

A thin wrapper around the Active Campaign version 3 API.

installation

Installation

First, add the ActiveCampaign package to your mix.exs dependencies:

def deps do
  [
    {:active_campaign, "~> 0.2"}
  ]
end

and run $ mix deps.get

usage

Usage

Put your API key and API URL in your config.exs file:

config :active_campaign,
  api_key: "myApiKey",
  api_url: "https://example.api-us1.com"

If using the event tracking API, put your actid and event key in your config.exs file:

config :active_campaign,
  actid: "myActid",
  event_key: "myEventKey"

http-library

HTTP Library

ActiveCampagin comes with HTTPoison as the default HTTP library. To use it, add :httpoison to your dependencies:

{:httpoison, "~> 1.4"},

You can customize it to use another library via the :http_library configuration:

config :active_campaign, :http_library, SomeOtherLib

This is useful for mocking responses when testing.

The HTTP library request options are also configurable:

config :active_campaign, :http_options, [recv_timeout: 8000]

json-support

JSON support

ActiveCampaign comes with JSON support out of the box via the Jason library. To use it, add :jason to your dependencies:

{:jason, "~> 1.0"}

You can customize it to use another library via the :json_library configuration:

config :active_campaign, :json_library, SomeOtherLib

Once you change the value, you have to recompile ActiveCampaign, which can be done by cleaning its current build:

mix deps.clean active_campaign --build