Emails

Emails in Luella are the actual messages exchanged between participants. Each email belongs to a thread and contains information like sender, recipients, subject, content body, and timestamp — similar to how email services like Gmail manage conversations.

The email model

This model defines a single message within a thread, including sender/recipient details, content, and delivery status.

Properties

  • Name
    emailId
    Type
    string
    Description

    Unique identifier for the email.

  • Name
    threadId
    Type
    string
    Description

    ID of the thread this email belongs to.

  • Name
    mailboxId
    Type
    string
    Description

    ID of the mailbox (email address) that sent or received this message.

  • Name
    status
    Type
    string
    Description

    Status of the email. One of: Read, Unread, Queued, Sent.

  • Name
    from
    Type
    string
    Description

    Email address that sent the message.

  • Name
    to
    Type
    string[]
    Description

    List of recipients.

  • Name
    cc
    Type
    string[]
    Description

    List of CC recipients.

  • Name
    bcc
    Type
    string[]
    Description

    List of BCC recipients.

  • Name
    subject
    Type
    string
    Description

    Subject line of the email.

  • Name
    teaser
    Type
    string
    Description

    Short preview of the email body.

  • Name
    body
    Type
    object
    Description

    Body content of the email. Contains 'emailContent' and 'contentType'.

  • Name
    attachmentIds
    Type
    string[]
    Description

    Array of attachment IDs.

  • Name
    timestamp
    Type
    timestamp (ISO string)
    Description

    Timestamp of when the message was sent.

  • Name
    createdAt
    Type
    timestamp (ISO string)
    Description

    When this email record was created.

  • Name
    lastUpdatedAt
    Type
    timestamp (ISO string)
    Description

    When this email record was last updated.


POST/emails/ListEmails

List all emails in a thread

List all emails belonging to a given thread or execution. Emails are returned in ascending or descending order based on timestamp.

Required attributes

  • Name
    userId
    Type
    string
    Description

    ID of the user requesting emails.

  • Name
    workspaceId
    Type
    string
    Description

    Workspace the thread belongs to.

  • Name
    sortOrder
    Type
    string
    Description

    Sort direction. Must be either 'Ascending' or 'Descending'.

Optional attributes

  • Name
    threadId
    Type
    string
    Description

    ID of the thread whose emails you want to fetch.

  • Name
    executionId
    Type
    string
    Description

    Optional execution context for sent emails.

  • Name
    nextToken
    Type
    string
    Description

    Token for pagination.

  • Name
    maxItems
    Type
    number
    Description

    Limit the number of results returned.

Request

POST
/emails/ListEmails
{
  "userId": "user_123",
  "workspaceId": "workspace_456",
  "threadId": "thread_001",
  "sortOrder": "Descending",
  "maxItems": 20
}

Response

{
  "emails": [
    {
      "emailId": "email_001",
      "mailboxId": "john.doe@luella.ai",
      "status": "Read",
      "content": {
        "threadId": "thread_001",
        "emailId": "email_001",
        "from": "john.doe@luella.ai",
        "to": ["prospect@example.com"],
        "cc": [],
        "bcc": [],
        "subject": "Let's connect",
        "teaser": "Just wanted to follow up...",
        "body": {
          "emailContent": "<p>Hi there, following up...</p>",
          "contentType": "text/html"
        },
        "attachmentIds": [],
        "timestamp": "2024-04-02T13:00:00.000Z"
      },
      "createdAt": "2024-04-02T13:00:01.000Z",
      "lastUpdatedAt": "2024-04-02T13:10:00.000Z"
    }
  ],
  "nextToken": null
}

POST/emails/GetEmail

Get a single email

Retrieve all details of a specific email message within a thread.

Required attributes

  • Name
    userId
    Type
    string
    Description

    ID of the user making the request.

  • Name
    workspaceId
    Type
    string
    Description

    Workspace the email belongs to.

  • Name
    threadId
    Type
    string
    Description

    ID of the thread the email belongs to.

  • Name
    emailId
    Type
    string
    Description

    ID of the email to retrieve.

Request

POST
/emails/GetEmail
{
  "userId": "user_123",
  "workspaceId": "workspace_456",
  "threadId": "thread_001",
  "emailId": "email_001"
}

Response

{
  "threadId": "thread_001",
  "emailId": "email_001",
  "mailboxId": "john.doe@luella.ai",
  "content": {
    "threadId": "thread_001",
    "emailId": "email_001",
    "from": "john.doe@luella.ai",
    "to": ["prospect@example.com"],
    "cc": [],
    "bcc": [],
    "subject": "Let's connect",
    "teaser": "Just wanted to follow up...",
    "body": {
      "emailContent": "<p>Hi there, just following up again on our chat.</p>",
      "contentType": "text/html"
    },
    "attachmentIds": [],
    "timestamp": "2024-04-02T13:00:00.000Z"
  },
  "status": "Read",
  "createdAt": "2024-04-02T13:00:01.000Z",
  "lastUpdatedAt": "2024-04-02T13:10:00.000Z"
}

Was this page helpful?