License | BSD3 |
---|---|
Maintainer | Dananji Liyanage <dan9131@gmail.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Types and functions for working with Mailchimp JSON API Version 3.0
- listMailingLists :: String -> IO [MailListResponse]
- listSubscribers :: String -> String -> IO [ListSubscribersResponse]
- addSubscriber :: String -> String -> String -> String -> String -> IO SubscriptionResponse
- removeSubscriber :: String -> String -> String -> IO Bool
- getTemplates :: String -> IO [TemplateResponse]
- getCampaigns :: String -> IO [(Maybe String, Maybe String)]
- createCampaign :: String -> String -> String -> String -> String -> String -> String -> IO (Maybe String)
- sendEmail :: String -> String -> IO (Either String SendMailResponse)
- batchSubscribe :: String -> String -> [(String, String)] -> IO BatchSubscriptionResponse
Working with Lists
listMailingLists :: String -> IO [MailListResponse] Source
Takes an apiKey
of a Mailchimp account, and gives all the mailing-lists in the account.
This function lists the mailing lists in a particular account
listSubscribers :: String -> String -> IO [ListSubscribersResponse] Source
Takes an apiKey
of the Mailchimp account, and a listName
.
Retrieves all the members in the given list.
Request URL specifies which data to be returned from the response. They are,
email_address, unique_email_id, email_type, list_id
, and status
for each
member in the reponse.
This function lists subscribers in a mailing list
addSubscriber :: String -> String -> String -> String -> String -> IO SubscriptionResponse Source
Taking apiKey,
listName,
emailAddress,
emailType,
and memberStatus
as input
parameters in the given order, this function creates and add the member to the given list.
This function adds a new member to a given list
removeSubscriber :: String -> String -> String -> IO Bool Source
Giving an apiKey,
emailAddress,
and listName
which the member belongs to, this
function unsubscribe the member from the list. This function does not deletes the particular
user profile from the mailing-list.
This function removes a member from a given list
Retrieve Template related data
getTemplates :: String -> IO [TemplateResponse] Source
Input parameters for this function is the apiKey
of the Mailchimp account.
This function retrieves all the templates in the account.
Working with Campaigns
getCampaigns :: String -> IO [(Maybe String, Maybe String)] Source
Taking the apiKey
of a Mailchimp account, this function returns all the
stored unsent Campaigns.
This function returns all the Campaigns in the account.
createCampaign :: String -> String -> String -> String -> String -> String -> String -> IO (Maybe String) Source
Usage of this function to create a new Campaign and save is as follows;
createCampaign
apiKey listName replyTo fromName cType title subject -> campaignID
This function creates a new campaign and save it
sendEmail :: String -> String -> IO (Either String SendMailResponse) Source
Input parameters for this function are apiKey
and the campaignID
of the
particular Campaign to be sent.
This function sends an email campaign
Batch Requests
batchSubscribe :: String -> String -> [(String, String)] -> IO BatchSubscriptionResponse Source
Efficiently processes a batch subscription requests for a given list
of emailAddress
and subscriptionStatus
combinations.
This function can be re-implemented to perform other batch requests by changing the
body
and path
properties of Operation
data structure.
This function adds a batch of subscribers