Mailchimp_Helper

The Mailchimp Subscription Form Mailchimp Helper class.

Defined (1)

The class is defined in the following location(s).

/classes/mailchimp/Mailchimp/Helper.php  
  1. class Mailchimp_Helper { 
  2. public function __construct(Mailchimp $master) { 
  3. $this->master = $master; 
  4.  
  5. /** 
  6. * Retrieve lots of account information including payments made, plan info, some account stats, installed modules,  
  7. contact info, and more. No private information like Credit Card numbers is available. 
  8. * @param array $exclude 
  9. * @return associative_array containing the details for the account tied to this API Key 
  10. * - username string The company name associated with the account 
  11. * - user_id string The Account user unique id (for building some links) 
  12. * - is_trial bool Whether the Account is in Trial mode (can only send campaigns to less than 100 emails) 
  13. * - is_approved bool Whether the Account has been approved for purchases 
  14. * - has_activated bool Whether the Account has been activated 
  15. * - timezone string The timezone for the Account - default is "US/Eastern" 
  16. * - plan_type string Plan Type - "monthly", "payasyougo", or "free" 
  17. * - plan_low int <em>only for Monthly plans</em> - the lower tier for list size 
  18. * - plan_high int <em>only for Monthly plans</em> - the upper tier for list size 
  19. * - plan_start_date string <em>only for Monthly plans</em> - the start date for a monthly plan 
  20. * - emails_left int <em>only for Free and Pay-as-you-go plans</em> emails credits left for the account 
  21. * - pending_monthly bool Whether the account is finishing Pay As You Go credits before switching to a Monthly plan 
  22. * - first_payment string date of first payment 
  23. * - last_payment string date of most recent payment 
  24. * - times_logged_in int total number of times the account has been logged into via the web 
  25. * - last_login string date/time of last login via the web 
  26. * - affiliate_link string Monkey Rewards link for our Affiliate program 
  27. * - industry string the user's selected industry 
  28. * - contact associative_array Contact details for the account 
  29. * - fname string First Name 
  30. * - lname string Last Name 
  31. * - email string Email Address 
  32. * - company string Company Name 
  33. * - address1 string Address Line 1 
  34. * - address2 string Address Line 2 
  35. * - city string City 
  36. * - state string State or Province 
  37. * - zip string Zip or Postal Code 
  38. * - country string Country name 
  39. * - url string Website URL 
  40. * - phone string Phone number 
  41. * - fax string Fax number 
  42. * - modules array a struct for each addon module installed in the account 
  43. * - id string An internal module id 
  44. * - name string The module name 
  45. * - added string The date the module was added 
  46. * - data associative_array Any extra data associated with this module as key=>value pairs 
  47. * - orders array a struct for each order for the account 
  48. * - order_id int The order id 
  49. * - type string The order type - either "monthly" or "credits" 
  50. * - amount double The order amount 
  51. * - date string The order date 
  52. * - credits_used double The total credits used 
  53. * - rewards associative_array Rewards details for the account including credits & inspections earned, number of referrals, referral details, and rewards used 
  54. * - referrals_this_month int the total number of referrals this month 
  55. * - notify_on string whether or not we notify the user when rewards are earned 
  56. * - notify_email string the email address address used for rewards notifications 
  57. * - credits associative_array Email credits earned: 
  58. * - this_month int credits earned this month 
  59. * - total_earned int credits earned all time 
  60. * - remaining int credits remaining 
  61. * - inspections associative_array Inbox Inspections earned: 
  62. * - this_month int credits earned this month 
  63. * - total_earned int credits earned all time 
  64. * - remaining int credits remaining 
  65. * - referrals array a struct for each referral, including: 
  66. * - name string the name of the account 
  67. * - email string the email address associated with the account 
  68. * - signup_date string the signup date for the account 
  69. * - type string the source for the referral 
  70. * - applied array a struct for each applied rewards, including: 
  71. * - value int the number of credits user 
  72. * - date string the date applied 
  73. * - order_id int the order number credits were applied to 
  74. * - order_desc string the order description 
  75. * - integrations array a struct for each connected integrations that can be used with campaigns, including: 
  76. * - id int an internal id for the integration 
  77. * - name string the integration name 
  78. * - list_id string either "_any_" when globally accessible or the list id it's valid for use against 
  79. * - user_id string if applicable, the user id for the integrated system 
  80. * - account string if applicable, the user/account name for the integrated system 
  81. * - profiles array For Facebook, users/page that can be posted to. 
  82. * - id string the user or page id 
  83. * - name string the user or page name 
  84. * - is_page bool whether this is a user or a page 
  85. */ 
  86. public function accountDetails($exclude=array()) { 
  87. $_params = array("exclude" => $exclude); 
  88. return $this->master->call('helper/account-details', $_params); 
  89.  
  90. /** 
  91. * Retrieve minimal data for all Campaigns a member was sent 
  92. * @param associative_array $email 
  93. * - email string an email address 
  94. * - euid string the unique id for an email address (not list related) - the email "id" returned from listMemberInfo, Webhooks, Campaigns, etc. 
  95. * - leid string the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes 
  96. * @param associative_array $options 
  97. * - list_id string optional A list_id to limit the campaigns to 
  98. * @return array an array of structs containing campaign data for each matching campaign (ordered by send time ascending), including: 
  99. * - id string the campaign unique id 
  100. * - title string the campaign's title 
  101. * - subject string the campaign's subject 
  102. * - send_time string the time the campaign was sent 
  103. * - type string the campaign type 
  104. */ 
  105. public function campaignsForEmail($email, $options=null) { 
  106. $_params = array("email" => $email, "options" => $options); 
  107. return $this->master->call('helper/campaigns-for-email', $_params); 
  108.  
  109. /** 
  110. * Return the current Chimp Chatter messages for an account. 
  111. * @return array An array of structs containing data for each chatter message 
  112. * - message string The chatter message 
  113. * - type string The type of the message - one of lists:new-subscriber, lists:unsubscribes, lists:profile-updates, campaigns:facebook-likes, campaigns:facebook-comments, campaigns:forward-to-friend, lists:imports, or campaigns:inbox-inspections 
  114. * - url string a url into the web app that the message could link to, if applicable 
  115. * - list_id string the list_id a message relates to, if applicable. Deleted lists will return -DELETED- 
  116. * - campaign_id string the list_id a message relates to, if applicable. Deleted campaigns will return -DELETED- 
  117. * - update_time string The date/time the message was last updated 
  118. */ 
  119. public function chimpChatter() { 
  120. $_params = array(); 
  121. return $this->master->call('helper/chimp-chatter', $_params); 
  122.  
  123. /** 
  124. * Have HTML content auto-converted to a text-only format. You can send: plain HTML, an existing Campaign Id, or an existing Template Id. Note that this will <strong>not</strong> save anything to or update any of your lists, campaigns, or templates. 
  125. It's also not just Lynx and is very fine tuned for our template layouts - your mileage may vary. 
  126. * @param string $type 
  127. * @param associative_array $content 
  128. * - html string optional a single string value,  
  129. * - cid string a valid Campaign Id 
  130. * - user_template_id string the id of a user template 
  131. * - base_template_id string the id of a built in base/basic template 
  132. * - gallery_template_id string the id of a built in gallery template 
  133. * - url string a valid & public URL to pull html content from 
  134. * @return associative_array the content pass in converted to text. 
  135. * - text string the converted html 
  136. */ 
  137. public function generateText($type, $content) { 
  138. $_params = array("type" => $type, "content" => $content); 
  139. return $this->master->call('helper/generate-text', $_params); 
  140.  
  141. /** 
  142. * Send your HTML content to have the CSS inlined and optionally remove the original styles. 
  143. * @param string $html 
  144. * @param bool $strip_css 
  145. * @return associative_array with a "html" key 
  146. * - html string Your HTML content with all CSS inlined, just like if we sent it. 
  147. */ 
  148. public function inlineCss($html, $strip_css=false) { 
  149. $_params = array("html" => $html, "strip_css" => $strip_css); 
  150. return $this->master->call('helper/inline-css', $_params); 
  151.  
  152. /** 
  153. * Retrieve minimal List data for all lists a member is subscribed to. 
  154. * @param associative_array $email 
  155. * - email string an email address 
  156. * - euid string the unique id for an email address (not list related) - the email "id" returned from listMemberInfo, Webhooks, Campaigns, etc. 
  157. * - leid string the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes 
  158. * @return array An array of structs with info on the list_id the member is subscribed to. 
  159. * - id string the list unique id 
  160. * - web_id int the id referenced in web interface urls 
  161. * - name string the list name 
  162. */ 
  163. public function listsForEmail($email) { 
  164. $_params = array("email" => $email); 
  165. return $this->master->call('helper/lists-for-email', $_params); 
  166.  
  167. /** 
  168. * "Ping" the MailChimp API - a simple method you can call that will return a constant value as long as everything is good. Note 
  169. than unlike most all of our methods, we don't throw an Exception if we are having issues. You will simply receive a different 
  170. string back that will explain our view on what is going on. 
  171. * @return associative_array a with a "msg" key 
  172. * - msg string containing "Everything's Chimpy!" if everything is chimpy, otherwise returns an error message 
  173. */ 
  174. public function ping() { 
  175. $_params = array(); 
  176. return $this->master->call('helper/ping', $_params); 
  177.  
  178. /** 
  179. * Search all campaigns for the specified query terms 
  180. * @param string $query 
  181. * @param int $offset 
  182. * @param string $snip_start 
  183. * @param string $snip_end 
  184. * @return associative_array containing the total matches and current results 
  185. * - total int total campaigns matching 
  186. * - results array matching campaigns and snippets 
  187. * - snippet string the matching snippet for the campaign 
  188. * - campaign associative_array the matching campaign's details - will return same data as single campaign from campaigns/list() 
  189. */ 
  190. public function searchCampaigns($query, $offset=0, $snip_start=null, $snip_end=null) { 
  191. $_params = array("query" => $query, "offset" => $offset, "snip_start" => $snip_start, "snip_end" => $snip_end); 
  192. return $this->master->call('helper/search-campaigns', $_params); 
  193.  
  194. /** 
  195. * Search account wide or on a specific list using the specified query terms 
  196. * @param string $query 
  197. * @param string $id 
  198. * @param int $offset 
  199. * @return associative_array An array of both exact matches and partial matches over a full search 
  200. * - exact_matches associative_array containing the exact email address matches and current results 
  201. * - total int total members matching 
  202. * - members array each entry will be struct matching the data format for a single member as returned by lists/member-info() 
  203. * - full_search associative_array containing the total matches and current results 
  204. * - total int total members matching 
  205. * - members array each entry will be struct matching the data format for a single member as returned by lists/member-info() 
  206. */ 
  207. public function searchMembers($query, $id=null, $offset=0) { 
  208. $_params = array("query" => $query, "id" => $id, "offset" => $offset); 
  209. return $this->master->call('helper/search-members', $_params); 
  210.  
  211. /** 
  212. * Retrieve all domain verification records for an account 
  213. * @return array structs for each domain verification has been attempted for 
  214. * - domain string the verified domain 
  215. * - status string the status of the verification - either "verified" or "pending" 
  216. * - email string the email address used for verification - "pre-existing" if we automatically backfilled it at some point 
  217. */ 
  218. public function verifiedDomains() { 
  219. $_params = array(); 
  220. return $this->master->call('helper/verified-domains', $_params); 
  221.