DEPRECATED: The createEmailCampaign() method is no longer supported. Use the createEmail() method instead. We’ve made a short guide to simplify the transition to createEmail.
The createEmailCampaign() method creates the specified email campaign using the legacy email creation workflow.
The createEmailCampaign() method creates the specified email campaign using the legacy email creation workflow.
Input
[vrtypens:createEmailCampaignArgs]
session_id [xsd:string] (required)
Your API session id.
email_campaign [vrtypens:EmailCampaign] (required)
DEPRECATED: This object as been replaced by the Email object
An EmailCampaign object representing the new campaign. You may provide the following
fields at the time of creation:
An EmailCampaign object representing the new campaign. You may provide the following
fields at the time of creation:
- name
- type
- template_id (for template campaigns)
- from_label
- send_friend
- mail_date
Only name, type, and template_id (only for template campaigns) are required.
The “type” attribute can only be set to one of the following:
- template
- canvas
- freeform
- freeform_text
Campaign contents can also be provided here. See setEmailCampaignContent() for details regarding which content types
are available for which email campaign types. For template campaigns, a list of template modules can be provided as well.
Output
[xsd:int]
Examples
Java
EmailCampaign campaign = new EmailCampaign(); campaign.setName( "API Lifecycle " + timestamp ); campaign.setType( "freeform" ); campaign.setSupport_email( System.getProperty( "com.verticalresponse.vrapi_login_email_address" ) ); campaign.setFrom_label( "VR API" ); // required campaign contents java.util.List contents = new ArrayList(); contents.add( new EmailCampaignContent( "subject", "Campaign created with VR API" ) ); contents.add( new EmailCampaignContent( "freeform_text", "Hello, {FIRST_NAME} {LAST_NAME}. " + "This campaign was created via the VerticalResponse API http://www.verticalresponse.com/labs/." ) ); contents.add( new EmailCampaignContent( "freeform_html", "Hello, {FIRST_NAME} {LAST_NAME}. " + "This campaign was created via the
Perl
$vrapi->createEmailCampaign( { session_id => $sid, email_campaign => { name => "campaign_" . time(), type => 'freeform', from_label => 'XYY_newsletter', support_email => 'email@address.com', send_friend => 'true', redirect_url => 'http://www.verticalresponse.com/labs', contents => [ { type => 'freeform_html', copy => '<h1>Hello World</h1>Pretty original, huh?', }, { type => 'freeform_text', copy => 'Hola World!', }, { type => 'subject', copy => 'My original subject line', }, { type => 'unsub_message', copy => 'You requested these emails, if you would like to be removed from the list? ', }, ], }, } );
PHP
$vrapi->createEmailCampaign( array( 'session_id' => $sid, 'email_campaign' => array( 'name' => "campaign_" . time(), 'type' => 'freeform', 'from_label' => 'XYY_newsletter', 'support_email' => 'email@address.com', 'send_friend' => 'true', 'redirect_url' => 'http://www.verticalresponse.com/labs', 'contents' => array( array( 'type' => 'freeform_html', 'copy' => '<h1>Hello World</h1>Pretty original, huh?', ), array( 'type' => 'freeform_text', 'copy' => 'Hola World!', ), array( 'type' => 'subject', 'copy' => 'My original subject line', ), array( 'type' => 'unsub_message', 'copy' => 'You requested these emails, if you would like to be removed from the list? ', ), ), ), ) );
Ruby
vr.createEmailCampaign({ 'session_id' => sid, 'email_campaign' => { 'name' => "campaign" , 'type' => 'freeform', 'from_label' => 'XYY_newsletter', 'support_email' => 'email@address.com', 'send_friend' => 'true', 'redirect_url' => 'http://www.verticalresponse.com/labs', 'contents' => [ { 'type' => 'freeform_html', 'copy' => '<h1>Hello World</h1>Pretty original, huh?', }, { 'type' => 'freeform_text', 'copy' => 'Hola World!', }, { 'type' => 'subject', 'copy' => 'My original subject line', }, { 'type' => 'unsub_message', 'copy' => 'You requested these emails, if you would like to be removed from the list? ', }, ], }, } );
C#.NET
EmailCampaignContent[] objCampaignContents = new EmailCampaignContent[4]; EmailCampaignContent html = new EmailCampaignContent(); html.type = "freeform_html"; html.copy = "<h1>Hello World</h1>Pretty original, huh?"; objCampaignContents[0] = html; EmailCampaignContent text = new EmailCampaignContent(); text.type = "freeform_text"; text.copy = "Hello, World!"; objCampaignContents[1] = text; EmailCampaignContent subject = new EmailCampaignContent(); subject.type = "subject"; subject.copy = "My original subject line"; objCampaignContents[2] = subject; EmailCampaignContent unsub_message = new EmailCampaignContent(); unsub_message.type = "unsub_message"; unsub_message.copy = "If you want to unsubscribe, click "; objCampaignContents[3] = unsub_message; createEmailCampaignArgs objeCampaignArgs = new createEmailCampaignArgs(); EmailCampaign objeCampaign = new EmailCampaign(); objeCampaign.name = "Campaign Test"; objeCampaign.type = "freeform"; objeCampaign.from_label = "XYZ_Newsletter"; objeCampaign.mail_date = Convert.ToDateTime (DateTime.Now.ToString("s")); //Date should be in ISO 8601 format objeCampaign.send_friend = true; objeCampaign.redirect_url = "http://www.verticalresponse.com/labs"; objeCampaign.contents = objCampaignContent; objeCampaignArgs.session_id = _sSessionId; objeCampaignArgs.email_campaign = objeCampaign; int iCampaignID = objVR.createEmailCampaign(objeCampaignArgs);