Skip to main content

Outbound Email

Outbound email requests manage composing, scheduling, and tracking emails sent through AI-powered communication workflows. Supports HTML/text content, attachments, templates with variable substitution, and scheduled delivery.

Source: src/core/conversation/outbound-email.schema.ts


EmailRequest​

Complete outbound email request with content, recipients, attachments, and scheduling options. Supports HTML and plain text content, template-based composition with variable substitution, and scheduled delivery.

Schema: EmailRequestSchema

Attributes​

AttributeTypeRequiredDefaultDescription
idstringYes—Unique identifier for this email request
emailConfigurationIdstringNo—Email configuration ID for sender settings and credentials
templateIdstringNo—Pre-defined email template ID for structured content
toarray<EmailRecipient>Yes—Primary recipients (at least one required)
ccarray<EmailRecipient> | nullNo—Carbon copy recipients
bccarray<EmailRecipient> | nullNo—Blind carbon copy recipients
replyTostring | nullNo—Reply-to email address
subjectstringYes—Email subject line (supports {{variable}} syntax)
bodyHtmlstringYes—HTML content of the email body
bodyTextstringNo—Plain text alternative content
variablesobjectNo—Template variable substitutions as key-value pairs
attachmentsarray<EmailAttachment> | nullNo—File attachments (total size should not exceed 25MB)
scheduledAtnumberNo—Unix timestamp in milliseconds for scheduled delivery
serviceConversationConfigIdstring | nullNo—Linked conversation record ID for threading
metadataobjectNo—Additional custom metadata for campaign tracking
createdAtnumberNo—Unix timestamp when created
updatedAtnumber | nullNo—Unix timestamp when last updated

EmailRecipient​

Email recipient with address and optional display name.

Schema: EmailRecipientSchema

Attributes​

AttributeTypeRequiredDescription
emailstringYesEmail address in standard format (e.g., 'user@example.com')
namestringNoDisplay name shown in email clients (e.g., 'John Smith')

EmailAttachment​

File attachment to include with an outbound email. Content must be base64-encoded.

Schema: EmailAttachmentSchema

Attributes​

AttributeTypeRequiredDescription
filenamestringYesName of the attachment file (e.g., 'invoice.pdf')
contentstringYesBase64-encoded file content
contentTypestringYesMIME type (e.g., 'application/pdf', 'image/png')

CreateEmailRequest​

Schema for creating a new email request. Omits auto-generated fields (id, timestamps, audit fields).

Schema: CreateEmailRequestSchema

Attributes​

Same as EmailRequest, excluding: id, createdAt, updatedAt, createdBy, updatedBy, deletedAt, deletedBy, uniqueKey, version.


Example​

Email Request​

{
"id": "email_abc123",
"to": [
{ "email": "customer@example.com", "name": "John Smith" }
],
"cc": [
{ "email": "manager@example.com", "name": "Jane Doe" }
],
"subject": "Your Order Confirmation - #{{order_id}}",
"bodyHtml": "<h1>Thank you, {{name}}!</h1><p>Your order #{{order_id}} is confirmed.</p>",
"bodyText": "Thank you, {{name}}! Your order #{{order_id}} is confirmed.",
"variables": {
"order_id": "12345",
"name": "John"
},
"metadata": {
"campaignId": "camp_789",
"templateVersion": "v2"
},
"createdAt": 1709856000000
}

Email with Attachment​

{
"to": [
{ "email": "customer@example.com" }
],
"subject": "Your Invoice",
"bodyHtml": "<p>Please find your invoice attached.</p>",
"attachments": [
{
"filename": "invoice.pdf",
"content": "JVBERi0xLjQKJeLjz9MKMyAwIG9...",
"contentType": "application/pdf"
}
]
}

Scheduled Email​

{
"to": [
{ "email": "customer@example.com", "name": "Customer" }
],
"subject": "Reminder: Your appointment tomorrow",
"bodyHtml": "<p>This is a reminder about your appointment.</p>",
"scheduledAt": 1709942400000
}