ResourcesAPI documentation

mailkit.campaigns.create

Function mailkit.campaigns.create is used to create a new campaign.

XML-RPC request must be sent in the format displayed below. 

NOTICE: Data must be Base64 encoded.

API call example:

XML

 <?xml version="1.0"?>
 <methodCall>
  <methodName>mailkit.campaigns.create</methodName>
  <params>
   <param>
   <value>
    <int>client_id</int>
   </value>
   </param>
   <param>
   <value>
    <string>client-md5</string>
   </value>
   </param>
   <param>
   <value>
    <struct>
     <member>
      <name>name</name>
      <value>
       <string>campaign name</string>
      </value>
     </member>
     <member>
      <name>subject</name>
      <value>
       <string>subject</string>
      </value>
     </member>
     <member>
      <name>ID_allow_email</name>
      <value>
       <string>ID of sending email address</string>
      </value>
     </member>
     <member>
      <name>type_message</name>
      <value>
       <string>email|sms</string>
      </value>
     </member>
     <member>
      <name>ID_mailing_list</name>
      <value>
       <string>ID of mailing list</string>
      </value>
     </member>
     <member>
      <name>ID_delivery_feed</name>
      <value>
       <string>ID of delivery feed datasource</string>
      </value>
     </member>
     <member>
      <name>ID_query</name>
      <value>
       <string>ID of query</string>
      </value>
     </member>
     <member>
      <name>ID_template</name>
      <value>
       <string>ID of template</string>
      </value>
     </member>
     <member>
      <name>google_analytics</name>
      <value>
       <string>true|false</string>
      </value>
     </member>
     <member>
      <name>analytic_name</name>
      <value>
       <string>name for analytics</string>
      </value>
     </member>
     <member>
      <name>ID_tagset</name>
      <value>
       <string>ID of tagset</string>
      </value>
     </member>
     <member>
      <name>content</name>
      <value>
       <string>content 1</string>
      </value>
     </member>
     <member>
      <name>reply_to</name>
      <value>
       <string>email@domain.com</string>
      </value>
     </member>
     <member>
      <name>unsubscribe_email</name>
      <value>
       <string>email@domain.com</string>
      </value>
     </member>
     <member>
      <name>web_template</name>
      <value>
       <string>true|false</string>
      </value>
     </member>
     <member>
      <name>style_inline</name>
      <value>
       <string>true|false</string>
      </value>
     </member>
     <member>
      <name>ID_unsubscribe_group</name>
      <value>
       <string>ID of topic</string>
      </value>
     </member>
    </struct>
   </value>
   </param>

---settings related to AB test, B version of campaign---
   <param>
     <value>
       <struct>
         <member>
           <name>subject</name>
           <value>
             <string>subject B version</string>
           </value>
         </member>
         <member>
           <name>content</name>
           <value>
             <string>content 1 B version</string>
           </value>
         </member>
         <member>
           <name>content2</name>
           <value>
             <string>content 2 B</string>
           </value>
         </member>         
         <member>
           <name>ID_allow_email</name>
           <value>
             <string>ID of sender email address</string>
           </value>
         </member>
         <member>
           <name>ab_percentage</name>
           <value>
             <string>1-99</string>
           </value>
         </member>
         <member>
           <name>ab_evalution</name>
           <value>
             <string>open|click|conversion|ctr</string>
           </value>
         </member>
         <member>
           <name>ab_evalution_time</name>
           <value>
             <string>1h-4d</string>
           </value>
         </member>
       </struct>
     </value>
   </param>
------
 </params>
</methodCall>
		

JSON

{
	"function": "mailkit.campaigns.create",
	"id": "client_id",
	"md5": "client_md5",
	"parameters": {
		"name": "name",
		"subject": "subject",
		"ID_allow_email": "ID of sending email address",
		"ID_mailing_list":"ID of mailing list",
		"ID_delivery_feed":"ID of delivery feed datasource",
		"ID_query":"ID of query",
		"ID_template":"ID of template",
		"type_message":"email|sms",
		"google_analytics":"true|false",
		"analytic_name":"name for analytics",
		"ID_tagset":"ID of tagset",
		"test_mode":"true|false",
		"test_emails":"comma separated list of emails",
		"content":"content 1",
		"content2":"content 2",
		"content3":"content 3",
		"content4":"content 4",
		"content5":"content 5",
		"content6":"content 6",
		"content7":"content 7",
		"content8":"content 8",
		"content9":"content 9",
		"content10":"content 10",
		"reply_to":"email@domain.com",
		"unsubscribe_email":"email@domain.com",
		"web_template":"true|false",
		"style_inline":"true|false",
		"ID_unsubscribe_group":"ID of topic"
	},
	"ab_version":{
		"subject":"subject B version",
		"content":"content 1 B version",
		"content2":"content 2 B version",
		"ID_allow_email":"ID of sending email address",
		"ID_template":"ID of template",
		"ab_percentage":"1-99",
		"ab_evaluation":"open|click|conversion|ctr",
		"ab_evaluation_time":"1h-4d"
	}
}

Values

client_id * = client ID can be found in your Mailkit account's menu Profile / Integration / API settings.

client_md5 * = MD5 code can be found in your Mailkit account's menu Profile / Integration / API settings.

name (Base64) * = name of campaign

subject (Base64) * = subject of campaign

ID_allow_email (Base64) * = ID of sender address

type_message (Base64) = type of message

  • email = e-mail campaign
  • sms = SMS campaign

ID_mailing_list (Base64) = ID of mailing list / lists. (ID of mailing lists are comma separated)
ID_delivery_feed (Base64) = ID of data source used for delivery (delivery feed). Campaign may have either a mailing list (one or many) or a delivery feed assigned (one).

ID_template (Base64) = ID of template
ID_query (Base64) = ID of query (only when used together with mailing lists)
google_analytics (v base64) = automatically tag links using UTM parameters for analytics

  • true = enabled
  • false = disabled

analytics_name (v base64) = UTM analytics campaign name
ID_tagset (base64) = ID of tagset for Google Analytics

content (Base64) = content 1

content2 (Base64) = content 2. Total number of contents is 10.

content_txt (Base64) = content in TXT format. (When autogenerating plain text from HTML is off).

files (Base64) = ID of attachments (ID of attachments are comma separated)

reply_to (Base64) = e-mail address for reply-to

unsubscribe_email (Base64) = e-mail address for sending unsubscribes

web_template (Base64) = use microsite

  • true = yes
  • false = no

style_inline (Base64) = convert CSS styles to inline

  • true = yes
  • false = no

ID_unsubscribe_group (Base64) = ID of topic

ab_percentage (base64) = AB test group size as percentage (1 - 99)

ab_evalution (base64) = AB test evaluation criteria (open|click|conversion|ctr)

ab_evalution_time (base64) = AB test evaluation time (1h - 23h, 1d - 4d)

* required value

Successful call response:

XML

<?xml version="1.0" encoding="utf-8"?>
<methodResponse>
  <params>
    <param>
      <value>
        <i4>123456789</i4>
      </value>
    </param>
  </params>
</methodResponse>

JSON

{
    "message": "Campaign 123456789 created",
    "error_status": 0,
    "ID_message": "123456789"
}

Values

ID of newly created campaign

Unsuccessful call response:

XML

<?xml version="1.0" encoding="utf-8"?>
<methodResponse>
  <params>
    <param>
      <value>
        <string>Missing name of campaign</string>
      </value>
    </param>
  </params>
</methodResponse>

JSON

{
    "error_status": 1,
    "error_code": 1,
    "error": "Missing name of campaign"
}

Values

Missing name of campaign (error_code:1) = campaign name is missing
Missing subject of campaign (error_code:2/52 for B ver) = campaign subject is missing
Missing ID allow email (error_code:3/53 for B ver) = ID_allow_email is missing

error allow email: ID, status, auth (error_code:4/54 for B ver) = ID_allow_email selected can not be used (sending address is not properly configured
Wrong ID_template (error_code:5/55 for B ver) = ID_template provided is not valid
Invalid ID_query (error_code:6) = Requested query ID was not found
Wrong ID_query (error_code: 7) =Requested query can not be used
Invalid ID_delivery_feed (error_code: 8) = Requested delivery feed ID doesn't exist or is not a delivery feed data source.
No valid emails provided in test_emails param (error_code: 9) = Empty or invalid list of emails provided
Invalid tagset ID (error_code: 10) = Requested tagset doesn't exist
Wrong ID_mailing_list (error_code: 11) = Invalid mailing list ID requested
Confused parameters - it is not possible to combine mailing lists and delivery feeds (error_code: 12) = Request contains both mailing list ID and delivery feed ID which is an invalid combination.
Confused parameters - it is not possible to combine delivery capping and delivery feeds (error_code: 13) = Request contains both delivery feed ID and delivery capping query ID which is an invalid combination.
Content failed to save (error_code: 14) = An error occurred while saving message content.
Missing ab percentage (error_code: 82) = AB test group size percentage value is missing
Wrong ab percentage (error_code: 83) = Invalid AB test group size percentage
Wrong ab evalution (error_code: 81) = Invalid AB test evaluation policy requested
Wrong ab evalution time (error_code: 81) = Invalid AB test evaluation time duration requested