Skip to content

A elixir middleware library for interfacing with the ActiveCampaign API

Notifications You must be signed in to change notification settings

piratestudios/ex_activecampaign

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExActivecampaign

A elixir middleware library for interfacing with the ActiveCampaign API.

Installation

The package can be installed by adding ex_activecampaign to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_activecampaign, github: "piratestudios/ex_activecampaign"}
  ]
end

Once added, run mix deps.get

Configuration

You will need to set the following configuration variables in your config/config.exs file:

use Mix.Config

config :ex_activecampaign, base_url:  "https://<your-account>.api-us1.com/api/3",
                           api_token: "YOUR-ACTIVECAMPAIGN-TOKEN"

Multiple Environments

If you want to use different ActiveCampaign credentials for different environments, then create separate Mix configuration files for each environment. To do this, change config/config.exs to look like this:

# config/config.exs

use Mix.Config

# shared configuration for all environments here ...

import_config "#{Mix.env}.exs"

Then, create a config/#{environment_name}.exs file for each environment. You can then set the config :ex_activecampaign variables differently in each file.

Usage

To use the middleware, simply add a call to the desired API method in the relevant part of the dependent codebase, e.g.:

def subscribe_to_mailing_list(email, first_name, last_name, phone) do
    %{contact: %{id: id}} = ExActivecampaign.Contact.create_or_update(
        %{"email" => email, "firstName" => first_name, "lastName" => last_name, "phone" => phone}
    )
    ExActivecampaign.Contact.update_list_status(
        %{contact: id, list: 1, status: 1}
    )
end

Supported Endpoints

ExActivecampaign currently supports requests to the following endpoints of the ActiveCampaign API

About

A elixir middleware library for interfacing with the ActiveCampaign API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages