preview

Get a preview of a template, any custom HTML/Zephyr, campaign, or recurring campaign.

Tailor the resulting content to a specific user's email address, and optionally specify a different feed, var values, or other parameters that may apply to the source object. Receive the preview in the form of HTML code, or as an email sent to the specified recipient. Endpoint URL: https://api.sailthru.com/preview

GET/POST to Generate Preview

Either method (GET or POST) will produce the same response/result. These examples use the email parameter, which will return HTML that the recipient "email" would receive. Replace it with send_email in any call to have a test message sent (and tailored to) the send_email address.

By template

Example call:

Copy
{
   "template": "Welcome",
   "email": "test@sailthru.com"}

Gets the HTML of a test send of this template, as it would be sent to the specified address.

By blast_id

Example call:

Copy
{
   "blast_id": 8290891,
   "email": "test@sailthru.com"}

Gets the HTML of a test send of this campaign, as it would be sent to the specified address.

By blast_repeat_id

Example call:

Copy
{
   "blast_repeat_id": "58115c48e9328b03068b45a3",
   "email": "test@sailthru.com"}

Gets the HTML of a test send of this recurring campaign, as it would be sent to the specified address.

By custom content_html

Example call:

Copy
{
   "content_html" : "<!DOCTYPE html>\n<html>\n<head>\n</head>\n<body>\n<h1>Welcome test@sailthru.com!</h1>\n<p>Click here to <a href=\"#\">unsubscribe</a>.</p>\n</body>\n</html>",
   "email": "test@sailthru.com"}

Gets the HTML of a test send of this recurring campaign, as it would be sent to the specified address.

Response

Example Response:

Copy
{
   "from_name" : "Lifesavr",
   "subject" : "Welcome to Lifesavr",
   "content_html" : "<!DOCTYPE html>\n<html>\n<head>\n</head>\n<body>\n<h1>Welcome test@sailthru.com!</h1>\n<p>Click here to <a href=\"#\">unsubscribe</a>.</p>\n</body>\n</html>",
   "content_text" : "Welcome test@sailthru.com!\n\nClick here to unsubscribe <#>."}

You can also specify the optional parameters listed below:

  • a "data_feed_url" to use a different data feed from the one specified in the template or blast
  • "test_vars" to specify vars used by the Zephyr code in the template
  • a "day" to generate any date-specific content

Required Parameters

Specify one of the following 4 parameters:

ParameterDescriptionExample
templateThe name of the template to previewmy-template
blast_idThe id of the blast to preview123456
blast_repeat_idThe id of the repeating blast to preview4d9553239c409dff34000026
content_htmlA block of text to parse and preview

And one of the following two parameters:

ParameterDescriptionExample
emailThe email address of the user for whom to generate dynamic content. This will return in content_htmlsupport@sailthru.com
send_emailThe email address to receive the preview.support@sailthru.com

Optional Parameters

ParameterDescriptionExample
data_feed_urlURL of the data feed to populate a content_html requesthttps://www.example.com/example.xml
daythe date to previewWed, 02 May 2013
test_varspreview a dynamic email dependent on a specific variable"name":"Jack"

If you'd like to update the other elements of the object (template, campaign, or recurring campaign) that's being previewed, as a test (without modifying the source object), you can also pass any of the parameters associated with that object. To see a list of available options, please refer to the optional parameters of the template and blast calls.

Error Codes

HTTP CodeAPI CodeMeaning
40099Required parameter missing. One of send_email or email are required, and one of  template, blast_id, or blast_repeat_id are required.
40099Invalid email address. The email address specified in email or send_email is not a valid email address.
40099Invalid JSON provided
40499Specified template or blast does not exist. The specified template, blast_id, or blast_repeat_id does not exist.