Create a new email template
When you create an email template, an ETID is assigned to the template. ETID is a unique identifier associated with each email template saved to your Tango platform and is used to identify the specific template when placing an order.
In addition to supporting custom templates, Tango supports one-off email templates that can be called by the optional ETID to override the assigned default email template. Contact your Tango Customer Success Manger, or email [email protected] for details.
Here is an example of the email template:
Dynamic tags in email template
We support a variety of dynamic (mustache) tags that can be inserted into various elements on an email template:
Dynamic Tags | Description | Email template element(s) |
---|---|---|
{{message}} | Maps to the "Message" field in the Place Order method. | Message Body, Closing Message |
{{recipient_name}} | Maps to the recipient first-name and last-name fields (concatenated) in the Place Order method, Blast Rewards Template, and Tango portal. | Message Body, Closing Message |
{{reward_name}} | Maps to the reward name (Reward Link Preferred) that is being sent to the recipient. | Email Subject, Message Body, Closing Message, Customer Service Message |
Use the following endpoint to create email templates for reward delivery. The ETID returned in the API response is necessary to identify a particular email template when ordering.
Endpoint | Purpose |
---|---|
POST {URI}/emailTemplates | Create a new email template. |
Use the following body parameters with this endpoint to create a new email template on your platform:
Body params | Data type | Requirement | Description |
---|---|---|---|
name | string | required | A unique name to give the template. (Required) |
fromName | string | required | The name that appears in the From line of the email. (Required) |
subject | string | required | The Subject of the email. (Required) |
headerImage | string | required | A Base64 encoded string of an image that shows as the header of the email. (Required) |
headerImageAltText | string | required | The Alt Text for the Header Image in the email. (Required) |
accentColor | string | required | A Hex color value, six hexadecimal digits preceded by a pound sign, used as an accent in the email. (Required) |
messageBody | string | required | The message body for the email. This is often used to let the recipient know why they have received the reward. (Required) |
🚧 Coming soon smsMessageBody | string | optional | The message body for the SMS. This is often used to let the recipient know why they have received the reward. Must be non-NULL when sending rewards via SMS. (limited to 90 characters) |
closing | string | required | After the reward credential, a space to close the message to the recipient. (Required) |
customerServiceMessage | string | optional | If left null, Tango's Customer Support contact information is included. Otherwise contact information for your customer support, if you are taking responsibility for providing first tier customer support of your recipients. |
accessControl | array of objects | Indicates which Customers and/or Accounts should have access to this template. (Optional) | |
-type | string | The type of access being specified: PLATFORM, CUSTOMER or ACCOUNT. | |
-identifier | string | Leave this field blank if the type is PLATFORM. Enter either customerIdentifier or accountIdentifier (5-100 chars), if the type is CUSTOMER OR ACCOUNT, respectively. | |
defaults | array of objects | If you want this template to be used at order time for the given Platform, Customer or Account when the Email Template Identifier (etid) is not provided with the order. | |
-type | string | The type of default being specified: PLATFORM, CUSTOMER or ACCOUNT. | |
-identifier | string | Leave this field blank if the type is PLATFORM. Enter either customerIdentifier or accountIdentifier (5-100 chars), if the type is CUSTOMER OR ACCOUNT, respectively. |
Here's the payload example for this endpoint. Enter the ETID returned in your response for the email template when you create an order:
{
"etid": "string",
"name": "string",
"fromName": "string",
"subject": "string",
"headerImage": "string",
"headerImageAltText": "string",
"accentColor": "string",
"messageBody": "string",
"smsMessageBody": "string", 🚧 Coming soon
"closing": "string",
"customerServiceMessage": "string",
"accessControls": [
{
"type": "PLATFORM",
"identifier": "string"
}
],
"defaults": [
{
"type": "PLATFORM",
"identifier": "string"
}
]
}
Here's an example payload for when you receive an error:
{
"timestamp": "2025-02-21T23:23:13.930Z",
"requestId": "string",
"path": "string",
"httpCode": 0,
"httpPhrase": "string",
"i18nKey": "string",
"message": "The error message will show here for error codes ",
"errors": [
{}
]
}
The possible response codes for this endpoint are as follows. For details, see i18nkey codes and their error messages:
Response code | Meaning |
---|---|
201 | New resource has been successfully created as a result of the request. |
400 | The server could not understand the request due to invalid syntax. |
401 | Authentication is required and has either not been provided or failed. |
403 | The server understood the request but refuses to authorize it. |
404 | The server could not find the requested resource. In other words, the URL you’re trying to access doesn’t point to anything that exists on the server. |
409 | The request could not be completed because it would cause a conflict with the current state of the resource. |
422 | The server understands the request but cannot process it due to semantic errors. |
500 | Something went wrong on the server, but the server cannot be more specific about what the exact problem is. |
503 | The server is currently unable to handle the request due to temporary overload or maintenance. |
Updated 7 days ago