This API is used to create an email message template. The email template parameters such as subject, text, and HTML content should be provided in base64 format. This API will throw an error if you do not provide the subject, text, and HTML content base64 format.
Currently, this API supports only HTML and Text formats.
Know your endpoint
Based on the domain you use to log in to Webex Campaign, the endpoint domain for your API varies. For more information, refer to the Know Your API Endpoints section.
Headers
The following table describes the request headers:
Request Header | Description |
---|---|
content-type | application/json |
authorization | Access token or API Secret Key in Bearer format Example: Bearer $(key) |
Body Parameters
The following table describes the elements in the request body:
Parameter | Type | Mandatory | Description |
---|---|---|---|
channel | String | Mandatory | Specifies the channel. The options are: |
emailTemplate | Object | Mandatory | Specifies the content for the email template. The parameters are:
|
Request Example
{
"channel": "email",
"emailTemplate": {
"name": "EmailTemplate_Test9",
"format": 2,
"subject": "Q2hlY2sgeW91ciBsYXRlc3Qgb2ZmZXJz",
"htmlcontent": "PGh0bWw+PGhlYWQ+PHRpdGxlPkNocmlzdG1hcyBPZmZlcjwvdGl0bGU+PC9oZWFkPjxib2R5PkRlYXIgJChUR19GSVJTVE5BTUUpLCBZb3UgYXJlIGVsaWdpYmxlIHRvIHVwZ3JhZGUgeW91ciBjdXJyZW50IHBsYW4gZnJvbSAkKFRHX0NVUlJFTlRQTEFOKSB0byAkKFRHX1VQR1JBREVQTEFOKS4gPC9ib2R5Pk0vaHRtbD4=",
"textcontent": "RGVhciAkKFRHX0ZJUlNUTkFNRSksIFlvdSBhcmUgZWxpZ2libGUgdG8gdXBncmFkZSB5b3VyIGN1cnJlbnQgcGxhbiBmcm9tICQoVEdfQ1VSUkVOVFBMQU4pIHRvICQoVEdfVVBHUkFERVBMQU4p",
"description": "Test email template"
}
}
Response Parameters
This API will return the following response parameters:
Parameter | Description |
---|---|
name | Returns the name of the email template that is created. |
message | Returns the confirmation message. |
id | Returns the unique Transaction ID of the operation in case of success. |
Failure Response Codes
The API will return code within the response as per the following table in case of failure scenarios.
HTTP Status Code | Code within API Response | Description |
---|---|---|
400 | 400 | Template name should be less than equal to 64 characters |
400 | 2000 | For format type 0, only HTML is required, no text content required. |
400 | 2001 | For format type 1, only text is required, no HTML content required. |
400 | 2002 | For format type 2, both HTML and text is required. |
400 | 2003 | Invalid format type, it will be either 0, 1 or 2. |
400 | 2004 | Subject content not in Base64 encoded. |
400 | 2005 | HTML content not in Base64 encoded. |
400 | 2006 | Text content not in base64 encoded. |
400 | 400 | Text or HTML content not in Base64 encoded. |
400 | 400 | Name is required |
400 | 400 | Invalid channel :: channel name |
400 | 400 | SUBJECT length is too long. |
400 | 400 | Please enter only alphabets, numbers and _ for the template name and start with an alphabet or a number. |
401 | 430 | Authorization failed. This resource is not allowed to access using this TOKEN or KEY |
401 | NA | Invalid token or Access token expired |
404 | 404 | Not found |
409 | 409 | Another Message Template with the same name already exists in one of the User Groups. Please choose another name for this template. |
500 | 500 | Internal server error |
500 | 1001 | Invalid input JSON |