Email Service
Access info
Endpoint | https://email-api.socrate.io/graphql |
Required access keys | Tenant-level service access key |
Pricing | Please contact us for details at contact@bitsoftware.ro |
Notes | To call the service, the access key must be provided in the x-api-key header of the HTTP request. If you are using the GraphQL console, you can view the service’s documentation and schema only after entering an access key. Make sure that the scope of the key allows access to the queries and mutations that you require. For example, to grant the key access to all queries and mutations, the keys’s scope must be set to email-api:query:* email-api:mutation:* . |
Usage
The Email Service enables you to send email using any of the following approaches:
- From the default email address no-reply@socrate.email. For more information, see Sending email from the default email address.
- From a custom email address such as sales@some.company. For more information, see Sending email from a custom email address.
- From any email address at some custom domain, for example, laura@some.company, bob@some.company, etc. For more information, see Sending email from any address of a custom domain.
- From a custom email address managed by Google or Microsoft 365®. This may be an email address such as example@gmail.com, example@live.com or a personalized email address such as example@some.company. For more information, see Sending email from a Google or Microsoft 365® email address.
Auto-Submitted: auto-generated
. This is an indication to email clients that the email was generated by an automatic process. For more information about this header, refer to RFC 384.
When sending email with attachments, the attachments can either be files previously created through the File Management Service, or public file URIs.
Optionally, when sending email, you can apply email templates created previously through the Document Rendering Service.
You can obtain a list of sent messages by running the messages
query. Detailed filtering options are available. The query results include, among other information, the delivery status of each message. If there were multiple recipients in the to
, cc
, and bcc
fields, the delivery status is available for each recipient.
Optionally, you can enable tracking engagement for sent messages. This enables you to obtain information about the number of times the email was opened, and when. For messages sent in HTML format, you can track which links contained in the email were clicked, and when.
The Email Service also provides the ability to receive email at any address that has the following format:
{recipient}@{tenant_subdomain}.{app_subdomain}.socrate.email
where {recipient}, {tenant_subdomain}, and {app_subdomain} are configurable. For example, you could configure your app to accept email at an address like sales@tax.ebs.socrate.email or support-123456@yyy.zzz.socrate.email. For more information, see Receiving email.
You can obtain a list of incoming messages by running the InboundMessages
query. Detailed filtering options are available.
Sending email from the default email address
This is the most simple way of sending emails and it does not require any email inbox or domain verification. When running the sendMessage
mutation, the only required parameters are at least one of the following (or any combination of): to
, cc
, and bcc
. Secondly, you do not need to provide a value for the from
parameter. The From field of the email will be automatically set to no-reply@socrate.email
.
For a step-by-step example, see Tutorial: Send an email.
Sending email from a custom email address
To send email from an email address such as example@some.tenant
or example@some.app
, you must first verify that email address. Verification means that the bearer of the service access key will be able to use the verified email address in the “from” field when sending email through the sendMessage
mutation.
There are two possible implementation scenarios:
- Your application needs to allow all its tenants to send email from an email address like
example@some.app
. In this case, you should verify the email address at application level, as described in Verify an email identity at application level. - A specific tenant needs to send email only on their own behalf, from their own custom address such as
example@some.tenant
. In this case, you should verify the email address as described in Verify an email identity at tenant level.
Once you have verified the email inbox, you can use this value in the from
input parameter when running the sendMessage
mutation.
mutation sendEmail ($input:SendMessageInput!) {
sendMessage(
input: $input
) {
id
}
}
{
"input": {
"to": { "name": "Max Mustermann", "address": "email@example.org" },
"subject": "YOUR_EMAIL_SUBJECT",
"from": {"name":"Max Mustermann", "address": "YOUR_VERIFIED_EMAIL"},
"textBody": "YOUR_EMAIL_BODY"
}
}
Sending email from any email address of a custom domain
To send email using this approach, you must have access to the DNS records of the domain some.company and have that domain verified by SBS. For instructions, see Verify a domain identity.
Once the domain is verified, you can start using the domain for sending email. More specifically, when running the sendMessage
mutation, you can use any email address that belongs to the verified domain in the email’s from
field, for example:
mutation sendEmail ($input:SendMessageInput!) {
sendMessage(
input: $input
) {
id
}
}
{
"input": {
"to": { "name": "TO_NAME", "address": "TO_EMAIL" },
"subject": "Test email",
"from": {"address":"ANY.ADDRESS@YOUR.VERIFIED.DOMAIN"},
"htmlBody": "<div>This is some <strong>HTML</strong>.</div>"
}
}
You can delete previously created domain identities by running the deleteDomainIdentity
mutation. The outcome of deleting a verified email domain is that the user will no longer be able to send email using that domain.
Sending email from a Google or Microsoft 365 email address
To send email from an email address managed by Google or Microsoft 365®, you must connect the user’s mail inbox to SBS, using one of the following approaches:
- App Password
- OAuth access token
App Password
To send email from an email address authorized by App Password, your app must collect from the user their third-party email address (managed by Google or Microsoft) and their corresponding app password. For instructions about obtaining an app password, see Obtaining a Google App Password and Obtaining a Microsoft 365 App Password.
Once you have the user’s email address and an app password, you can send messages by calling sendMessage
as follows (this example assumes the app password was obtained for a Google email address):
mutation sendEmail ($input:SendMessageInput!) {
sendMessage(
input: $input
) {
id
}
}
{
"input": {
"to": { "address": "TO_EMAIL" },
"subject": "Test sending email with Google app password",
"from": {
"address":"YOUR_GOOGLE_EMAIL_ADDRESS",
"appPassword": {
"password": "YOUR_GOOGLE_APP_PASSWORD",
"provider": "GOOGLE"
}
},
"htmlBody": "<div>This is some <strong>HTML</strong>.</div>"
}
}
Optionally, you can store the email and app password as a verified identity in SBS. Doing this would enable you to call sendMessage
without supplying the app password as input, for example:
{
"input": {
"to": { "address": "TO_EMAIL" },
"subject": "Test sending email with Google app password",
"from": {
"address":"YOUR_GOOGLE_EMAIL_ADDRESS",
},
"htmlBody": "<div>This is some <strong>HTML</strong>.</div>"
}
}
To store a verified Google or Microsoft identity in SBS, do one of the following:
- Sign in to the SBS Portal and store your app password.
- Run the
addEmailAccount
mutation, for example:
mutation addEmailAccount($input:AddEmailAccountInput!) {
addEmailAccount(input:$input) {
id
address
provider
}
}
{
"input": {
"address": "YOUR_EMAIL_ADDRESS",
"password": "YOUR_GOOGLE_APP_PASSWORD",
"provider": "GOOGLE"
}
}
To list the previously added third-party email accounts, run the emailAccounts
query.
To update or delete third-party email accounts, run the updateEmailAccount
and deleteEmailAccount
mutations, respectively.
OAuth Access Token
To send email from an email address authorized by OAuth 2.0 Access Token:
- Perform an authorization of the user as described in Authorization through OAuth 2.0. As part of this step, you will need to provide an
approver
identifier, which must be set to the internal id of the user in your application. - Run the
sendMessage
mutation of the Email Service, for example:
mutation sendEmail ($input:SendMessageInput!) {
sendMessage(
input: $input
) {
id
}
}
In variables, make sure to replace values as required. Note that the oauthApprover
must be set to the approver
ID used in step 1.
{
"input": {
"to": { "name": "Max Mustermann", "address": "email@example.org" },
"subject": "YOUR_EMAIL_SUBJECT",
"from": {"oauthApprover": "USER_ID" },
"textBody": "YOUR_EMAIL_BODY"
}
}
You can list the previously obtained OAuth 2.0 authorizations by running the authorizations
query of the OAuth Service.
Viewing the delivery status
You can view the delivery status of sent email, by running the messages
query and requesting the status
of each TO, CC, or BCC recipient, for example:
query sent ($filter:MessagesFilter, $nextToken:String) {
messages(filter:$filter, nextToken:$nextToken) {
items {
id
to { name address status }
cc { name address status }
bcc { name address status }
subject
sentAt
}
nextToken
}
}
Note that the delivery status cannot be tracked if the email was sent from a Google or Microsoft account authorized through OAuth 2.0 or app password.
Sending email with tracking options
When sending email, you can optionally enable tracking options. With tracking options are enabled, you can view the following statistics for a sent email message:
- whether the message was opened by the recipient, and how many times. For each open event, you can view the origin IP address, and the time when the open event took place.
- whether any links within the email were clicked, and how many clicks took place in total. For each click event, you can view the link that was opened, the origin IP address and the time when the event took place.
You can set tracking options only for email sent through the following means:
- from the default address
- from a custom verified email address
- from a custom verified domain
It is not possible to set tracking options for email sent from Google or Microsoft addresses that were verified by either OAuth 2.0 authorization or app password.
Tracking options are not enabled by default. To enable tracking options, set the trackEngagement
input parameter to true and make sure that the email is in HTML format, for example:
mutation sendMessage ($input:SendMessageInput!) {
sendMessage(
input: $input
) {
id
subject
messageId
htmlBody
}
}
{
"input": {
"to": {
"address": "SOME_EMAIL_ADDRESS"
},
"subject": "Lorem ipsum",
"htmlBody": "<body><p>This is a <a href=\"https://socrate.io\">link</a>.</p></body>",
"trackEngagement": true
}
}
When tracking is enabled, a tiny 1 pixel image is embedded within the HTML body of the sent message. In addition, all links within the email body are transformed to include Amazon Web Services tracking code.
Note that, if the recipient’s email client application is configured to block images from incoming emails, the tracking statistics will not be available until the user chooses to display the images.
To view the tracking statistics, run the messages
query and request statistics about the “open” and “click” events, for example:
query sent ($filter:MessagesFilter, $nextToken:String) {
messages(filter:$filter, nextToken:$nextToken) {
items {
id
messageId
from { address, name }
replyTo { name, address }
to { address, status }
subject
openCount
clickCount
opens { createdAt, ipAddress, userAgent, timestamp }
clicks { createdAt, link, ipAddress, userAgent, timestamp }
}
nextToken
}
}
{
"filter": {
"ids": ["YOUR_EMAIL_ID"]
}
}
Receiving email
SBS will accept email at any address that has the following format:
{recipient}@{tenant_subdomain}.{app_subdomain}.socrate.email
where:
- recipient is virtually any string. For example, it could be a department name (such as “sales”, “accounting”, etc), or even include ticket numbers (“support-case-5678654”).
- tenant_subdomain identifies the tenant in the SBS system and must be configured before you can receive email.
- app_subdomain identifies the app in the SBS system and must be configured before you can receive email.
To configure your application for receiving email:
- Register an email subdomain for your application. You can do this from the SBS Console, or by running the
registerAppSubdomain
mutation of the Account API. For instructions, see Register an email subdomain at application level. - Register a subdomain for your tenant. You can do this from the SBS Portal, or by running the
registersubdomain
mutation of the Email Service. For instructions, see Register an email subdomain at tenant level.
To query all received email, run the InboundMessages
query.
Queries
addressStatus
Returns information about whether the email address supplied as input is in the AWS Suppression List, and the reason why. To remove an email address from the suppression list, run the unsuppressAddress
mutation.
Arguments
Argument | Type | Description |
---|---|---|
address | EmailAddress |
Mandatory. The email address for which you would to obtain the suppression status. |
Result
AddressStatus
type
Attribute | Type | Description |
---|---|---|
isSuppressed | Boolean |
Returns true if the email address is in the AWS suppression list; false otherwise. |
suppressionReason | String |
The reason why the email address is suppressed, as provided by AWS. |
domainIdentities
Returns a list of email domain identities and their verification status (verified or pending verification). Only email from verified domains can be used when sending email from any email address of a custom domain.
Arguments
Argument | Type | Description |
---|---|---|
filter | DomainIdentitiesFilter |
Optional argument used to filter domain identities by their status. See the DomainIdentitiesFilter type. |
nextToken | String |
Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the DomainIdentitiesResult type. |
DomainIdentitiesFilter
type
Attribute | Type | Description |
---|---|---|
status | IdentityVerificationStatus |
An enumeration with two possible values: VERIFIED and PENDING. |
Result
DomainIdentitiesResult
type
Attribute | Type | Description |
---|---|---|
items | [DomainIdentity] |
An array of DomainIdentity objects. |
nextToken | String |
If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results. |
DomainIdentity
type
Attribute | Type | Description |
---|---|---|
domain | Domain |
The domain name. For example, example.org. |
status | IdentityVerificationStatus |
The verification status. Valid values are VERIFIED and PENDING. |
dnsRecords | [DnsRecord] |
An array of DnsRecord objects. See the DnsRecord type. |
DnsRecord
type
Attribute | Type | Description |
---|---|---|
type | DnsRecordType |
The type of the DNS record. For example, CNAME. |
name | String |
The name of the DNS record. |
value | String |
The value of the DNS record. |
emailAccounts
Returns a list of email accounts authorized to send email managed by providers such as Google or Microsoft 365.
Arguments
Argument | Type | Description |
---|---|---|
filter | EmailAccountsFilter |
Optional argument used to filter email accounts. See the EmailAccountsFilter type. |
nextToken | String |
If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results. |
EmailAccountsFilter
type
Attribute | Type | Description |
---|---|---|
address | EmailAddress |
The email address associated with this email account. |
provider | Provider |
The external provider to which this email account belongs. Valid values are GOOGLE and MICROSOFT. |
Result
emailAccountsResult
type
Attribute | Type | Description |
---|---|---|
items | [EmailAccount] |
An array of objects of type EmailAccount . |
nextToken | String |
If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results. |
emailAccount
type
Attribute | Type | Description |
---|---|---|
id | ID |
The SBS-internal identifier of the email account. |
address | EmailAddress |
The email address associated with this email account. |
provider | Provider |
The external provider to which this email account belongs. Valid values are GOOGLE and MICROSOFT. |
emailIdentities
Returns a list of email verification requests and their outcome (verified or pending verification), also referred to as “email identities”. Only verified email identities can be used in the from
field when sending email from a custom email address.
Arguments
Argument | Type | Description |
---|---|---|
filter | EmailIdentitiesFilter |
Optional argument used to filter email identities by their status. See the EmailIdentitiesFilter type. |
nextToken | String |
Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the EmailIdentitiesResult type. |
EmailIdentitiesFilter
type
Attribute | Type | Description |
---|---|---|
status | IdentityVerificationStatus |
An enumeration with two possible values: VERIFIED or PENDING. |
Result
EmailIdentitiesResult
type
Attribute | Type | Description |
---|---|---|
items | [EmailIdentity] |
An array of EmailIdentity objects. |
nextToken | String |
If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results. |
EmailIdentity
type
Attribute | Type | Description |
---|---|---|
address | EmailAddress |
The email address that has been verified or is pending verification. |
status | IdentityVerificationStatus |
The verification status. Valid values are VERIFIED and PENDING. |
inboundMessages
Returns a list of received email messages, filtered according to the provided criteria. You can provide the criteria through the filter
argument.
Arguments
Argument | Type | Description |
---|---|---|
filter | InboundMessagesFilter |
Optional argument used to filter email messages. |
nextToken | String |
Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the InboundMessagesResult type. |
order | SortOrder |
Optional argument used to sort the query results. Valid values: CHRONOLOGICAL - sort results in chronological order (oldest first); ANTICHRONOLOGICAL (default) - sort results in reverse chronological order (newest first). |
InboundMessagesFilter
input
This object provides the criteria by which email messages should be filtered. Note that, if you specify multiple criteria, they will be joined with a logical AND (that is, the call will return only messages that satisfy all criteria).
Attribute | Type | Description |
---|---|---|
ids | [String] |
Optional. Specifies an array of message IDs (InboundMessage.id ) by which to filter. |
toContains | String |
Optional. If set, any email where the to field contains this string will be considered a match. |
ccContains | String |
Optional. If set, any email where the cc field contains this string will be considered a match. |
replyToContains | String |
Optional. If set, any email where the replyTo field contains this string will be considered a match. |
subjectContains | String |
Optional. If set, any email where the subject field contains this string will be considered a match. |
bodyContains | String |
Optional. If set, any email where the body field contains this string will be considered a match. |
createdAt | DateFilter |
Optional. If set, any email within the date boundaries set by the DateFilter will be considered a match. |
externalReference | String |
Optional. If set, any email where the externalReference identifier is equal to this value will be considered a match. |
receivedBy | EmailAddress |
Optional. If set, any email where the final recipient (InboundMessage.receivedBy.address ) is equal to this value will be considered a match. |
Result
InboundMessagesResult
type
Attribute | Type | Description |
---|---|---|
items | [InboundMessage] |
An array of InboundMessage objects. |
nextToken | String |
If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results. |
InboundMessage
type
Attribute | Type | Description |
---|---|---|
id | ID! |
Provides the unique internal message identifier. |
messageId | String |
Provides the unique message identifier assigned by the sending server. |
from | ContactUser |
Provides information about the original sender. Even if the email was automatically redirected by several systems on its way from sender to recipient, this field will still reflect the original sender. |
replyTo | Contact |
Provides information about the replyTo field. |
to | [Recipient] |
Provides information about the email’s recipients. Each Recipient also holds information about the delivery status. |
receivedBy | Contact |
The inbox address of the final recipient. |
cc | [Recipient] |
Provides information about the email’s carbon copy (CC) recipients. Each Recipient also holds information about the delivery status. |
subject | String |
The email’s subject. |
textBody | String |
The email’s body, in plain text format. |
htmlBody | String |
The email’s body, in HTML format. |
createdAt | String |
The date and time when the email was created. |
sentAt | String |
The date and time when the email was sent. This value matches the date within the email. |
attachmentCount | Int |
Provides the number of attachments (if the email had any). |
attachments | [Attachment] |
Provides information about the actual attachments, as an array of [Attachment] type. |
original | File |
The original message stored as a file. |
inReplyTo | String |
Provides the Message-ID of the previous message in the chain. |
references | [String] |
Provides a list of Message-IDs of previous messages in the chain. |
externalReference | String |
An identifier of the inbound email that you may want to set optionally. This field is null by default, unless you populate it with the updateInboundMessage mutation. |
autoSubmitted | String |
The content of the Auto-Submitted email header, as it was populated by the email sender. For more information about this header, refer to RFC 384. |
File
type
Attribute | Type | Description |
---|---|---|
id | ID |
Provides the unique identifier of the file. |
downloadUrl(expiresIn:Int ) |
Uri |
Generates a download URL that will expire after expiresIn seconds. |
messages
Returns a list of sent email messages, filtered according to the provided criteria. You can provide the criteria through the filter
argument.
Arguments
Argument | Type | Description |
---|---|---|
filter | MessagesFilter |
Optional argument used to filter email messages. |
nextToken | String |
Optional argument used to fetch the next of set of results. This value can be obtained from the nextToken attribute of the MessagesResult type. |
MessagesFilter
input
This object provides the criteria by which email messages should be filtered. Note that, if you specify multiple criteria, they will be joined with an AND logical clause (that is, the call will return only messages that satisfy all criteria).
Attribute | Type | Description |
---|---|---|
ids | [String] |
Optional. Specifies an array of message IDs by which to filter. |
toContains | String |
Optional. If set, any email where the to field contains this string will be considered a match. |
ccContains | String |
Optional. If set, any email where the cc field contains this string will be considered a match. |
bccContains | String |
Optional. If set, any email where the bcc field contains this string will be considered a match. |
replyToContains | String |
Optional. If set, any email where the replyTo field contains this string will be considered a match. |
subjectContains | String |
Optional. If set, any email where the subject field contains this string will be considered a match. |
bodyContains | String |
Optional. If set, any email where the body field contains this string will be considered a match. |
createdAt | DateFilter |
Optional. If set, any email within the date boundaries set by the DateFilter will be considered a match. |
externalReference | String |
Optional. If set, any email where the externalReference identifier is equal to this value will be considered a match. |
DateFilter
input
Attribute | Type | Description |
---|---|---|
from | String |
ISO date format (for example, “2019-12-01”). |
to | String |
ISO date format (for example, “2020-11-30”). |
Result
MessagesResult
type
Attribute | Type | Description |
---|---|---|
items | [Message] |
An array of Message objects. |
nextToken | String |
If null, then the query has reached the end of the list of files that match the query criteria. If not null, then use this value in the nextToken input argument to obtain the next page. |
Message
type
Attribute | Type | Description |
---|---|---|
id | ID! |
Provides the unique internal message identifier. |
messageId | String |
Provides the unique message identifier assigned by the sending server. |
from | ContactUser |
Provides information about the sender. |
replyTo | Contact |
Provides information about the replyTo field. |
to | [Recipient] |
Provides information about the email’s recipients. Each Recipient also holds information about the delivery status. |
cc | [Recipient] |
Provides information about the email’s carbon copy (CC) recipients. Each Recipient also holds information about the delivery status. |
bcc | [Recipient] |
Provides information about the email’s blind carbon copy (BCC) recipients. Each Recipient also holds information about the delivery status. |
subject | String |
The email’s subject. |
textBody | String |
The email’s body, in plain text format. |
htmlBody | String |
The email’s body, in HTML format. |
createdAt | String |
The date and time when the email was created. |
sentAt | String |
The date and time when the email was sent. This value matches the date within the email. |
attachmentCount | Int |
Provides the number of attachments (if the email had any). |
attachments | [Attachment] |
Provides information about the actual attachments, as an array of [Attachment] type. |
openCount | Int |
The number of times the email was opened by the recipient. This field is populated only if trackEngagement of the SendMessageInput type was set to true. |
clickCount | Int |
The number of times any link from the email’s HTML body was clicked by the recipient. This field is populated only if trackEngagement of the SendMessageInput type was set to true. |
opens | [Open] |
Provides a list of “email opened” events. This field is populated only if trackEngagement of the SendMessageInput type was set to true. |
clicks | [Click] |
Provides a list of “email links clicked” events. This field is populated only if trackEngagement of the SendMessageInput type was set to true. |
inReplyTo | String |
Provides the Message-ID of the previous message in the chain. |
references | [String] |
Provides a list of Message-IDs of previous messages in the chain. |
externalReference | String |
The identifier of the email within the caller system. |
ContactUser
type
Attribute | Type | Description |
---|---|---|
name | String |
Provides the user name associated with the email address. |
address | EmailAddress |
Provides the email address. |
authorizedUserId | ID |
Provides the internal user ID that was authorized to send this email. This field will be populated only if the email was sent from a from a Google or Microsoft 365 inbox. It must be set to the internal user ID in the calling application. Note that, in order for the email to be sent successfully, the user ID must first be authorized, by means of an Authorization through an app password or an Authorization through OAuth 2.0. |
Contact
type
Attribute | Type | Description |
---|---|---|
name | String |
Provides the user name associated with the email address. |
address | EmailAddress |
Provides the email address. |
Recipient
type
Attribute | Type | Description |
---|---|---|
name | String |
Provides the user name associated with the email address. |
address | EmailAddress |
Provides the email address. |
deliveryStatus | DeliveryStatus |
Provides the email delivery status. Valid values: BOUNCED - The message did not reach the recipient; COMPLAINT - The message was marked as Spam or Junk by the recipient; DELIVERED - The message was successfully delivered to recipient; UNKNOWN - No information about the delivery could be obtained. |
Attachment
type
Attribute | Type | Description |
---|---|---|
name | String |
Provides the attachment’s file name. |
uri | Uri |
Provides the URI of the attachment, if any. |
fileId | String |
Provides the identifier of the file hosted through the File Management Service, if any. |
Open
type
Attribute | Type | Description |
---|---|---|
createdAt | DateTime |
The date and time when the “email open” event was recorded in SBS. |
ipAddress | String |
The IP address from which the email was opened. |
userAgent | String |
The browser (user agent) of the email client. |
timestamp | DateTime |
The date and time when the “email open” event actually took place. |
Click
type
Attribute | Type | Description |
---|---|---|
createdAt | DateTime |
The date and time when the “email link click” event was recorded in SBS. |
link | DateTime |
The link (within the email’s HTML body) that was clicked by the recipient. |
ipAddress | String |
The IP address where the event took place. |
userAgent | String |
The browser (user agent) of the email client. |
timestamp | DateTime |
The date and time when the “email link click” event actually took place. |
subdomain
Returns information about the currently configured inbound email domain. More precisely, the result is an object that contains three attributes:
appLevelDomain
- the email domain configured at application level. For example, if your app is configured to receive all inbound email at @ten.app.socrate.email, thenappLevelDomain
is “app.socrate.email”.subdomain
- the email subdomain configured at tenant level. For example, if your app is configured to receive all inbound email at @ten.app.socrate.email, thensubdomain
is “ten”.domain
- the full email domain at which your app is configured to receive all inbound email. It consists ofsubdomain
, followed by a dot, followed byappLevelDomain
. BothappLevelDomain
andsubdomain
must be defined in order fordomain
to be considered configured. A null value means the inbound email domain is not configured.
For instructions about configuring the inbound email domain, see Receiving email.
Result
Subdomain
type
Attribute | Type | Description |
---|---|---|
subdomain | String |
The email subdomain configured at tenant level. |
domain | String |
The currently configured email domain. SBS will accept any email sent to recipient@domain, where domain is this value. |
appLevelDomain | String |
The email domain configured at application level. |
version
Returns the API version.
Mutations
addEmailAccount
This mutation is useful if you would like to allow your app’s users to connect an email account from a third-party provider (such as Google or Microsoft 365) to the app through an app password. The app password itself must be obtained by the user from the third-party provider. For details, see Obtaining a Google App Password and Obtaining a Microsoft 365 App Password.
The addEmailAccount
mutation adds to SBS the email account managed by Google or Microsoft 365 and stores the app password associated with that email account. Once added, the email address can be used in the from
field when sending email through the sendMessage
mutation.
Storing the app password in SBS is optional. The alternative is to supply the app password as input in the from
field when sending email through the sendMessage
mutation.
Arguments
Argument | Type | Description |
---|---|---|
input | AddEmailAccountInput! |
Provides the input arguments to the mutation. |
AddEmailAccountInput
input
Attribute | Type | Description |
---|---|---|
address | EmailAddress |
Specifies the email address that is to be connected to SBS. |
password | String! |
The app password obtained from Google or Microsoft 365. |
provider | Provider! |
The third-party email provider. Valid values: GOOGLE, MICROSOFT. |
Result
See the EmailAccount
type.
deleteEmailAccount
This mutation deletes a previously added email account from a third-party provider (such as Google or Microsoft 365).
Arguments
Argument | Type | Description |
---|---|---|
id | ID! |
The unique identifier of the email account record. |
Result
See the EmailAccount
type.
deleteDomainIdentity
Deletes a domain identity. Domain identities are created by running the verifyDomainIdentity
mutation.
Arguments
Argument | Type | Description |
---|---|---|
domain | Domain! |
The domain name of the domain identity to be deleted. |
Result
See the DomainIdentity
type.
deleteEmailIdentity
Deletes an email identity. Email identities are created by running the verifyEmailIdentity
mutation.
Arguments
Argument | Type | Description |
---|---|---|
address | EmailAddress! |
The email address of the email identity to be deleted. |
Result
See the EmailIdentity
type.
deleteSubdomain
Deletes a previously registered email subdomain, see Receiving email.
Arguments
Argument | Type | Description |
---|---|---|
input | DeleteSubdomainInput! |
Provides the subdomain value to be deleted. |
DeleteSubdomainInput
input
Attribute | Type | Description |
---|---|---|
subdomain | String! |
The subdomain value to be deleted. |
Result
See the Subdomain
type.
registerSubdomain
Register an email subdomain that uniquely identifies the current tenant within this app. For more information, see Receiving email.
Arguments
Argument | Type | Description |
---|---|---|
input | RegisterSubdomainInput! |
Provides the subdomain value to be registered. Since this value will be part of an email address, it’s advisable to use a short string, descriptive of the tenant. |
RegisterSubdomainInput
input
Attribute | Type | Description |
---|---|---|
subdomain | String! |
The subdomain value to be registered. |
Result
See the Subdomain
type.
sendMessage
Sends an email message to the specified recipients.
to
, cc
, and bcc
recipients) is 50. This limitation originates in Amazon SES.
Arguments
Argument | Type | Description |
---|---|---|
input | SendMessageInput! |
Mandatory argument used to define the properties of the new email, such as the recipient, cc, bcc, and so on. |
SendMessageInput
input
Attribute | Type | Description |
---|---|---|
to | [ContactInput] |
Specifies an array of ContactInput objects that should be the email’s “to” recipient(s). This field is conditional; you can specify a valid recipient by setting one or more of the following fields: to , cc , bcc . |
cc | [ContactInput] |
Specifies an array of ContactInput objects that should be the email’s “cc” recipient(s). This field is conditional; you can specify a valid recipient by setting one or more of the following fields: to , cc , bcc . |
bcc | [ContactInput] |
Specifies an array of ContactInput objects that should be the email’s “bcc” recipient(s). This field is conditional; you can specify a valid recipient by setting one or more of the following fields: to , cc , bcc . |
replyTo | ContactInput |
Optional. Specifies a ContactInput object. If, upon receiving the email, the recipient clicks Reply in their email client application, then the to field will be automatically populated with this value, which may be different from the from address. |
from | ContactUserInput |
Specifies a ContactUserInput object to be used as email sender. This field is mandatory if you are sending email from a validated email address, from a validated domain, or from a Google or Microsoft 365 inbox. If you do not supply the from input, the email will be sent from the default SBS email address. |
subject | String |
Optional. Specifies the email’s subject. |
textBody | String |
Optional. Specifies the email’s body. To create an email body, either textBody or htmlBody (or both) must be set. If both are specified, then the textBody will be used as a fallback if the email client is not capable of reading HTML email. |
htmlBody | Html |
Optional. Specifies the email’s body. To create an email body, either textBody or htmlBody (or both) must be set. If both are specified, then the textBody will be used as a fallback if the email client is not capable of reading HTML email. |
attachments | [AttachmentInput] |
Optional. Specifies an array of file attachments, as [AttachmentInput] objects. |
template | TemplateInput |
Optional. If you set this parameter, the email’s body will be rendered with the help of a document rendering template created previously through the Document Rendering Service. |
inReplyTo | String |
Optional. Specifies the Message-ID of the previous message in the chain. |
references | [String] |
Optional. Specifies the Message-IDs of previous messages in the chain. |
trackEngagement | Boolean |
Optional. You can track engagement only if (i) htmlBody was set (or generated from a template), (ii) the email was not sent from a Google or Microsoft 365 inbox, and (iii) the recipient’s email client application is not blocking images embedded in the email’s body. Set this value to true if you would like to track information about (i) whether the message was opened (and when), and (ii) whether the recipient has clicked links within the email (and which ones). You can obtain these statistics by running the messages query. |
externalReference | String |
Optional. Specifies the identifier associated with the email in the caller system. |
doNotStoreBody | Boolean |
Optional. Provides indication to SBS that the email contains sensitive information and should not be stored. If true, the email’s HTML body, text body, and attachments will not be stored in SBS, and the respective attributes of the sent message will be null. The default value is false (meaning that the HTML body, text body and attachments are stored). |
ContactInput
input
Attribute | Type | Description |
---|---|---|
name | String |
Optional. Specifies the user name associated with the email address. |
address | EmailAddress! |
Mandatory. Specifies the email address, for example somebody@example.org. |
ContactUserInput
input
Attribute | Type | Description |
---|---|---|
name | String |
Optional. Specifies the user name associated with the email address. Setting this value is meaningful only when address is an email address verified through verifyEmailIdentity or verifyDomainIdentity . |
address | EmailAddress |
Conditional. Specifies the sending email address, for example somebody@example.org. You must set this value if you would like to send email (i) from an email address that has already been verified through verifyEmailIdentity , or (ii) from any email address where the domain has been verified through verifyDomainIdentity , or (iii) from an email address managed by a third-party provider (Google, Microsoft). Do not set this value if you set the OAuthApprover value. If both address and OAuthApprover are set, then OAuthApprover takes precedence. |
oauthApprover | ID |
Conditional. This field must be set only if you would like to send email from from a Google or Microsoft 365 inbox for which OAuth 2.0 authorization was already obtained as described in Authorization through OAuth 2.0. Set this to the user ID (in your application) for which the OAuth 2.0 access token was obtained. |
appPassword | [AppPasswordInput ] |
Conditional. Set this field only when address is a Google or Microsoft email address for which you would like to provide an app password as input. Providing an app password as input is an alternative to storing it in SBS through the addEmailAccount mutation. |
AttachmentInput
input
Attribute | Type | Description |
---|---|---|
name | String |
Optional. Specifies the name of the attached file. If you don’t set this parameter, the file name will be inferred from the uri or from fileId . |
uri | Uri |
Conditional. Either uri or fileId must be set. This parameter specifies the remote URI of the file to be attached. |
fileId | ID |
Conditional. Either uri or fileId must be set. This parameter specifies the ID of a file created through the File Management Service. |
TemplateInput
input
Attribute | Type | Description |
---|---|---|
name | String |
Specifies the name of the template created by the Document Rendering Service. |
params | String |
Specifies the parameters to be provided to the template, as a stringified JSON object. |
AppPasswordInput
input
Attribute | Type | Description |
---|---|---|
password | String! |
Mandatory. The app password obtained from a third party provider such as Google or Microsoft. |
provider | Provider! |
Mandatory. The provider from which the app password was obtained. Valid values: GOOGLE, |
MICROSOFT. |
unsuppressAddress
Removes an email address from the AWS suppression list.
Arguments
Attribute | Type | Description |
---|---|---|
address | EmailAddress |
Mandatory. The email address to be removed from the AWS suppression list. |
Result
See the AddressStatus
type.
updateEmailAccount
This mutation updates a previously added email account from a third-party provider (such as Google or Microsoft 365).
Arguments
Argument | Type | Description |
---|---|---|
id | ID! |
The unique identifier of the email account record. |
input | UpdateEmailAccountInput! |
Provides the input arguments to the mutation. |
UpdateEmailAccountInput
input
Attribute | Type | Description |
---|---|---|
address | EmailAddress |
Specifies the email address that is to be connected to SBS. |
password | String! |
The app password obtained from Google or Microsoft 365. |
provider | Provider! |
The third-party email provider. Valid values: GOOGLE, MICROSOFT. |
Result
See the EmailAccount
type.
updateInboundMessage
Updates a received (inbound) email message. Note that the only updatable field is externalReference.
Arguments
Argument | Type | Description |
---|---|---|
id | ID! |
Mandatory argument. Set this to the ID (Message.id ) of the message to be updated. |
input | UpdateInboundMessageInput! |
Mandatory argument that provides the input values for the update. |
UpdateInboundMessageInput
input
Attribute | Type | Description |
---|---|---|
externalReference | String |
The new externalReference value of the email. |
Result
See the InboundMessage
type.
verifyDomainIdentity
Performs a verification of a custom email domain. Email domain verification is a prerequisite to enable sending email from any email address of a custom domain.
Arguments
Argument | Type | Description |
---|---|---|
domain | Domain! |
The email domain to be verified. For example, example.org. |
Result
See the DomainIdentity
type.
verifyEmailIdentity
Performs a verification of a custom email address. Email address verification is a prerequisite to enable sending email from a custom email address.
Arguments
Argument | Type | Description |
---|---|---|
address | EmailAddress! |
The email address to be verified. For example, some.email@example.org. |
Result
See the EmailIdentity
type.