A simple wrapper for the Campaign Monitor JSON API.
- Install the package by adding
ex_campaign_monitor
to your list of dependencies inmix.exs
:
def deps do
[
{:ex_campaign_monitor, "~> 0.9"}
]
end
- Add your Campaign Monitor account API key and a List ID to your application's config:
config :ex_campaign_monitor,
:api_key, "YOUR_API_KEY",
:list_id, "YOUR_LIST_ID",
- Call a function on the
ExCampaignMonitor
module, for example:
defmodule MyApp.PageController do
use MyAppWeb, :controller
def index(conn, params) do
ExCampaignMonitor.add_subscriber(%{
email: params["email"], # email address of the user you want to subscribe
consent_to_track: params["consent], # https://help.campaignmonitor.com/permission-to-track
name: params["name"],
custom_fields: [
%{
key: "website",
value: params["website"]
}
]
})
send_resp(conn, "Subscriber added")
end
end
- Adding a subscriber
- Updating a subscriber
- Importing many subscribers
- Getting a subscriber
- Unsubscribing a subscriber
- Deleting a subscriber
- Active subscribers
- Creating a List
- Getting list details
- List webhooks
- Activate a webhook
- Creating a webhook
- Deleting a webhook
- Smart email