SKTMessage

Objective-C

@interface SKTMessage : NSObject <NSSecureCoding>

Swift

class SKTMessage : NSObject, NSSecureCoding

A class representing a message.

  • @abstract Create a message with the given text. The message will be owned by the current user.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithText:(nonnull NSString *)text;

    Swift

    init(text: String)
  • @abstract Create a message with the given text, payload, and metadata. The message will be owned by the current user

    Declaration

    Objective-C

    - (nonnull instancetype)initWithText:(nonnull NSString *)text
                                 payload:(nullable NSString *)payload
                                metadata:(nullable NSDictionary *)metadata;

    Swift

    init(text: String, payload: String?, metadata: [AnyHashable : Any]?)
  • @abstract Create a message with the given coordinates, payload, and metadata. The message will be owned by the current user

    Declaration

    Objective-C

    - (nonnull instancetype)initWithCoordinates:
                                (nonnull SKTCoordinates *)coordinates
                                        payload:(nullable NSString *)payload
                                       metadata:(nullable NSDictionary *)metadata;

    Swift

    init(coordinates: SKTCoordinates, payload: String?, metadata: [AnyHashable : Any]?)
  • @abstract The unique identifier of the message. May be nil if a unique identifier has not been generated for this message

    Declaration

    Objective-C

    @property (readonly, nullable) NSString *messageId;

    Swift

    var messageId: String? { get }
  • @abstract The text content of the message. May be nil if mediaUrl or actions are provided

    Declaration

    Objective-C

    @property (nullable) NSString *text;

    Swift

    var text: String? { get set }
  • @abstract The text fallback to display for message types not supported by the SDK. May be nil

    Declaration

    Objective-C

    @property (nullable) NSString *textFallback;

    Swift

    var textFallback: String? { get set }
  • @abstract The displayName of the author. This property may be nil if no displayName could be determined.

    Declaration

    Objective-C

    @property (nullable) NSString *displayName;

    Swift

    var displayName: String? { get set }
  • @abstract The url for the author’s avatar image. May be nil

    Declaration

    Objective-C

    @property (nullable) NSString *avatarUrl;

    Swift

    var avatarUrl: String? { get set }
  • @abstract The date and time the message was sent

    Declaration

    Objective-C

    @property (nullable) NSDate *date;

    Swift

    var date: Date? { get set }
  • @abstract Returns YES if the message originated from the user, or NO if the message comes from the app team.

    Declaration

    Objective-C

    @property (nonatomic) BOOL isFromCurrentUser;

    Swift

    var isFromCurrentUser: Bool { get set }
  • @abstract The upload status of the message.

    See

    SKTMessageStatus

    Declaration

    Objective-C

    @property (readonly) SKTMessageUploadStatus uploadStatus;

    Swift

    var uploadStatus: SKTMessageUploadStatus { get }
  • @abstract An array of SKTMessageAction objects representing the actions associated with this message (if any)

    @discussion This array may be nil or empty, so check the length of the array to know if a message has actions or not.

    See

    SKTMessageAction

    Declaration

    Objective-C

    @property (readonly, nullable) NSArray *actions;

    Swift

    var actions: [Any]? { get }
  • @abstract An array of SKTMessageItem objects representing the items associated with this message

    @discussion Only messages of type SKTMessageTypeCarousel and SKTMessageTypeList contain items.

    See

    SKTMessageItem

    Declaration

    Objective-C

    @property (readonly, nullable) NSArray *items;

    Swift

    var items: [Any]? { get }
  • @abstract The url to the media asset, if applicable. Returns nil if the message is not an image or file message.

    Declaration

    Objective-C

    @property (nullable) NSString *mediaUrl;

    Swift

    var mediaUrl: String? { get set }
  • @abstract The size of the media asset in bytes. May be nil.

    Declaration

    Objective-C

    @property (nullable) NSNumber *mediaSize;

    Swift

    var mediaSize: NSNumber? { get set }
  • @abstract The type the message.

    @discussion Valid types include SKTMessageTypeText, SKTMessageTypeImage, and SKTMessageTypeLocation

    Declaration

    Objective-C

    @property (nullable) NSString *type;

    Swift

    var type: String? { get set }
  • @abstract Coordinates for a location for a message of type SKTMessageTypeLocation

    Declaration

    Objective-C

    @property (readonly, nullable) SKTCoordinates *coordinates;

    Swift

    var coordinates: SKTCoordinates? { get }
  • @abstract Settings to adjust the layout of a message of type SKTMessageTypeCarousel

    See

    SKTDisplaySettings

    Declaration

    Objective-C

    @property (readonly, nullable) SKTDisplaySettings *displaySettings;

    Swift

    var displaySettings: SKTDisplaySettings? { get }
  • @abstract The role of the message.

    @discussion Valid roles include appUser, business, and whisper. Messages created with -initWithText: have role of appUser.

    Declaration

    Objective-C

    @property (readonly, nullable) NSString *role;

    Swift

    var role: String? { get }
  • @abstract Metadata associated with the message.

    @discussion A flat dictionary of metadata set through the REST API. May be nil.

    Declaration

    Objective-C

    @property (nullable) NSDictionary *metadata;

    Swift

    var metadata: [AnyHashable : Any]? { get set }
  • @abstract The payload of an action with type SKTMessageActionTypeReply

    @discussion The payload of a SKTMessageActionTypeReply, if applicable. May be nil

    Declaration

    Objective-C

    @property (nullable) NSString *payload;

    Swift

    var payload: String? { get set }