Przejdź do treści

Create and activate workflow message

Creates and activates a workflow message

Request data format

Data part of request for creating a new workflow message.

Data element children:

Element/attributeTypeNotes
RecipientscomplexMessage’s recipients’ information. Required.
ContentcomplexContent information. Required.
DeliverySettingscomplexDelivery settings (channels, bcc, etc). Optional. If omitted, default delivery settings will be used.

Recipients element children:

Element/attributeTypeNotes
SuppressionListsarray[integer]Array of SuppressionList elements containing IDs of suppression lists that will be checked during shipment. Optional.

Content element children:

Element/attributeTypeNotes
FromNamestringString put into “From:” header. Required.
FromEmailstringEmail put into “From:” header. Required.
ReplyToNamestringString put into “Reply-To:” header. Optional.
ReplyToEmailstringEmail put into “Reply-To:” header. Optional.
SubjectstringNewsletter subject. Required.
HtmlstringHTML content of newsletter. The data should be enclosed in CDATA section for XML transport. See examples. Optional.*
PlainstringPlain text content of newsletter. Optional.*
AmpHtmlstringAMP HTML content of newsletter. The data should be enclosed in CDATA section for XML transport. See examples. Optional.*
Preheaderstring Newsletter preheader. Optional.
HeaderintegerID of header template to use. Optional.
FooterintegerID of footer template to use. Optional.
ContentFromUrlcomplexUsed if content is not inside XML request but has to be downloaded from external source. Optional.*
GoogleAnalyticsTagscomplexGoogle Analytics tags used to decorate links inside newsletter’s content. Optional. If omitted, Google Analytics will be disabled for created newsletter.
CustomUtmsarray[complex]Array of CustomUtm elements used to add custom information to URLs in the newsletter. Optional.
Tagsarray[string]List of tags used to mark the newsletter for convenience reasons. Optional.
AttachmentscomplexCollection of “Attachment” elements, containing additional attachment data (e.g. encoded PDF files sent with the newsletter). Optional.**
UrlIntegrationscomplexList of IDs of URL integrations that were created in Business unit settings. Optional.
EnableClickTrackbooleanIf set to “false”, clicks won’t be tracked. By default set to “true”. Optional.
EnableOpenTrackbooleanIf set to “false”, opens won’t be tracked. By default set to “true”. Optional.

* You may either put content of newsletter 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 newsletter, using ContentFromUrl method is the only way to do it.

ContentFromUrl element children:

Element/attributeTypeNotes
UrlstringURL address of imported file. Supported protocols are HTTP, HTTPS, FTP, FTPS and SFTP. E.g. ftp://www.domain.com/mycreative.zip
UsernamestringUsername used for authentication. Optional.
PasswordstringPassword used for authentication. Optional.
FtpAuthstringAuthentication method for secure FTP servers. Optional. Valid values are:
None – FTP server does not support secure authentication (default)
ExplicitTls – Explicit TLS/SSL authentication
ExplicitSsl – Explicit SSL only authentication
ImplicitSsl – Implicit SSL authentication
FtpUseActiveModebooleanIf set to “true”, active mode will be used for FTP connections. Default value is “false” – passive connection mode will be used.

GoogleAnalyticsTags element children:

Element/attributeTypeNotes
CampaignstringGoogle Analytics tag “utm_campaign”. Optional.
SourcestringGoogle Analytics tag “utm_source”. Optional.
ContentstringGoogle Analytics tag “utm_content”. Optional.

Note: The remaining tag, “utm_medium” is by default specified as “Email”.

CustomUtms element children:

Element/attributeTypeNotes
NamestringThe name of the custom UTM parameter. Maximum length: 255 characters. The name cannot be empty and must be unique.
Do not reuse names already reserved by Google Analytics (e.g., utm_source, utm_medium, utm_campaign, utm_term, utm_content).
ValuestringThe value assigned to the UTM parameter. Maximum length: 255 characters. The value cannot be empty.

Attachment element children:

Element/attributeTypeNotes
FileNamestringAttachment filename. E.g. “infosheet.pdf”. Should be unique (no 2 attachments should have the same filename). Required.
MimeTypestringFile type according to MIME standards. E.g. “application/pdf”. If omitted, default MIME type will be used: “application/octet-stream”. Optional. MIME type can affect how email attachments are treated in different email clients, so it is advisable to always specify the correct type.*
ContentstringAttachment file content. Must be Base64 encoded.** See example requests. Required.

* 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:

Element/attributeTypeNotes
IDintId number of existing, not deleted integration. Required.

Example:

<UrlIntegrations>
    <UrlIntegration>
        <Id>30</Id>
    </UrlIntegration>
    <UrlIntegration>
        <Id>32</Id>
    </UrlIntegration>
</UrlIntegrations>

DeliverySettings element children:

Element/attributeTypeNotes
EnableClickTrackbooleanIf set to “false”, clicks won’t be tracked. By default set to “true”. Optional.
EnableOpenTrackbooleanIf set to “false”, opens won’t be tracked. By default set to “true”. Optional.
Tagsarray[string]Message tags. Optional.
BccstringEmail address/-es which will receive a hidden copy of each message. Optional.*
ChannelsModestringIndicates whether message should use standard channel settings or custom settings provided in next element. Allowed values: “Standard” (default), “Custom”. Optional.
Channelsarray[complex]Array of Channel elements describing delivery channels. Optional. If omitted, standard (unit) channel settings will be used to deliver the newsletter.

* Note: It is also possible to use personalization tags and multiple email addresses separated with ‘;’. Each email address provided will double the volume of this message. Dynamic content is not available for Bcc element.

Channel element children:

Element/attributeTypeNotes
IpstringDelivery channel IP address.
PercentageintegerPortion (%) of emails that will be sent using this delivery channel.*

* 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 newsletter. ID can be used to retrieve message statistics (see /Api/MessageStatistics).

Response Data element:

Element/attributeTypeNotes
(Data element content)intID of created newsletter.

Examples

Creating a workflow message

Request in XML format:

POST https://api.esv2.com/v2/Api/WorkflowMessages 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: 457 

 <ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <ApiKey>2OAEcpz0Rwv3Mhc9nTQK</ApiKey>
   <Data>
     <Recipients>
       <SuppressionLists>
         <SuppressionList>12</SuppressionList>
         <SuppressionList>34</SuppressionList>
       </SuppressionLists>
     </Recipients>
     <Content>
       <FromName>Automation</FromName>
       <FromEmail>automation@example.com</FromEmail>
       <ReplyToName>Support Team</ReplyToName>
       <ReplyToEmail>support@example.com</ReplyToEmail>
       <Subject>Workflow API - standard channels</Subject>
       <Preheader>Preview for workflow message</Preheader>
       <Html><![CDATA[
        <html>
          <body>
            <h1>Hello!</h1>
            <p>Hello friend, how are you?</p>
          </body>
        </html>
        ]]></Html>
       <Plain>Hello friend, how are you?</Plain>
    </Content>
    <DeliverySettings>
      <EnableClickTrack>true</EnableClickTrack>
      <Bcc>bcc.address@domain.com</Bcc>
      <ChannelsMode>Custom</ChannelsMode>
      <Channels>
        <Channel>
          <Ip>192.168.10.22</Ip>
          <Percentage>70</Percentage>
        </Channel>
        <Channel>
          <Ip>192.168.10.3</Ip>
          <Percentage>30</Percentage>
        </Channel>
      </Channels>
    </DeliverySettings>
   </Data>
 </ApiRequest>

Response in XML format:

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>