Email API

Understand how you can use Send Message v2 API for sending Email.

📘

Please Note

The Email channel is supported via Webex Connect Send Message API v2.

The API endpoint for it is: [https://{YourRegion}.webexconnect.io/v2/messages].

Please modify YourRegion in the URL to reflect your tenant’s region. See Know your endpoint page.

Refer to our Postman Collection for trying various types of email notifications supported by Webex Connect.

Request Body for Email

{
    "channel": "email", //Mandatory. channel used for messaging.
    "from": "{{fromEmailAddress}}", //Mandatory. Email id of the sender.
    "to": [
        {
            "email": [
                "{{toEmailAddress}}"
            ], //Mandatory. email id of the recipients
            "substitutions": { //Optional. 
                "{{param1}}": "{{param1Value}}",
                "{{param2}}": "{{param2Value}}"
            },
            "correlationId": "" //Optional. The CorrelationID is a unique identifier that you can attach to every request as a reference a particular transaction or event. This is configured as a part of the request.
        }
    ],
    "substitutions": { //Optional. 
        "{{param3}}": "{{param3Value}}",
        "{{param4}}": "{{param4Value}}"
    },
    "cc": [], //Optional. Email id of the copied recipients.
    "bcc": [], //Optional. Email id of the bcc recipients.
    "multipleToRecipients": true, //Optional. If this parameter is not included then the same email is sent individually to each of the email addresses specified in 'to' field including all cc and bcc email ids.
    "options": { //Optional.
        "fromName": "{{emailSendername}}" //Optional. A string that will appear next to the from address in most email inboxes
    },
    "content": {
        "type": "text", //Mandatory. Either text or html. Use text while sending text emails.
        "subject": "{{subject}}", //Mandatory. Subject of the email
        "replyTo": "{{replyToEmailAddress}}", //Optional. Reply path for the email when the customer responds
        "text": "Simple text content" //Mandatory. Text content of the email
    },
    "requestedReceipts": [ //Optional.
        "submitted",
        "delivered",
        "read",
        "clicked",
        "bounced",
        "not verified",
        "invalid",
        "complaint",
        "failed"
    ], //JSON array that can filter message delivery web-hooks to the notifyURL. Can contain one or more of the following: "submitted", "delivered", "not verified", "invalid", "bounced", "complaint", "read", "clicked", "failed". Check Outbound Webhooks for more information on receipts. Note: All the above receipts are relevant for email via AWS SES. For email via SMTP, only "submitted" receipt is applicable
    "callbackData": "", //Optional. Data that you have configured to receive on the notify Url. This is configured as a part of the request.
    "notifyUrl": "", //Optional. Provide a URL to get notifications on message delivery status. Use requestedReceipts block to specify list of messages status you want to track.
    "contactPolicy": { //Optional. 
        "contactPolicyGroup": "", //the GroupID to be applied. Required if any of the following options are included and set to true
        "channelCheckConsent": true, //optional, assumed false, set to true to require opt-in before sending the message,“channelCheckConsent” or “channelApplyFrequencyCap” either of the parameter should be “true” 
        "channelApplyFrequencyCap": true //optional, assumed false, set to true to enforce group frequency cap for that channel,“channelCheckConsent” or “channelApplyFrequencyCap” either of the parameter should be “true” 
    }
}

Send Message API v2 for Email channel - Common Body Parameters

The following are the parameters of the request body:

ParameterTypeMandatoryDescription
channelstringyesThe value must be 'email' when sending an email.
fromstringyesEmail ID, i.e., the email ID of the sender to be used for sending the email.
toJSONArrayyesAn array of "to" JSON objects that contain the mandatory email ID of the recipients and optional personalised substitutions for each "to" object.
emailJSONArrayyesEmail ID of the recipients.
substitutionsJSONObjectnoList of key-value pairs for dynamic fields in the Email content. They are typically used for specifying the values of dynamic fields in an email template.

There are two ways to define the 'substitutions' parameter, one inside the 'to' block and another outside the 'to' block.

The 'substitutions' parameter inside the 'to' block takes precedence over the 'substitutions' block that is outside the 'to' block, in case these values are provided in both places.
correlationIdstringnoUser defined ID that is assigned to an individual message for unique identification.
ccJSONArraynoEmail ID of the copied recipients.
bccJSONArraynoEmail ID of the BCC recipients.
multipleToRecipientsbooleanno When this option is set to true, the platform sends a single email to multiple recipients in the 'to' field list.
When the option is set to false, the platform sends separate emails to multiple recipients in the 'to' field list.
optionsJSONObjectnoA JSON object that contains additional, email-specific options such as 'fromName', 'trackClicks', and 'trackOpens' in the API.
fromNamestringnoA string that will appear next to the 'from' address in most email inboxes.
trackClicksbooleannoWhen enabled, this option tracks all links in the HTML body, unless a link is tagged as no-track-connect within the anchor tags.
trackOpensbooleannoWhen enabled, this option tracks when the email is opened by the recipient of the email.
listUnsubscribeUrlstringnoAllows you to pass the link to your own subscription management portal, as part of the list-unsubscribe headers, instead of using Webex Connect subscription management capability.
unsubscribeEmailAddressstringnoContains the email address to which the unsubscribe email will be sent, when the customer sends unsubscribe request via mail to unsubscribe route.
unsubscribeEmailSubjectstringnoSpecify the subject that you would like to use for the email unsubscribe requests triggered via mail to unsubscribe route.
contentJSONObjectyes, if the template is not providedIt is the JSON object that contains mandatory parameters 'type', 'encoding', 'subject', 'replyTo', and 'text' for the email channel.
typestringyesUsed for specifying the message content type. The acceptable values are Text or HTML.
subjectstringyesSubject of the email.
replyTostringnoAn email header that allows recipients to reply to a different email address than the one used to send the original message.
textstringyes, when type=text
optional, when type=html
Text content of the email.
requestedReceiptsJSONArraynoA JSON array that can filter message delivery webhooks to the notifyUrl.

It can contain one or more of the following:
"submitted",
"delivered",
"read",
"clicked",
"bounced",
"not verified",
"invalid",
"complaint",
"failed"

Check Outbound Webhooks for delivery receipt samples.
callbackDatastringnoA string that is returned with each outbound webhook for the message (delivery, failed, etc.). The maximum number of characters allowed for callbackData including any spaces, is 2000.
notifyUrlstringnoIf provided, updates related to the delivery status of this message will be posted to this URL. Refer to this page for notification samples.
contactPolicyJSONObjectnoJSON Object to specify Contact Policy checks before sending the outbound email. The Contact Policy App should be configured as a prerequisite to be able to use this feature.
contactPolicyGroupstringyes (if you want to apply Contact Policy checks before sending the message)The GroupID is to be applied. It is required if any of the options below are included and set to true.
channelCheckConsentbooleannoOptional, assumed false if not specified. Set to true to require 'Opt-In' before sending the message. At least one out of “channelCheckConsent”, or “channelApplyFrequencyCap” parameters, should be set to “true”.
channelApplyFrequencyCapbooleannoOptional, assumed false. Set to true to enforce group frequency cap for that channel. At least one out of “channelCheckConsent”, or “channelApplyFrequencyCap” parameter, should be set to “true”.

📘

Multiple 'To' Recipients

  • You have the ability to send emails to multiple ‘To’ recipients in a single email transaction using Messaging API v2. This would require you to pass an additional parameter ‘multipleToRecipients’ to be passed as part of the request with its value set to ‘true’. When multiple email IDs are mentioned in the “Email” parameter of the “To” block, Webex Connect submits a single request to AWS SES or to SMTP server to send the concerned email to all - To, CC, and BCC. In this case, the API response will contain only one transaction ID for all recipients. Refer API reference for more information.
  • When Webex Connect is used to send emails to multiple email recipients (To, CC, BCC), the message submitted count reflects the total number of emails sent (counting each of the recipient in To, CC, and BCC fields individually). These changes will reflect in the ‘Reports’ and in the ‘Usage’ sections for email transactions.
  • For email transactions with multiple recipients, the Status field in Debug Console and Export Logs, and Error Codes details, will only be updated for entries with the ‘Submitted’ Status. Email delivery status for each of the individual recipients will need to be tracked using Outbound Webhooks. Separate outbound notifications will be sent for email delivery or failure to each of the recipients mentioned in To, CC, and BCC sections with the same transaction ID. For outbound email transactions, destination will contain an email ID for scenarios where only one email ID has been mentioned (that can in be in either of to, bcc, or cc fields but overall one email ID is mentioned in one outbound request).
    Read receipts are not generated for emails sent as plain text, i.e., when the email type is text.

📘

List Unsubscribe Parameters

There is an option to pass list-unsubscribe headers when sending emails using Webex Connect Messaging API v2. This will allow you to pass the links to your own unsubscribe management portal as part of the list-unsubscribe headers instead of using Webex Connectunsubscribe management capability. The following headers can be passed:

  • listUnsubscribeUrl
  • unsubscribeEmailAddress
  • unsubscribeEmailSubject

When the list-unsubscribe URL and/or unsubscribe mailto address are added, the Webex Connect platform will overwrite the asset setting with the values provided in the Messaging API, even for the assets for which the platform manages unsubscriptions. In such cases, the Webex Connect platform will no longer have control over the Outbound Webhook notifications for the unsubscribe events originated from the list-unsubscribe header. Therefore, you are recommended to use these options only when you have a mechanism to handle unsubscriptions (including one-click unsubscription) on your own.

Since it’s an email compliance requirement, the one-click unsubscribe header will be added to the outbound email, every time the list-unsubscribe URL is added in the Messaging API. You are expected to handle one-click unsubscriptions, i.e., receive postback from the email clients, perform action (add user email address to unsubscribe list), and respond with appropriate success status.

Examples

Send HTML Email

{
    "channel": "email", //Mandatory. channel used for messaging.
    "from": "{{fromEmailAddress}}", //Mandatory. Email id of the sender.
    "to": [
        {
            "email": [
                "{{toEmailAddress}}"
            ], //Mandatory. email id of the recipients
            "substitutions": { //Optional.
                "{{param1}}": "{{param1Value}}",
                "{{param2}}": "{{param2Value}}"
            },
            "correlationId": "" //Optional. The CorrelationID is a unique identifier that you can attach to every request as a reference a particular transaction or event. This is configured as a part of the request.
        }
    ],
    "substitutions": { //Optional.
        "{{param3}}": "{{param3Value}}",
        "{{param4}}": "{{param4Value}}"
    },
    "cc": [], //Optional. Email id of the copied recipients.
    "bcc": [], //Optional. Email id of the bcc recipients.
    "options": { //Optional.
        "fromName": "{{emailSendername}}", //Optional. A string that will appear next to the from address in most email inboxes
        "trackClicks": true, //Optional. When enabled, this tracks all links in the HTML body unless a link is tagged as no-track-connect within the anchor tags. Link tracking is supported only for Email app assets configured using AWS SES.
        "trackOpens": true //Optional. When enabled, this tracks opens of the email. Open tracking is supported only for Email app assets configured using AWS SES. 
    },
    "content": {
        "type": "html", //Mandatory. Either text or html. Use html while sending html emails.
        "subject": "{{subject}}", //Mandatory. Subject of the email
        "replyTo": "{{replyToEmailAddress}}", //Optional. Reply path for the email when the customer responds
        "text": "Fallback text in the event the email client does not support HTML emails", //Optional. Text content of the email
        "html": "<a track_enable href=\"http://example.com\">link text</a><footer><a data-mce-href='$(unsubscribe)' href='$(unsubscribe)' target='_blank' rel='noopener'><span st-unsubscribe='' style='text-decoration: none; color: #0088cc;' data-mce-style='text-decoration: none; color: #0088cc;'>unsubscribe</span></a></footer>" //Mandatory. Raw HTML for the email. Up to 350 kbps in size.
    },
    "requestedReceipts": [ //Optional.
        "submitted",
        "delivered",
        "read",
        "clicked",
        "bounced",
        "not verified",
        "invalid",
        "complaint",
        "failed"
    ], //JSON array that can filter message delivery web-hooks to the notifyURL. Can contain one or more of the following: "submitted", "delivered", "not verified", "invalid", "bounced", "complaint", "read", "clicked", "failed". Check Outbound Webhooks for more information on receipts. Note: All the above receipts are relevant for email via AWS SES. For email via SMTP, only "submitted" receipt is applicable
    "callbackData": "", //Optional. Data that you have configured to receive on the notify Url. This is configured as a part of the request.
    "notifyUrl": "", //Optional. Provide a URL to get notifications on message delivery status. Use requestedReceipts block to specify list of messages status you want to track.
    "contactPolicy": { //Optional.
        "contactPolicyGroup": "", //the GroupID to be applied. Required if any of the following options are included and set to true
        "channelCheckConsent": true, //optional, assumed false, set to true to require opt-in before sending the message,“channelCheckConsent” or “channelApplyFrequencyCap” either of the parameter should be “true” 
        "channelApplyFrequencyCap": true //optional, assumed false, set to true to enforce group frequency cap for that channel,“channelCheckConsent” or “channelApplyFrequencyCap” either of the parameter should be “true” 
    }
}

Parameter table with parameters unique to HTML Email type

ParameterTypeMandatoryDescription
optionsstringnoJSON object for options configuration.
typestringyesPossible options are 'text' or 'html'. In this case, it is 'html' while sending 'html' emails.
htmlstringyes, when type is HTMLRaw 'html' for the email. Up to 500 KB in size.

📘

Email Size Limitations

The default email size limit for AWS SES based email assets in Webex Connect is 10 MB. This is the overall email size limit including (the email text, images, attachments, and the MIME encoding). Please note that the size increases post MIME encoding. If you attach a 5 MB file in your email, the attachment size after MIME encoding will be ~6.85MB (about 137% of the original file size).

Send Email with Attachments

{
    "channel": "email", //Mandatory. channel used for messaging.
    "from": "{{fromEmailAddress}}", //Mandatory. Email id of the sender.
    "to": [
        {
            "email": [
                "{{toEmailAddress}}"
            ], //Mandatory. email id of the recipients
            "substitutions": { //Optional.
                "{{param1}}": "{{param1Value}}",
                "{{param2}}": "{{param2Value}}"
            },
            "correlationId": "" //Optional. The CorrelationID is a unique identifier that you can attach to every request as a reference a particular transaction or event. This is configured as a part of the request.
        }
    ],
    "substitutions": { //Optional.
        "{{param3}}": "{{param3Value}}",
        "{{param4}}": "{{param4Value}}"
    },
    "options": { //Optional.
        "trackClicks": true, //Optional. When enabled, this tracks all links in the HTML body unless a link is tagged as no-track-connect within the anchor tags. Link tracking is supported only for Email app assets configured using AWS SES.
        "trackOpens": true, //Optional. When enabled, this tracks opens of the email. Open tracking is supported only for Email app assets configured using AWS SES. 
        "fromName": "{{emailSendername}}" //Optional. A string that will appear next to the from address in most email inboxes
    },
    "content": {
        "type": "html", //Mandatory. Either text or html.
        "subject": "{{subject}}", //Mandatory. Subject of the email
        "text": "Fallback text in the event the email client does not support HTML emails", //Text content of the email Note:yes, when type=text optional, when type=html
        "attachments": [
            {
                "mimetype": "image/png", //Mandatory. Supported mimeTpes
                "name": "Flower", //Mandatory. Name of the attachments
                "mediaUrl": "" //Mandatory. Direct URL pointing to the media file. The URL should end with specified file-format.
            }
        ]
    },
    "requestedReceipts": [ //Optional.
        "submitted",
        "delivered",
        "read",
        "clicked",
        "bounced",
        "not verified",
        "invalid",
        "complaint",
        "failed"
    ], //JSON array that can filter message delivery web-hooks to the notifyURL. Can contain one or more of the following: "submitted", "delivered", "not verified", "invalid", "bounced", "complaint", "read", "clicked", "failed". Check Outbound Webhooks for more information on receipts. Note: All the above receipts are relevant for email via AWS SES. For email via SMTP, only "submitted" receipt is applicable
    "callbackData": "", //Optional. Data that you have configured to receive on the notify Url. This is configured as a part of the request.
    "notifyUrl": "", //Optional. Provide a URL to get notifications on message delivery status. Use requestedReceipts block to specify list of messages status you want to track.
    "contactPolicy": { //Optional.
        "contactPolicyGroup": "", //the GroupID to be applied. Required if any of the following options are included and set to true
        "channelCheckConsent": true, //optional, assumed false, set to true to require opt-in before sending the message,“channelCheckConsent” or “channelApplyFrequencyCap” either of the parameter should be “true” 
        "channelApplyFrequencyCap": true //optional, assumed false, set to true to enforce group frequency cap for that channel,“channelCheckConsent” or “channelApplyFrequencyCap” either of the parameter should be “true” 
    }
}

Parameter table with parameters unique to Email with Attachments

ParameterTypeMandatoryDescription
attachmentsJSONArraynoAttachment sizes are subject to the overall email message size limitations according to the parameters as part of the table below.
mimetypenoyesMime type of the attachment that is being sent. For example, "image/png".Refer to this page for more information on supported file types.
namestringyesName of the attachment.
mediaUrlstringyesDirect URL pointing to the media file.

Send Email Using Templates

{
    "channel": "email", //Mandatory. channel used for messaging.
    "from": "{{fromEmailAddress}}", //Mandatory. Email id of the sender.
    "to": [
        {
            "email": [
                "{{toEmailAddress}}"
            ], //Mandatory. email id of the recipients
            "substitutions": { //Optional.
                "{{param1}}": "{{param1Value}}",
                "{{param2}}": "{{param2Value}}"
            },
            "correlationId": "" //Optional. The CorrelationID is a unique identifier that you can attach to every request as a reference a particular transaction or event. This is configured as a part of the request.
        }
    ],
    "substitutions": { //Optional.
        "{{param3}}": "{{param3Value}}",
        "{{param4}}": "{{param4Value}}",
        "{{param5}}": "{{param5Value}}",
        "{{param6}}": "{{param6Value}}"
    },
    "template": {
        "id": "{{templateId}}", //Mandatory. Unique identifier of the email template used for constructing the email
        "subject": "{{subject}}" //Mandatory. Subject of the email
    },
    "requestedReceipts": [ //Optional.
        "submitted",
        "delivered",
        "read",
        "clicked",
        "bounced",
        "not verified",
        "invalid",
        "complaint",
        "failed"
    ], //JSON array that can filter message delivery web-hooks to the notifyURL. Can contain one or more of the following: "submitted", "delivered", "not verified", "invalid", "bounced", "complaint", "read", "clicked", "failed". Check Outbound Webhooks for more information on receipts. Note: All the above receipts are relevant for email via AWS SES. For email via SMTP, only "submitted" receipt is applicable
    "callbackData": "", //Optional. Data that you have configured to receive on the notify Url. This is configured as a part of the request.
    "notifyUrl": "", //Optional. Provide a URL to get notifications on message delivery status. Use requestedReceipts block to specify list of messages status you want to track.
    "contactPolicy": { //Optional.
        "contactPolicyGroup": "", //the GroupID to be applied. Required if any of the following options are included and set to true
        "channelCheckConsent": true, //optional, assumed false, set to true to require opt-in before sending the message,“channelCheckConsent” or “channelApplyFrequencyCap” either of the parameter should be “true” 
        "channelApplyFrequencyCap": true //optional, assumed false, set to true to enforce group frequency cap for that channel,“channelCheckConsent” or “channelApplyFrequencyCap” either of the parameter should be “true” 
    }
}

Parameter table with parameters unique to Email Using Templates

ParameterTypeMandatoryDescription
templateJSONObjectyesJSON Object for configuration of the template.
templateidstringyesUnique identifier of the email template used for constructing the email.
subjectstringnoSubject of the email.

Sample Response Body

{
    "requestTimestamp": "2024-09-05T00:03:01.708-04:00",
    "messageId": "a770f205-1234-3x5x-x5x3-6dc3e388b9b5",
    "correlationId": "12345",
    "status": "queued"
}
   {
        "code": "7000",
        "message": "Invalid JSON"
    }
No response body