Sending Emails
In order to send an Email message, you must have an active Email channel and perform a HTTP request to the following endpoint with a valid access key.
Examples:
Send a message
Send a message to a channel
The ID of the workspace
The ID for a channel
If set to true, the frequency capping settings of the platform will be used
to either allow or reject the message to a contact. Can only be set to true
if the message is sent to a contact and .meta.extraInformation.useCase
is marketing
.
If set to true and message is a test/campaign message, web tracking parameters will be appended to the links in the message.
If set to true, quiet hours settings will be ignored and the message will be sent as soon as possible.
Tags to associate with the message. Tags are converted to lower case and tags that do not exist are automatically created. You can view your created tags in the UI. You can specify up to 10 tags per message.
SMS link shortening options. When using templates, please refer to
the template level shortLinks
instead.
Scheduled time to send message at. Must be formated as RFC3339 timestamp. When
set, the message status will be scheduled
until it's sent. Messages scheduled
for a time in the past or within 10 minutes of the request may be sent
immediately. Messages scheduled farther than 35 days will be rejected.
Validity determines for how many seconds a message is valid. If none is provided, the channel message type will be used to determine it. A promotional, conversational or transactional channel message is valid for 36 hours (129600 seconds). A message sent from a 2FA channel is valid for 10 minutes (600 seconds).
Message was accepted for processing
This field is used to store additional information related to the message status.
Tags to associate with the message. Tags are converted to lower case and tags that do not exist are automatically created. You can view your created tags in the UI. You can specify up to 10 tags per message.
SMS link shortening options. When using templates, please refer to
the template level shortLinks
instead.
Scheduled time to send message at. Must be formated as RFC3339 timestamp. When
set, the message status will be scheduled
until it's sent. Messages scheduled
for a time in the past or within 10 minutes of the request may be sent
immediately. Messages scheduled farther than 35 days will be rejected.
Send a plain text email
To send a plain text email message with the above endpoint set the request body as follows:
Send an html email
To send an html email message with the above endpoint, set the request body as follows. For email clients that do not support html and rich content set the plain text fallback field.
Send an email to multiple participants
To send an email to multiple participants, add another object to the contacts array. Use the type field to specify if the recipient of the email should be on the To list, in CC, or BCC
HTML metadata
Within the HTML body object you can include a metdata object as follows:
body.metadata.html.subject = set the email subject
body.metadata.emailfrom.username = set the sender before the @ e.g. support@acme.com
body.metadata.emailfrom.displayname = set the display name appearing in users inbox e.g. Support team
body.metadata.headers.reply-to = the reply-to address
Set the email subject
Send a html message with attachments
To send an email with attached media, ensure that your media file is either publicly available or see uploading media.
Add attachment objects to body.text.attachments[]
or body.html.attachments[]
as shown. Each attachment object has the following properties:
mediaUrl = The URL location of the media
filename = The name of the file
inline = boolean (default false).
See sending inline images:
Send an html message with inline images
To send an email with images inline, ensure that your media file is either publicly available or see uploading media.
Add an array of attachments to body.html
as above, but set body.html.attachments[].inline
to true.
Within body.html
reference the image in an image tag and prefix the filename with cid:
For example:
Send a message with a template
Using Studio, you can create templates that can be reused across multiple email messages.
To use a template in a message:
First make sure that the template is active.
Then, specify the template details in the
template
field of the request body, including theprojectId
,version
,locale
, and anyvariables
that are present in the template.Make sure that the variable names in your request match the variable names in the created template.
For example:
Send a message specifying the use case
The example describes the request body to send an email with custom use case types. The default type is marketing, but you can specify others listed.
transactional
otp
conversation
marketing
Send a message with tags
This example describes the request body to send an email with tags.
Last updated