Create a new draft campaign to send. You <strong>can not</strong> have more than 32,000 campaigns in your account.
Signature
public function campaignCreate(string
$type,
array
$options,
array
$content,
[array
$segment_opts = NULL,
[array
$type_opts = NULL]] )
Parameters
$type
—
string
the Campaign Type to create - one of "regular", "plaintext", "absplit", "rss", "auto"
$options
—
array
a hash of the standard options for this campaign : string list_id the list to send this campaign to- get lists using lists() string subject the subject line for your campaign message string from_email the From: email address for your campaign message string from_name the From: name for your campaign message (not an email address) string to_name the To: name recipients will see (not email address) int template_id optional - use this user-created template to generate the HTML content of the campaign (takes precendence over other template options) int gallery_template_id optional - use a template from the public gallery to generate the HTML content of the campaign (takes precendence over base template options) int base_template_id optional - use this a base/start-from-scratch template to generate the HTML content of the campaign int folder_id optional - automatically file the new campaign in the folder_id passed. Get using folders() - note that Campaigns and Autoresponders have separate folder setupsn array tracking optional - set which recipient actions will be tracked, as a struct of boolean values with the following keys: "opens", "html_clicks", and "text_clicks". By default, opens and HTML clicks will be tracked. Click tracking can not be disabled for Free accounts. string title optional - an internal name to use for this campaign. By default, the campaign subject will be used. boolean authenticate optional - set to true to enable SenderID, DomainKeys, and DKIM authentication, defaults to false. array analytics optional - if provided, use a struct with "service type" as a key and the "service tag" as a value. Use "google" for Google Analytics, "clicktale" for ClickTale, and "gooal" for Goo.al tracking. The "tag" is any custom text (up to 50 characters) that should be included. boolean auto_footer optional Whether or not we should auto-generate the footer for your content. Mostly useful for content from URLs or Imports boolean inline_css optional Whether or not css should be automatically inlined when this campaign is sent, defaults to false. boolean generate_text optional Whether of not to auto-generate your Text content from the HTML content. Note that this will be ignored if the Text part of the content passed is not empty, defaults to false. boolean auto_tweet optional If set, this campaign will be auto-tweeted when it is sent - defaults to false. Note that if a Twitter account isn't linked, this will be silently ignored. array auto_fb_post optional If set, this campaign will be auto-posted to the page_ids contained in the array. If a Facebook account isn't linked or the account does not have permission to post to the page_ids requested, those failures will be silently ignored. boolean fb_comments optional If true, the Facebook comments (and thus the <a href="http://kb.mailchimp.com/article/i-dont-want-an-archiave-of-my-campaign-can-i-turn-it-off/" target="_blank">archive bar</a> will be displayed. If false, Facebook comments will not be enabled (does not imply no archive bar, see previous link). Defaults to "true". boolean timewarp optional If set, this campaign must be scheduled 24 hours in advance of sending - default to false. Only valid for "regular" campaigns and "absplit" campaigns that split on schedule_time. boolean ecomm360 optional If set, our <a href="http://www.mailchimp.com/blog/ecommerce-tracking-plugin/" target="_blank">Ecommerce360 tracking</a> will be enabled for links in the campaign array crm_tracking optional If set, enable CRM tracking for:<div style="padding-left:15px"><table> array salesforce optional Enable SalesForce push back<div style="padding-left:15px"><table> bool campaign optional - if true, create a Campaign object and update it with aggregate stats bool notes optional - if true, attempt to update Contact notes based on email address</table></div> array highrise optional Enable Highrise push back<div style="padding-left:15px"><table> bool campaign optional - if true, create a Kase object and update it with aggregate stats bool notes optional - if true, attempt to update Contact notes based on email address</table></div> array capsule optional Enable Capsule push back (only notes are supported)<div style="padding-left:15px"><table> bool notes optional - if true, attempt to update Contact notes based on email address</table></div></table></div>
$content
—
array
the content for this campaign - use a struct with the following keys: string html for pasted HTML content string text for the plain-text version string url to have us pull in content from a URL. Note, this will override any other content options - for lists with Email Format options, you'll need to turn on generate_text as well string archive to send a Base64 encoded archive file for us to import all media from. Note, this will override any other content options - for lists with Email Format options, you'll need to turn on generate_text as well string archive_type optional - only necessary for the "archive" option. Supported formats are: zip, tar.gz, tar.bz2, tar, tgz, tbz . If not included, we will default to zip
If you chose a template instead of pasting in your HTML content, then use "html_" followed by the template sections as keys - for example, use a key of "html_MAIN" to fill in the "MAIN" section of a template.
$segment_opts
—
array
optional - if you wish to do Segmentation with this campaign this array should contain: see campaignSegmentTest(). It's suggested that you test your options against campaignSegmentTest().
$type_opts
—
array
optional - For RSS Campaigns this, array should contain: string url the URL to pull RSS content from - it will be verified and must exist string schedule optional one of "daily", "weekly", "monthly" - defaults to "daily" string schedule_hour optional an hour between 0 and 24 - default to 4 (4am <em>local time</em>) - applies to all schedule types string schedule_weekday optional for "weekly" only, a number specifying the day of the week to send: 0 (Sunday) - 6 (Saturday) - defaults to 1 (Monday) string schedule_monthday optional for "monthly" only, a number specifying the day of the month to send (1 - 28) or "last" for the last day of a given month. Defaults to the 1st day of the month array days optional used for "daily" schedules only, an array of the <a href="http://en.wikipedia.org/wiki/ISO-8601#Week_dates" target="_blank">ISO-8601 weekday numbers</a> to send on<div style="padding-left:15px"><table> bool 1 optional Monday, defaults to true bool 2 optional Tuesday, defaults to true bool 3 optional Wednesday, defaults to true bool 4 optional Thursday, defaults to true bool 5 optional Friday, defaults to true bool 6 optional Saturday, defaults to true bool 7 optional Sunday, defaults to true</table></div>
For A/B Split campaigns, this array should contain: string split_test The values to segment based on. Currently, one of: "subject", "from_name", "schedule". NOTE, for "schedule", you will need to call campaignSchedule() separately! string pick_winner How the winner will be picked, one of: "opens" (by the open_rate), "clicks" (by the click rate), "manual" (you pick manually) int wait_units optional the default time unit to wait before auto-selecting a winner - use "3600" for hours, "86400" for days. Defaults to 86400. int wait_time optional the number of units to wait before auto-selecting a winner - defaults to 1, so if not set, a winner will be selected after 1 Day. int split_size optional this is a percentage of what size the Campaign's List plus any segmentation options results in. "schedule" type forces 50%, all others default to 10% string from_name_a optional sort of, required when split_test is "from_name" string from_name_b optional sort of, required when split_test is "from_name" string from_email_a optional sort of, required when split_test is "from_name" string from_email_b optional sort of, required when split_test is "from_name" string subject_a optional sort of, required when split_test is "subject" string subject_b optional sort of, required when split_test is "subject"
For AutoResponder campaigns, this array should contain: string offset-units one of "hourly", "day", "week", "month", "year" - required string offset-time optional, sort of - the number of units must be a number greater than 0 for signup based autoresponders, ignored for "hourly" string offset-dir either "before" or "after", ignored for "hourly" string event optional "signup" (default) to base this members added to a list, "date", "annual", or "birthday" to base this on merge field in the list, "campaignOpen" or "campaignClicka" to base this on any activity for a campaign, "campaignClicko" to base this on clicks on a specific URL in a campaign, "mergeChanged" to base this on a specific merge field being changed to a specific value string event-datemerge optional sort of, this is required if the event is "date", "annual", "birthday", or "mergeChanged" string campaign_id optional sort of, required for "campaignOpen", "campaignClicka", or "campaignClicko" string campaign_url optional sort of, required for "campaignClicko" int schedule_hour The hour of the day - 24 hour format in GMT - the autoresponder should be triggered, ignored for "hourly" boolean use_import_time whether or not imported subscribers (ie, <em>any</em> non-double optin subscribers) will receive array days optional used for "daily" schedules only, an array of the <a href="http://en.wikipedia.org/wiki/ISO-8601#Week_dates" target="_blank">ISO-8601 weekday numbers</a> to send on<div style="padding-left:15px"><table> bool 1 optional Monday, defaults to true bool 2 optional Tuesday, defaults to true bool 3 optional Wednesday, defaults to true bool 4 optional Thursday, defaults to true bool 5 optional Friday, defaults to true bool 6 optional Saturday, defaults to true bool 7 optional Sunday, defaults to true</table></div>