Instant Message

The ContactInstantMessage model represents an instant messaging account associated with a contact in the ContactsManager SDK.

Properties

  • instantMessageId: String - Unique identifier for the IM entry
  • service: String? - The messaging service (e.g., WhatsApp, Telegram, Signal)
  • username: String? - The username on the messaging platform
  • userIdentifier: String? - Unique identifier for the user on the platform
  • type: String? - The type or label for the IM (e.g., personal, work)
  • emoji: String? - An emoji icon associated with this IM account
  • contact: Contact? - Reference to the parent contact that owns this IM account

Usage Example

// Create an instant message account
let instantMessage = ContactInstantMessage(
    contactId: "contact-123",
    service: "WhatsApp",
    username: "+1234567890",
    userIdentifier: nil,
    type: "personal",
    emoji: "💬"
)

// Add to a contact
contact.instantMessageAddresses.append(instantMessage)

// Access from a contact
if let firstIM = contact.instantMessageAddresses.first {
    print("IM: \(firstIM.display())")
}