Fetch, update, and delete your transactional-mail templates.
https://api.sailthru.com/template
Fetch information about a template.
| 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.
| 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.
Update or create a template.
| Parameter | Description | Example |
|---|---|---|
template | the name of the template | welcome |
revision | Revision ID for a given revision | 24242 |
| 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 existing template
| Parameter | Description | Example |
|---|---|---|
template | the name of the template | welcome |
| Field | Example | |
|---|---|---|
template | welcome |
|
ok | true or 1 | 1 |
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');