Skip Navigation Links.
展开 最小化

SpreadWebServcie.CreateCampaign2 Method

An advanced method of creating Email campaign.
public int createCampaign2(
 string loginEmail,
 string password,
 string campaignName,
 CampaignCreatives campaignCreatives[],
 string category[],
 int interval, 
 DateTime schedule, 
 string signature, 
 CampaignStatus campaignStatus
 )
 Public Function createCampaign2(
 ByVal loginEmail As String,
 ByVal password As String,
 ByVal campaignName As String,
 ByVal campaignCreatives() As CampaignCreatives,
 ByVal category() As String,
 ByVal interval As Integer, 
 ByVal schedule As Date, 
 ByVal signature As String, 
 ByVal campaignStatus As CampaignStatus) As Integer
No sample for PHP.
No sample.

Parameters

Parameter

Type

Description

loginEmail

String

Your Spread account.

password

String

API key or password of your Spread account API Key which you can retrieve from your Spread account (My account=> Settings).

campaignName

String

Campaign name will be display in our platform

CampaignCreatives

Creative[]

The array of Creative Creative

category

String[]

The array of contact list name.

interval

Integer

The type of the campaign.

interval=-1Emails are sent for once only.

interval>=0Email will be sent N day(s) after a subscriber subscribed.

schedule

DateTime

Scheduled delivery time for the email campaigns.
Recommend datetime format: yyyy-MM-ddTHH:mm:ss. Timezone: UTC +08:00.

signatureTag

String

Add a tag as your mark, not the signature of this mail

campaignStatus

CampaignStatus

Waiting or Draft ,wait but will not send until schedule

Return Value

Integer Return CampaignID(>0) if success.

Example

	string loginEmail = "spread@reasonables.com";
	string loginPassword = "API KEY";
	string campaignName = "The Name will display in our platform";
	int interval = -1; //-1 send at once or n days later
	DateTime schedule = DateTime.Now;
	string[] category = { "General-VIPME-4", "luohaihao&romeqaz" }; //contact list 
	var campaignStatus = SpreadWS.CampaignStatus.Waiting;

	var creative = new SpreadWS.CampaignCreatives(); //creative is the mail content , define below
	creative.displayName = "ReasonableTech"; //sender name
	creative.fromAddress = "autoedm@reasonable.com";
	creative.subject = "Learn Spread API";
	creative.creativeContent = "Make your own applications with SpreadWS";
	creative.isCampaignDefault = true; //indicate default if there's multi creative
	creative.replyTo = "hoyho@foxmail.com";
	creative.target = "D"; //indicate this campaign is desktop version
	var campaignCreatives = new[] { creative }; //campaignCreatives is array of creative ,if you want to sent more creative in one campaign,set value of campaignCreatives

	var ws = new SpreadWS.Service();
	int campaignId = ws.createCampaign2(loginEmail, loginPassword, campaignName, campaignCreatives, category, interval, schedule, "spread", campaignStatus);
	return campaignId;
	Dim loginEmail As String = "spread@reasonables.com"
	Dim loginPassword As String = "API KEY"
	Dim campaignName As String = "The Name will display in spread platform"
	Dim interval As Integer = -1 '-1 send at once or n days later
	Dim schedule As DateTime = DateTime.Now
	Dim category As String() = {"General-VIPME-4", "luohaihao&romeqaz"} 'contact list 
	Dim status As SpreadWS.CampaignStatus = SpreadWS.CampaignStatus.Waiting

	Dim creative As SpreadWS.CampaignCreatives = New SpreadWS.CampaignCreatives()  'creative is the mail content , define as below
	With creative
		.creativeContent = "Make your own applications with SpreadWS"
		.displayName = "ReasonableTech"  'sender name
		.fromAddress = "autoedm@reasonable.com"
		.isCampaignDefault = True
		.replyTo = "hluo@reasonables.com"
		.subject = "Learn Spread API"
		.target = "D"  'indicate this campaign is DeskTop version
	End With
	Dim campaignCreative(0) As SpreadWS.CampaignCreatives
	campaignCreative(0) = creative 'campaignCreatives is array of creative ,if you want to sent more creative in one campaign,set value of campaignCreatives

	Dim client As SpreadWS.Service = New SpreadWS.Service()
	Dim campaignId As Integer = client.createCampaign2(loginEmail, loginPassword, campaignName, campaignCreative, category, interval, schedule, "spread", status)
function CreateCampaign2(){
          
        $loginEmail "spread@reasonables.com";
        $password 'API KEY';
        $category array('luohaihao&romeqaz','General-VIPME-4');  //ContactList
        $interval = -1; // -1 send at once,can set to n days later
        $schedule = time();
        $campaignStatus 'Waiting'//Waiting or Draft  ,wait until schedule time
        $campaignName "The Name will display in spread platform (php)";
  
        $creative array(
        'subject'  =>'Learn Spread API',      
        'creativeContent'  =>'Make your own applications with SpreadWS',            
        'displayName'  =>'ReasonableTech',                                     
        'fromAddress'  =>'autoedm@reasonable.com',                                          
        'target'  =>'D',  //indicate this creative is desktop version
        'isCampaignDefault'  =>True, //indicate default if there's multi creatives to se
        'replyTo'  =>'hoyho@foxmail.com'                         
        );
  
        $campaignCreatives array($creative);
  
        $campaignArgs array(
            'loginEmail'    => $loginEmail,
            'password'  => $password,
            'campaignName' => $campaignName,
            'campaignCreatives' => $campaignCreatives,
            'category'  => $category,
            'interval'  => $interval,
            'schedule'  => $schedule,
            'signature' => "spread remark",
            'campaignStatus' => $campaignStatus
        );
        $Client=new SoapClient("http://service1.rspread.com/Service.asmx?WSDL");
        $cpnId $Client -> createCampaign2( $campaignArgs );  //campaignID
        echo serialize($cpnId);
        //echo ($cpnId);
    }
    
POST {{YOUR_API_URL}}/service.asmx 

Content-Type: application/soap+xml; charset=utf-8
Content-Length: {{length}}

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <createCampaign2 xmlns="http://service.reasonablespread.com/">
      <loginEmail>spread@reasonables.com</loginEmail>
      <password>TEST0000-TEST-0000-TEST-0000TEST0000</password>
      <campaignName>The Name will display in our platform</campaignName>
      <campaignCreatives>
        <CampaignCreatives>
          <subject>Learn Spread API</subject>
          <displayName>ReasonableTech</displayName>
          <fromAddress>autoedm@reasonable.com</fromAddress>
          <replyTo>hoyho@foxmail.com</replyTo>
          <creativeContent>Make your own applications with SpreadWS</creativeContent>
          <target>D</target>
          <isCampaignDefault>true</isCampaignDefault>
        </CampaignCreatives>
      </campaignCreatives>
      <category>
        <string>General-VIPME-4</string>
        <string>luohaihao&romeqaz</string>
      </category>
      <interval>-1</interval>
      <schedule>2023-02-06T12:11:21</schedule>
      <signature></signature>
      <campaignStatus>Waiting</campaignStatus>
    </createCampaign2>
  </soap12:Body>
</soap12:Envelope>