Create transactional message
Creates a transactional message. Content can either be sent along with the request or stored on an external source (e.g. FTP server).
Request data format
Data part of request for creating a new transactional.
Data element children:
Content element children:
* You may either put content of transactional inside using Html, Plain and/or AmpHtml elements or specify that content is to be downloaded from external source (such as webpage or FTP server as zipped file with HTML and images) using ContentFromUrl element. If content was not found in either place, an error message will be returned. If there are more than one Html, Plain and/or AmpHtml files only the last file will be the content of message. If you would like to send AMP Html you should provide Html and/or Plain as a fallback version of email.
AMP Html content must contain all needed elements (see examples) and all links must be secure links (like https://)
** It is not possible to have both ContentFromUrl and Attachments elements at the same time.
Note: If you wish to send inline images within your transactional, using ContentFromUrl method is the only way to do it.
ContentFromUrl element children:
GoogleAnalyticsTags element children:
Note: The remaining tag, "utm_medium" is by default specified as "Email".
Attachment element children:
* Note: For list of MIME types for different files, see: http://en.wikipedia.org/wiki/Internet_media_type
** Note: Binary to Base64 encoding is available in most programming languages. For more information about Base64 encoding, see: http://en.wikipedia.org/wiki/Base64
UrlIntegrations element children:
Example:
<UrlIntegrations>
<UrlIntegration>
<Id>30</Id>
</UrlIntegration>
<UrlIntegration>
<Id>32</Id>
</UrlIntegration>
</UrlIntegrations>
Channel element children:
* The sum of percentage for all selected channels must be 100% or an error message will occur. Example configuration could be 2 channels with 30/70 ratio or 3 channels with 25/25/50 ratio. A list of available channels can be found in unit settings, in ExpertSender panel.
Response
Method returns ID of created transactional. ID can be used to retrieve message statistics (see /Api/MessageStatistics) to ascertain transactionals progress.
Response Data element:
Examples
Creating a transactional message
Request:
POST https://api.esv2.com/v2/Api/TransactionalsCreate HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.esv2.com
Content-Length: 1727
<ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<ApiKey>test_api_key</ApiKey>
<Data>
<Content>
<FromName>test</FromName>
<FromEmail>test@test.com</FromEmail>
<Subject>Hello!</Subject>
<Html><![CDATA[HelloWorld!<br/>${Snippet('name')}<br/>${Snippet('age')}<br/>]]></Html>
</Content>
<Status>Active</Status>
</Data>
</ApiRequest>
Response:
HTTP/1.1 201 Created
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 3.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 27 Mar 2012 13:28:01 GMT
Content-Length: 149
<ApiResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Data>1498</Data>
</ApiResponse>
Creating a transactional message with content downloaded from external source and full options
Request:
POST https://api.esv2.com/v2/Api/TransactionalsCreate HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.esv2.com
Content-Length: 1727
<ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<ApiKey>test_api_key</ApiKey>
<Data>
<SuppressionLists>
<SuppressionList>77</SuppressionList>
</SuppressionLists>
<Content>
<FromName>test</FromName>
<FromEmail>test@test.com</FromEmail>
<ReplyToName>test2</ReplyToName>
<ReplyToEmail>test2@test.pl</ReplyToEmail>
<Subject>Hello!</Subject>
<ContentFromUrl>
<Url>ftp://ftp.domain.com.creative.zip</Url>
<Username>username</Username>
<Password>password</Password>
<FtpAuth>ExplicitTls</FtpAuth>
</ContentFromUrl>
<GoogleAnalyticsTags>
<Campaign>testcampaign</Campaign>
<Source>testsource</Source>
<Content>testcontent</Content>
</GoogleAnalyticsTags>
<UrlIntegrations>
<UrlIntegration>
<Id>30</Id>
</UrlIntegration>
<UrlIntegration>
<Id>32</Id>
</UrlIntegration>
</UrlIntegrations>
<Tags>
<Tag>tag1</Tag>
<Tag>tag2</Tag>
</Tags>
<EnableClickTrack>true</EnableClickTrack>
<EnableOpenTrack>true</EnableOpenTrack>
</Content>
<Channels>
<Channel>
<Ip>192.168.10.22</Ip>
<Percentage>30</Percentage>
</Channel>
<Channel>
<Ip>192.168.10.3</Ip>
<Percentage>70</Percentage>
</Channel>
</Channels>
<Status>Active</Status>
</Data>
</ApiRequest>
Creating a transactional message with attachment
Request:
POST https://api.esv2.com/v2/Api/TransactionalsCreate HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.esv2.com
Content-Length: 32566
<ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<ApiKey>test_api_key1</ApiKey>
<Data>
<Content>
<FromName>test</FromName>
<FromEmail>test@test.com</FromEmail>
<Subject>Hello!</Subject>
<Plain>Hello friend, how are you?</Plain>
<Attachments>
<Attachment>
<FileName>test.pdf</FileName>
<MimeType>application/pdf</MimeType> <Content>JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFu
ZyhwbC1QTCkgL1N0cnVjdFRyZWVSb290IDggMCBSL01hcmtJbmZvPDwvTWFya2VkIHRydWU+Pj4+
DQplbmRvYmoNCjIgMCBvYmoNCjw8L1R5cGUvUGFnZXMvQ291bnQgMS9LaWRzWyAzIDAgUl0gPj4N
CmVuZG9iag0KMyAwIG9iag0KPDwvVHlwZS9QYWdlL1BhcmVudCAyIDAgUi9SZXNvdXJjZXM8PC9G
...
ODlFOENBQTNGMTY5NzFBRTU+XSAvUHJldiA4MjU0MS9YUmVmU3RtIDgyMjcwPj4NCnN0YXJ0eHJl
Zg0KODMwNTcNCiUlRU9G</Content>
</Attachment>
</Attachments>
</Content>
</Data>
</ApiRequest>
Note: Part of long attachment content was cut and "..." was inserted.
Creating a transactional message with AMP Html content
Request:
POST https://api.esv2.com/v2/Api/TransactionalsCreate HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.esv2.com
Content-Length: 1727
<ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<ApiKey>test_api_key</ApiKey>
<Data>
<SuppressionLists>
<SuppressionList>77</SuppressionList>
</SuppressionLists>
<Content>
<FromEmail>test@test.com</FromEmail>
<Subject>Hello!</Subject>
<Html>Some fallback HTML code here</Html>
<AmpHtml><![CDATA[
<!doctype html>
<html amp4email>
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<style amp4email-boilerplate>body{visibility:hidden}</style>
</head>
<body>
Hello, AMP world.
Please use AMP markup if there is such like "amp-img" instead of "img"
<amp-img src="https://sites.google.com/site/expertsenderapiv2/_/rsrc/1530873497175/config/Es- API.png.1530873496983.png"
alt="Welcome"
width="906"
height="132">
</amp-img>
</body>
</html>
]]></AmpHtml>
</Content>
<Channels>
<Channel>
<Ip>192.168.10.22</Ip>
<Percentage>30</Percentage>
</Channel>
<Channel>
<Ip>192.168.10.3</Ip>
<Percentage>70</Percentage>
</Channel>
</Channels>
<Status>Active</Status>
</Data>
</ApiRequest>