Create email message template API

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 HeaderDescription
content-typeapplication/json
authorizationAccess token or API Secret Key in Bearer format

Example: Bearer $(key)

Body Parameters

The following table describes the elements in the request body:

ParameterTypeMandatoryDescription
channelStringMandatorySpecifies the channel. The options are:
* email
emailTemplateObjectMandatorySpecifies the content for the email template. The parameters are:


  • name: (Mandatory)
    Specifies a name for the template.

  • format: (Mandatory)
    Specifies the format of the template. The options are

    0 (only HTML).
    1 (only Text)
    * 2 (Both HTML and Text).


  • subject: (Mandatory)
    Specifies the subject line in base64 format for the email template. The length of the email subject should not exceed 65535 characters.

  • htmlcontent: (Mandatory) Specifies the html content in base64 format for the template

  • textcontent: (Optional) Specifies the text content in base64 format for the template

  • description: (Optional) specifies the description for the template

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:

ParameterDescription
nameReturns the name of the email template that is created.
messageReturns the confirmation message.
idReturns 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 CodeCode within API ResponseDescription
400400Template name should be less than equal to 64 characters
4002000For format type 0, only HTML is required, no text content required.
4002001For format type 1, only text is required, no HTML content required.
4002002For format type 2, both HTML and text is required.
4002003Invalid format type, it will be either 0, 1 or 2.
4002004Subject content not in Base64 encoded.
4002005HTML content not in Base64 encoded.
4002006Text content not in base64 encoded.
400400Text or HTML content not in Base64 encoded.
400400Name is required
400400Invalid channel :: channel name
400400SUBJECT length is too long.
400400Please enter only alphabets, numbers and _ for the template name and start with an alphabet or a number.
401430Authorization failed. This resource is not allowed to access using this TOKEN or KEY
401NAInvalid token or Access token expired
404404Not found
409409Another Message Template with the same name already exists in one of the User Groups. Please choose another name for this template.
500500Internal server error
5001001Invalid input JSON
Language