Toggle menu

Sending Messages

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.

NameTypeDescription
templateObjectRequired. Details of the template to use
template.applicationStringRequired. Name of application
template.langStringOptional. The language to use, Either "EN", "CY" or "GD". If one isn't supplied defaults to EN
template.templateStringRequired. Name of template
template.variationStringRequired. Name of variation
recipientsArray <object>Required. The list of recipients
recipients[n].nameStringThe name of the recipient
recipients[n].addressStringThe email address
recipients[n].mobileNumberStringThe mobile number
recipients[n].emailTypeStringOne of "TO", "CC" or "BCC". Default "TO"
recipients[n].sendEmailBooleanControls whether to send an email if a email address has been provided, assumes true if not set
recipients[n].sendSMSBooleanControls whether to send an SMS if a number has been provided, assumes true if not set
attachmentsObjectOptional. Attachments that may be added to the email
attachments.pdfObjectOptional. A PDF version of the email content
attachments.pdf.templateStringRequired. The template to use to generate the PDF
attachments.pdf.nameStringRequired. The name of the PDF file
attachments.mediaItemsArray <object>Optional. Each object in the array describes an iCM media item
attachments.mediaItems[n].idIntegerRequired. The ID of the media item
attachments.mediaItems[n].componentStringOptional. The media item component
attachments.mediaItems[n].nameStringRequired. The name of the attachment
attachments.filesArray <object>Optional. Each object in the array describes a file
attachments.files[n].pathStringRequired. The UNC path to the file
attachments.files[n].nameStringRequired. The name of the attachment
attachments.fileStoreItemsArray <object>Optional. Each object in the array describes a file in the file store
attachments.fileStoreItems[n].referenceStringRequired. The file store reference
attachments.urlsArray <object>Optional. Each object in the array describes a file that can be accessed via a URL
attachments.urls[n].urlStringRequired. The URL of the file
attachments.urls[n].nameStringRequired. The name of the attachment
dataObjectOptional. The data for merging using handlebars, if this isn't present Handlebars processing will not be applied
data.endpointObjectOptional. The details of an end point to retrieve the data to be sent
data.endpoint.paramsObjectOptional. If present these parameters will be used to call the end point
data.endpoint.nameStringRequired. The name of the end point
data.srcObjectOptional. The data to be sent
fromObjectOptional. 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.nameStringOptional. The name
from.addressString <email>Required. The email address
overridesObjectOptional. Allows the overriding of template content
overrides.smsObjectOptional.
overrides.sms.bodyStringOptional. The body content for the sms message
overrides.emailObjectOptional. Email content overrides settings
overrides.email.subjectStringOptional. If present overrides the subject content from the message variant
overrides.email.bodyStringOptional. 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

NameTypeDescription
errorsArray <string>Optional.
successBooleanRequired. Indicates whether the messages were sent successfully
Last modified on 12 October 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon