AVAMessage

Objective-C

@interface AVAMessage : NSObject <NSSecureCoding>

Swift

class AVAMessage : 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 AVACoordinates *)coordinates
                                        payload:(nullable NSString *)payload
                                       metadata:(nullable NSDictionary *)metadata;

    Swift

    init(coordinates: AVACoordinates, 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

    AVAMessageStatus

    Declaration

    Objective-C

    @property (readonly) AVAMessageUploadStatus uploadStatus;

    Swift

    var uploadStatus: AVAMessageUploadStatus { get }
  • @abstract An array of AVAMessageAction 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

    AVAMessageAction

    Declaration

    Objective-C

    @property (readonly, nullable) NSArray *actions;

    Swift

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

    @discussion Only messages of type AVAMessageTypeCarousel and AVAMessageTypeList contain items.

    See

    AVAMessageItem

    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 AVAMessageTypeText, AVAMessageTypeImage, and AVAMessageTypeLocation

    Declaration

    Objective-C

    @property (nullable) NSString *type;

    Swift

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

    Declaration

    Objective-C

    @property (readonly, nullable) AVACoordinates *coordinates;

    Swift

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

    See

    AVADisplaySettings

    Declaration

    Objective-C

    @property (readonly, nullable) AVADisplaySettings *displaySettings;

    Swift

    var displaySettings: AVADisplaySettings? { 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 AVAMessageActionTypeReply

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

    Declaration

    Objective-C

    @property (nullable) NSString *payload;

    Swift

    var payload: String? { get set }