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:
{
"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:
{
"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:
{
"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:
{
"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:
{
"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:
Parameter | Description | Example |
---|---|---|
template | The name of the template to preview | my-template |
blast_id | The id of the blast to preview | 123456 |
blast_repeat_id | The id of the repeating blast to preview | 4d9553239c409dff34000026 |
content_html | A block of text to parse and preview |
|
And one of the following two parameters:
Parameter | Description | Example |
---|---|---|
email | The email address of the user for whom to generate dynamic content. This will return in content_html | support@sailthru.com |
send_email | The email address to receive the preview. | support@sailthru.com |
Optional Parameters
Parameter | Description | Example |
---|---|---|
data_feed_url | URL of the data feed to populate a content_html request | https://www.example.com/example.xml |
day | the date to preview | Wed, 02 May 2013 |
test_vars | preview 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 Code | API Code | Meaning |
---|---|---|
400 | 99 | Required parameter missing. One of send_email or email are required, and one of template, blast_id, or blast_repeat_id are required. |
400 | 99 | Invalid email address. The email address specified in email or send_email is not a valid email address. |
400 | 99 | Invalid JSON provided |
404 | 99 | Specified template or blast does not exist. The specified template, blast_id, or blast_repeat_id does not exist. |