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
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | Yes | — | Unique identifier for this email request |
emailConfigurationId | string | No | — | Email configuration ID for sender settings and credentials |
templateId | string | No | — | Pre-defined email template ID for structured content |
to | array<EmailRecipient> | Yes | — | Primary recipients (at least one required) |
cc | array<EmailRecipient> | null | No | — | Carbon copy recipients |
bcc | array<EmailRecipient> | null | No | — | Blind carbon copy recipients |
replyTo | string | null | No | — | Reply-to email address |
subject | string | Yes | — | Email subject line (supports {{variable}} syntax) |
bodyHtml | string | Yes | — | HTML content of the email body |
bodyText | string | No | — | Plain text alternative content |
variables | object | No | — | Template variable substitutions as key-value pairs |
attachments | array<EmailAttachment> | null | No | — | File attachments (total size should not exceed 25MB) |
scheduledAt | number | No | — | Unix timestamp in milliseconds for scheduled delivery |
serviceConversationConfigId | string | null | No | — | Linked conversation record ID for threading |
metadata | object | No | — | Additional custom metadata for campaign tracking |
createdAt | number | No | — | Unix timestamp when created |
updatedAt | number | null | No | — | Unix timestamp when last updated |
EmailRecipient
Email recipient with address and optional display name.
Schema: EmailRecipientSchema
Attributes
| Attribute | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Email address in standard format (e.g., 'user@example.com') |
name | string | No | Display 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
| Attribute | Type | Required | Description |
|---|---|---|---|
filename | string | Yes | Name of the attachment file (e.g., 'invoice.pdf') |
content | string | Yes | Base64-encoded file content |
contentType | string | Yes | MIME 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
}
Related
- Conversation Configuration - Conversation tracking for email threads
- Outbound SMS - SMS messaging requests
- Outbound Call - Voice call requests