Skip Navigation Links.
展开 最小化

SpreadWebServcie.CreateCampaign2 Method

創建電郵活動的高級方法
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.

參數

參數

類型

描述

loginEmail

String

你的思齊賬號

password

String

API key或者賬號密碼 API Key API key可在賬號詳情中查看 (我的賬號=> API).

campaignName

String

在平臺顯示的活動名稱

CampaignCreatives

Creative[]

Creative數組 Creative

category

String[]

數組

interval

Integer

活動類型

interval=-1電郵僅發送一次

interval>=0電郵將會在訂閲者訂閲后的N天發送

schedule

DateTime

電郵活動的計劃發送時間。
推薦日期格式:yyyy-MM-ddTHH:mm:ss,例如 '2016-08-22T12:11:21'
時區:UTC +08:00。

signatureTag

String

本次活動的標記,注:并非電郵正文的簽名

campaignStatus

CampaignStatus

等待或草稿,等待:當定時任務時間到了才會發送 草稿:手動發送

返回結果

Integer 如果成功則返回活動ID

例子

	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>