Message

public struct Message : Sendable
extension Message: Equatable

Represents all info about a message in a chat.

Properties

  • id

    The unique id for the message. Refers to the idOnExternalPlatform.

    The canonical, case-preserving identifier of the message as provided by the backend. Stores the exact value from the backend, without altering case.

    Declaration

    Swift

    public let id: String
  • The thread id for the message. Refers to the threadIdOnExternalPlatform.

    Declaration

    Swift

    public let threadId: String
  • The content of the message

    Declaration

    Swift

    public let contentType: MessageContentType
  • The timestamp of when the message was created.

    Declaration

    Swift

    public let createdAt: Date
  • The attachments on the message.

    Declaration

    Swift

    public let attachments: [Attachment]
  • The direction that the message is being sent (in regards to the agent).

    Declaration

    Swift

    public let direction: MessageDirection
  • An agent statistic information about the message (read status, viewed status, etc.).

    Declaration

    Swift

    public let agentStatistics: UserStatistics?
  • A customer statistic information about the message (read status, viewed status, etc.).

    Declaration

    Swift

    public let customerStatistics: UserStatistics?
  • The agent that sent the message. Only present if the direction is to client (outbound).

    Declaration

    Swift

    public let authorUser: Agent?
  • The customer that sent the message. Only present if the direction is to agent (inbound).

    Declaration

    Swift

    public let authorEndUserIdentity: CustomerIdentity?
  • Information about the sender of a message.

    Declaration

    Swift

    public var senderInfo: SenderInfo? { get }
  • The delivery or read status of the message.

    Declaration

    Swift

    public let status: MessageStatus
  • Whether the message content was generated by an AI agent.

    true when the backend marks the message as AI-generated; false otherwise, including when the backend feature is disabled and the field is absent from the payload.

    Declaration

    Swift

    public let isAiGenerated: Bool

Init

  • Initializer of the Message object

    Declaration

    Swift

    public init(
        id: String,
        threadId: String,
        contentType: MessageContentType,
        createdAt: Date,
        attachments: [Attachment],
        direction: MessageDirection,
        agentStatistics: UserStatistics?,
        customerStatistics: UserStatistics?,
        authorUser: Agent?,
        authorEndUserIdentity: CustomerIdentity?,
        status: MessageStatus,
        isAiGenerated: Bool = false
    )

    Parameters

    id

    The unique id for the message.

    threadId

    The thread id for the message.

    contentType

    The content of the message

    createdAt

    The timestamp of when the message was created.

    attachments

    The attachments on the message.

    direction

    The direction that the message is being sent (in regards to the agent).

    agentStatistics

    An agent statistic information about the message (read status, viewed status, etc.).

    customerStatistics

    A customer statistic information about the message (read status, viewed status, etc.).

    authorUser

    The agent that sent the message. Only present if the direction is to client (outbound).

    authorEndUserIdentity

    The customer that sent the message. Only present if the direction is to agent (inbound).

    status

    The delivery or read status of the message.

    isAiGenerated

    Whether the message content was generated by an AI agent. Defaults to false.

Equatable

  • Declaration

    Swift

    public static func == (lhs: Message, rhs: Message) -> Bool