Campaigns – operating a campaign

Sending a campaign

Creating a new campaig:

POST /rest/campaigns/edit

 

Data in POST:

id_hash Required  Hash of campaign to be edited
name Optional Campaign name
url Optional Website address from which the HTML code is to be downloaded
html Opcjonalne Email text content
text Optional Email text content
subject Optional Subject of email to be sent by the system. In case of no such subject, name of the campaign will be taken
from_address Optional "From" field. If empty, a default sender's address will be filled in.
from_name Optional "Sender's name" field. If empty, a default sender's name will be filled in.
reply_to Optional Reply to" field. If empty, a default sender's address will be filled in.
list Optional Hash of subscriber list to which the campaign is to be sent. It can be a table with hashes in case of sending to several lists. In case of sending to a group, there is no need to define a list.
group Optional Hash of group to which the campaign is to be sent. It can be a table with hashes in case of sending to several groups. In case of sending to a list, there is no need to define a group.
resignlink Optional An URL address to which the subscriber will be redirected after clicking on the resignation link

 

 

Error codes:

1750 No campaign with defined hash to be edited
1751 Campaign was already set to be sent; modification is impossible.

Remaining codes are identical as in case of creating a campaign.

Deleting a campaign

Recall:
POST /rest/campaigns/delete

 

Data in POST:

hash Required Hash of campaign to be deleted

 

Error codes::

1724 No campaign with such hash
1798 Campaign already deleted

Sending a test campaign

Recall:
POST /rest/campaigns/sendTest

 

Data in POST:

hash Required Hash of campaign to be sent.
emails Required Address or address table to which the text is to be sent.
custom_fields Optional  Table with custom fields. In case of leaving an empty field, values in custom fields will be filled in with random data from subscriber list.

 

Example of request::

{"hash":"campaign_hash",
"emails":"test@test.com",
"custom_fields":{
"name":"John",
"surname":"Down"}}

 

lub

{"hash":"campaign_hash",
"emails":["test1@test.com","test2@test.com"]}

 

Error codes::

1721 No hash or incorrect hash.
1722 1722 No email address.
1723 At least one email address is incorrect.
1724 Campaign with such hash does not exist.
1725 Campaign is not ready for test sending.
1726

Sending unsuccessful.

Sending a campaign

Recall::
POST /rest/campaigns/send

 

Data in POST:

hash Required Hash of campaign to be edited
time Optional Optional Date of sending a campaign YYYY-MM-DD H:m:s

 

Error codes::

1731 Incorrect or no hash.
1732 Incorrect sending time.
1733 Sending time cannot be earlier than current time.
1734 Campaign with such hash does not exist.
1735 Campaign is not ready for test sending
1736 Campaign is already set to be sent or sending is in progress