Email Templates
The Email Templates API is used to access, create, and modify the email template objects on your business' account. The Email Templates API is connected to the Email Categories API, as email templates are grouped into different email categories.
Email templates in email categories where allowDuplicates is set to false
On every email template, you will see that it falls into an email category from the property emailCategory. In the email category object, you'll see an allowDuplicates property. If that property is set to false, then the email templates in that category must follow the level rules outlined in the table below. Email templates are each assigned a level of 0-4 that returns filled in the level property.
Level | Description |
|---|---|
0 | Default template provided by the server - businessId property would be set to null; if editing the default template with level set to 0, you'll want to call the endpoint to create a new template with the businessId set to your own and the level set to 1; level 0 templates cannot not be edited directly and there cannot be more than one level 0 template per category. |
1 | Default template in the category that has been edited by the business - businessId property is filled in with the business’s unique numeric ID (no services/classes or languages have been applied). There cannot be more than one template in an email category where This template acts as a fall back if there is not a template that matches the appointment's selected reason (level 3), or the client for the appointment's assigned language (level 2), or a combination of the two (level 4). |
2 | Template that has a language applied to it but no reasons applied to it. There cannot be more than one template per category at level 2 with the same language assigned to it and no reasons. For instance, you could not have two appointment reminder templates set to level 2 that are set to a language of 'es', or Spanish |
3 | Template that has one or more reasons applied to it but no language applied to it. This would mean that the template's reasonIdList property is filled out with the array of reasonIds that you want the template to apply to. Only one template per category per reason can be created at level 3. For instance, if you have a service called "Consultation" with a reasonId of 12345, you could not create 2 templates in any one category where |
4 | Template that has both a language and one or more reasons applied to it. Only one template per category can be created which matches both the language and any reason in the reasonIdList property. You could, for instance, have two templates in the same category where both languages was set to 'es', or Spanish, so long as their reasonIdLists did not contain any of the same reasonIds. Alternatively, you could have two templates in the same category where both the reasonIdLists are the same so long as their languages differ. In both these instances, the level property would need to be set to 4 in order for the logic to work in hierarchical order to send these emails out over the default template if the client matched the language preference and the appointment matched one of the reasonIds. |
These are the endpoints that are available under the /emailTemplates path, which lists all the different email templates on your business' account.
Endpoint | Description |
|---|---|
GET /emailTemplates/emailCategory/{emailCategoryId} | Returns all email template objects within specified email category in array format. |
GET /emailTemplates/{emailTemplateId} | Returns a JSON object for specified email template. |
GET /emailTemplates/objectType/{objectType} | Returns all email template objects with specified objectType in array format. |
POST /emailTemplates | Creates a new email template object on an account. Request body/payload: Must pass an email template object in request body/payload. For these calls, you need to pass an email template object with all required fields and any fields you want to set or update filled in the body of the payload. We have an example of a email template object in the responses section below and have indicated the required fields in the object values table at the bottom of this page. |
POST /emailTemplates/{emailTemplateId}/merged | Returns specified email template object to display to the user to edit before sending to selected clients. Request body: Must pass an email template object in request body/payload. For these calls, you need to pass an email template object with the businessId, emailTemplateId, parameterMap, and professionalId fields set in the body of the payload. We have an example of a email template object in the responses section below. |
PUT /emailTemplates/{emailTemplateId} | Updates an existing email template object. Request body/payload: Must pass an email template object in request body/payload. For these calls, you need to pass an email template object with all required fields and any fields you want to update filled in the body of the payload. We have an example of an email template object in the responses section below and have indicated the required fields in the object values table at the bottom of this page. |
DELETE /emailTemplates/{emailTemplateId} | Removes an email template object from view by setting its active property to false. |
Email Templates API Parameters
Data points passed on in the request URL portion of the API call that are used to filter the data being requested.
Parameter | Type | Endpoints to be used with | Description |
|---|---|---|---|
staffId | integer | GET /emailTemplates/{emailTemplateId} | Should be set as the ID of any staff connected to email template objects to be returned following a GET call. |
reasonId | integer | GET /emailTemplates/{emailTemplateId} | Should be set as the ID of any reason connected to email template objects to be returned following a GET call. |
Email Templates API Request Body/Payload
The objects below represent the minimum viable objects to pass that are needed to create or update an emailTemplates object. Check whether or not a property can be written to by looking at the Object Values table below to see if the property is writable.
Email Templates API Responses
Email Templates Object Values
Property Name | Type | Required | Description |
|---|---|---|---|
active | boolean | Yes | Indicates whether or not the specified email template should return on GET calls. |
allowOnline | boolean |
| Indicates whether or not the specified email template is allowed online. |
attachFileLibraryUUids | array |
| Displays as an array of unique alphanumeric fileLibraryUUids of any files attached to the specified email template. |
bccAddress | string |
| Displays as the Bcc field of the specified email template. |
businessId | integer | Yes | Provides unique numeric ID for the business to which the specified email template belongs. |
ccAddress | string |
| Displays as the CC field of the specified email template. |
createdDate | integer |
| Displays as the date the specified email template was created in milliseconds elapsed since January 1, 1970 00:00:00 UTC form. |
createdUser | string |
| Displays the username of user who created the specified email template. |
emailBecause | string |
| Displays as the reason why the specified email template is being sent. |
emailBody | string | Yes | Displays as the body of the specified email template. |
emailBodyText | string |
| Displays as the text of the body of the specified email template. |
emailCategory | object | Yes | Displays the email category object that the specified email template falls within - for more info, see Email Categories API page. |
emailTemplateId | integer | Yes, on PUT calls | Provides unique numeric ID for the specified email template. |
externalName | string |
| Displays as the external name of the specified email template. |
fromAddress | string |
| Displays as the From Address of the specified email template. |
fromName | string |
| Displays as the From Name of the specified email template. |
language | string |
| Displays as an abbreviation of the language used in the specified email template. |
level | integer | Yes | Displays as the level of the specified email template. More information on the different levels and what they signify can be found on the Messaging page. |
modifiedDate | integer |
| Displays as date the specified email template was last modified in milliseconds elapsed since January 1, 1970 00:00:00 UTC form. |
modifiedUser | string |
| Displays the username of user who last modified the specified email template. |
noHeader | boolean |
| Indicates whether or not the specified email template has a header. |
reasonIdList | integer |
| Displays as the IDs of any reasons connected to the specified email template. |
reasonNameList | string |
| Displays as the names of any reasons connected to the specified email template. |
replyToAddress | string |
| Displays as the Reply to Address of the specified email template. |
resellerId | integer |
| Provides unique numeric ID for reseller of the specified email template. |
s3FileName | string |
| Displays as the location/name of the specified email template file as stored in Amazon Web Services repository. This value cannot be overwritten with any PUT or POST calls. |
sortOrder | integer |
| Affects the order in which the different email templates on the account appear. |
subject | string |
| Displays as the Subject of the specified email template. |
templateName | string |
| Displays as Template Name of the specified email template. |
toAddress | string | Yes | Displays as the To address of the specified email template. |
toName | string |
| Displays as the To name of the specified email template. |