API Call: template

Overview

Fetch, update, and delete your transactional-mail templates.

Specification

Base URL

https://api.sailthru.com/template

GET mode

Fetch information about a template.

Required / Conditional Parameters
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 revision and template parameters are given, related data about template revision is returned.

If only template parameter is given, related data about a template is returned.

Optional Parameters
Parameter Description Example
sample the sample name (for A/B tested templates) A

Optional parameter *sample* works only when used with template parameter

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 / Conditional Parameters
Parameter Description Example
template the name of the template welcome
revision Revision ID for a given revision 24242
Optional Parameters
Parameter Description Example
sample the sample name (for A/B tested templates) A
public_name Public name of the template Wonderful Template
from_name the name appearing in the "From" of the email Daily Newsletter
from_email The email address to use as the "from" – choose from any of your verified emails newsletters@example.com
replyto_email Reply To Email address john@example.com
subject the subject line of the email My Subject Line
content_html the HTML-format version of the email <p>Content goes here</p>
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
revision_id Current revision id 23233
revision_ids Array of revision id of the template [1414, 34242, 24333]
setup The Setup section, a block of Zephyr code that will run prior to any other evaluation {content = horizon_select(content, 5)}

If revision parameter is given, related revision data is set as current template

DELETE mode

Delete existing template

Required Parameters
Parameter Description Example
template the name of the template welcome
Return Value
Field Example
template welcome
ok 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');
 
/var/www/docs.sailthru.com/htdocs/data/pages/api/template.txt · Last modified: 2011/09/07 11:56 by Ian White
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki