template

Overview

Get, update, and delete your transactional email templates

See also Template Overview and Optimizing Templates

Base URL

https://api.sailthru.com/template

GET Mode

Get information about a template

Conditionally Required Parameters (only 1 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

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_url, subject, and from_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 http://cb.sailthru.com/ws/feed?id=501ffdb73c3109fe7b000005
sample The sample name (for A/B test templates) A
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

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 http://www.yourwebsite.com
link_params Json string containing the keys and values of the link params {"foo":"bar"}
success_url Success URL http://www.example.com/way-to-go
error_url Error URL http://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)}
app_badge Push Notifications - (iOS Only) The number in the corner of the application. This value can be zephyr or an integer {"app_badge":1} or {"app_badge":"{profile.vars.favorite_number}"}
app_sound Push Notifications - The sound that will play when an push notification is received (this sound must be provided by the client's app) {"app_sound":"dingding.wav"}
app_data Push Notifications - An array of key value pairs that represents the data intended to send to the app. Keys must be strings, values can be zephyr {"app_data":{"key":"{profile.vars.value}","product_deep_link:id_12"}}

 

 

DELETE Mode

Delete existing template

Required Parameters
Parameter Description Example
template the name of the template welcome
Return Value
Field Description Example
template the name of the template welcome
ok confirmation: true or 1 1

 

Examples

GET: Fetch information about a template
$sailthru_client->getTemplate('welcome','24242');
POST: Update or create a template
$sailthru_client->saveTemplate('welcome',
                          array('name' => 'Wonderful Template',
				'from_name' => 'Daily Newsletter',
				'from_email' => 'newsletters@example.com',
				'replyto_email' => 'john@example.com'
                          )
);
DELETE: Delete an existing template
$sailthru_client->deleteTemplate('welcome');