Rather than simply returning templates, the CTM can also send email and SMS messages. This is done using the goss.CommsTemplateManager.sendMessage end point.
Limits
All mail servers put limits on the total size of the emails they will accept. In AWS (our main hosting provider) the size limit is 40MB after encoding for the complete email, including embedded images and attachments.
There is also a limit of 50 recipients for a single message (combined "to", "cc" and "bcc"). When sending emails you should be emailing each recipient individually. The use cases for recipients having a message with the same message-id are limited to situations in which the recipients are expected to interact with the message as a group, for example, recipients using reply-all to the email and having a resulting email conversation.
Parameters
Required parameters are listed first.
Name | Type | Description |
---|---|---|
template | Object | Required. Details of the template to use |
template.application | String | Required. Name of application |
template.lang | String | Optional. The language to use, Either "EN", "CY" or "GD". If one isn't supplied defaults to EN |
template.template | String | Required. Name of template |
template.variation | String | Required. Name of variation |
recipients | Array <object> | Required. The list of recipients |
recipients[n].name | String | The name of the recipient |
recipients[n].address | String | The email address |
recipients[n].mobileNumber | String | The mobile number |
recipients[n].emailType | String | One of "TO", "CC" or "BCC". Default "TO" |
recipients[n].sendEmail | Boolean | Controls whether to send an email if a email address has been provided, assumes true if not set |
recipients[n].sendSMS | Boolean | Controls whether to send an SMS if a number has been provided, assumes true if not set |
attachments | Object | Optional. Attachments that may be added to the email |
attachments.pdf | Object | Optional. A PDF version of the email content |
attachments.pdf.template | String | Required. The template to use to generate the PDF |
attachments.pdf.name | String | Required. The name of the PDF file |
attachments.mediaItems | Array <object> | Optional. Each object in the array describes an iCM media item |
attachments.mediaItems[n].id | Integer | Required. The ID of the media item |
attachments.mediaItems[n].component | String | Optional. The media item component |
attachments.mediaItems[n].name | String | Required. The name of the attachment |
attachments.files | Array <object> | Optional. Each object in the array describes a file |
attachments.files[n].path | String | Required. The UNC path to the file |
attachments.files[n].name | String | Required. The name of the attachment |
attachments.fileStoreItems | Array <object> | Optional. Each object in the array describes a file in the file store |
attachments.fileStoreItems[n].reference | String | Required. The file store reference |
attachments.urls | Array <object> | Optional. Each object in the array describes a file that can be accessed via a URL |
attachments.urls[n].url | String | Required. The URL of the file |
attachments.urls[n].name | String | Required. The name of the attachment |
data | Object | Optional. The data for merging using handlebars, if this isn't present Handlebars processing will not be applied |
data.endpoint | Object | Optional. The details of an end point to retrieve the data to be sent |
data.endpoint.params | Object | Optional. If present these parameters will be used to call the end point |
data.endpoint.name | String | Required. The name of the end point |
data.src | Object | Optional. The data to be sent |
from | Object | Optional. The address the email is to be sent from. If set this will override one configured against the application in CTM. If neither are present then the default iCM from address will be used |
from.name | String | Optional. The name |
from.address | String <email> | Required. The email address |
overrides | Object | Optional. Allows the overriding of template content |
overrides.sms | Object | Optional. |
overrides.sms.body | String | Optional. The body content for the sms message |
overrides.email | Object | Optional. Email content overrides settings |
overrides.email.subject | String | Optional. If present overrides the subject content from the message variant |
overrides.email.body | String | Optional. If present overrides the body content from the message variant |
Examples
Full Params
{
"data": {
"endpoint": {
"params": {},
"name": "Abc"
},
"src": {}
},
"recipients": [{
"sendSMS": false,
"emailType": "TO,",
"sendEmail": false,
"name": "Abc",
"address": "user@example.com",
"mobileNumber": "Abc"
}],
"template": {
"application": "Abc",
"template": "Abc",
"lang": "Abc",
"variation": "Abc"
},
"from": {
"name": "Abc",
"address": "user@example.com"
},
"attachments": {
"urls": [{
"url": "Abc",
"name": "Abc"
}],
"files": [{
"path": "Abc",
"name": "Abc"
}],
"mediaItems": [{
"id": 123,
"name": "Abc",
"component": "Abc"
}],
"fileStoreItems": [{
"reference": "Abc"
}],
"pdf": {
"template": "Abc",
"name": "Abc"
}
},
"overrides": {
"sms": {
"body": "Abc"
},
"email": {
"subject": "Abc",
"body": "Abc"
}
}
}
Return Schema
Name | Type | Description |
---|---|---|
errors | Array <string> | Optional. |
success | Boolean | Required. Indicates whether the messages were sent successfully |