template

Get, update, and delete your email templates.

See also Template Overview.

Endpoint URL: https://api.sailthru.com/template

GET Mode

Get information about existing templates.

Get All Templates

Example Call:
{}
Example Response:
{
    "templates" : [
 {
            "template_id" : 22,
            "name" : "Template Name",
            "labels" : null,
            "tags" : null,
            "subject" : "Subject Line",
            "modify_time" : "Wed, 23 Nov 2016 11:28:47 -0500",
            "mode" : "email",
            "data_feed_url" : "http://feed.sailthru.com/ws/feed?id=1234567890123",
            "is_disabled" : false,
            "teams" : []
        },
        {
            "template_id" : 28,
            "name" : "Template 2",
            "labels" : null,
            "tags" : null,
            "subject" : "Hello!",
            "modify_time" : "Wed, 02 Nov 2016 20:01:26 -0400",
            "mode" : "email",
            "data_feed_url" : null,
            "is_disabled" : false,
            "teams" : []
        }
 ]
}

Get Specific Template

Example Call
{"template":"My Template"}
Example Response
{
 "template_id" : 30,
 "labels" : [],
 "name" : "Test datafeed",
 "public_name" : null,
 "sample" : null,
 "from_name" : null,
 "from_email" : "example@sailthru.com",
 "replyto_email" : null,
 "subject" : "Test datafeed",
 "content_html" : "<html><body>\n<h2>Top things for {date('MMM dd, yyyy')}</h2>\n<p><img src=\"{beacon_src}\" /></p>\n<hr />\n<p>{foreach content as c}</p>\n<h3 style=\"padding-bottom: 0px; margin-bottom: 0px;\"><a href=\"{c.url}\">{c.title}</a></h3>\n<hr />\n<p>{/foreach}</p>\n<p><small>If you believe this has been sent to you in error, please safely <a href=\"{optout_confirm_url}\">unsubscribe</a>.</small></p>\n</body></html>",
 "content_text" : "",
 "success_url" : null,
 "error_url" : null,
 "verify_post_url" : null,
 "is_basic" : false,
 "is_link_tracking" : true,
 "is_google_analytics" : false,
 "is_invite" : false,
 "is_disabled" : false,
 "is_unviewable" : false,
 "is_optin" : false,
 "list" : null,
 "teams" : [],
 "type" : null,
 "test_vars" : null,
 "link_domain" : null,
 "link_params" : null,
 "ad_plan" : null,
 "revision_ids" : [
 201,
 204,
 211,
 213
 ],
 "revision_id" : 213,
 "setup" : null,
 "data_feed_url" : "http://feed.qa10.sailthru-qa.com/ws/feed?id=5817b84abcaad2612d175c20",
 "tags" : null,
 "mode" : "email"
}

Conditionally Required Parameters

Only one of these parameters is required.
Parameter Description Example
template the name of the template welcome
revision Revision ID for a given revision 24242
If none of the parameters are given, all the existing templates with their respective names will be returned. If revisionparameter is given, related data about template revision is returned. If only templateparameter is given, related data about a template is returned.

Optional Parameters

Parameter Description Example
sample the sample name (for A/B test templates) A
Optional parameter sampleworks only when used with templateparameter. Will return a data structure for a template including all of the fields passed into the POST call below.

POST Mode

Update or create a template

Create a Template

Examples Create template with name only; add other parameters later.
{"template":"My Template"}
Create template with subject and data feed.
{
   "template" : "My Template",
   "subject" : "Subject Line Here"
   "data_feed_url":"https://cb.sailthru.com/ws/feed?id=1234567890123"
}

Required Parameters

Parameter Description Example
template the name of the template welcome
If the revisionparameter is used, the template can be reverted to an earlier version. To update an existing template, pass templateand any parameters you wish to overwrite. For example, if the template currently contains data_feed_urlsubject, andfrom_email, you can pass just template and data_feed_url and this will change the data feed without changing the other parameters.

Optional Parameters

Parameter Description Example
revision Revision ID for a given revision. Using this in POST reverts a template back to a prior revision (must be a current revision id in the revision_ids array returned by GET template) 24242
data_feed_url The data feed to use in the template. See Code a Template Using a Data Feed https://cb.sailthru.com/ws/feed?id=501ffdb73c3109fe7b000005
sample The sample name (for A/B test templates) A
labels Add or remove a label by setting it to integer values 1 or 0, respectively; helpful for easier sorting {"AddLabel":1,"RemoveLabel":0}
public_name Public name of the template Wonderful Template
from_name the name appearing in the from section of the email Daily Newsletter
from_email The email address to use as the "from" - choose from only your verified emails newsletters@example.com
replyto_email Reply To Email address - this should not be "noreply" john@example.com
subject the subject line of the email My Subject Line
content_html the HTML-format version of the email Content goes here
test_vars Pass variables you are leveraging in your dynamic email (for testing).

Note: the value must be exact to how you are storing it
{"var1":"somevalue","var2":"othervalue"}
content_text the text-format version of the email Content goes here
content_sms the text of the sms SMS content
is_link_tracking 1 if you want to use link-tracking rewrites in the email, 0 if not (default 0) 1
is_google_analytics 1 if you want to use automatic Google Analytics tracking, 0 if not (default 0) 1
verify_post_url If the message is used as double optin and the verification is successful, the send_id and email address will be posted to this url https://www.yourwebsite.com
link_domain Defines the link domain to be used. This is only relevant when an account has more than one domain. link.test.com
link_params Json string containing the keys and values of the link params {"foo":"bar"}
success_url Success URL https://www.example.com/way-to-go
error_url Error URL https://www.example.com/error
setup The Setup section, a block of Zephyr code that will run prior to any other evaluation {content = horizon_select(content, 5)}

DELETE Template

Delete existing template

Delete a Template

Example Call
{"template_id" : 39}
Example Response
{
    "template" : null,
    "ok" : true
}

Required Parameters

Parameter Description Example
template_id the ID of the template 39

Return Value

Field Description Example
template the name of the template welcome
ok confirmation: true or 1 1

Contact us

Top