SKTMessageAction

Objective-C

@interface SKTMessageAction : NSObject

Swift

class SKTMessageAction : NSObject

@abstract An action associated to a particular SKTMessage.

Actions are rendered as buttons in the Smooch conversation screen, and may be of type SKTMessageActionTypeLink, SKTMessageActionTypeBuy or SKTMessageActionTypePostback.

See

SKTMessage
  • @abstract The unique identifier representing the action.

    Declaration

    Objective-C

    @property (readonly, nullable) NSString *actionId;

    Swift

    var actionId: String? { get }
  • @abstract The type of action.

    @discussion Valid types include SKTMessageActionTypeLink for regular actions, and SKTMessageActionTypeBuy for buy actions.

    Declaration

    Objective-C

    @property (nullable) NSString *type;

    Swift

    var type: String? { get set }
  • @abstract The text to display as a descriptor for the action.

    @discussion May not be nil.

    Declaration

    Objective-C

    @property (nullable) NSString *text;

    Swift

    var text: String? { get set }
  • uri

    @abstract The URI to navigate to if the user interacts with the action.

    @discussion May not be nil if message is of type SKTMessageActionTypeLink or SKTMessageActionTypeWebview

    Declaration

    Objective-C

    @property (nullable) NSURL *uri;

    Swift

    var uri: URL? { get set }
  • @abstract Fallback URI to use for action types not supported by the SDK. May be nil.

    Declaration

    Objective-C

    @property (nullable) NSURL *fallback;

    Swift

    var fallback: URL? { get set }
  • @abstract The size of a webview

    @discussion May not be nil if message is of type SKTMessageActionTypeWebview

    Declaration

    Objective-C

    @property (copy, nullable) NSString *size;

    Swift

    var size: String? { get set }
  • @abstract Boolean value indicating whether this action is the default action for an SKTMessageItem

    @discussion Default value is NO

    See

    SKTMessageItem

    Declaration

    Objective-C

    @property (readonly) BOOL isDefault;

    Swift

    var isDefault: Bool { get }
  • @abstract Metadata associated with the action.

    @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 Icon to display with a reply

    @discussion An icon to render next to the reply option

    Declaration

    Objective-C

    @property (nullable) NSString *iconUrl;

    Swift

    var iconUrl: String? { get set }
  • @abstract The payload of actions with type SKTMessageActionTypeReply or SKTMessageActionTypePostback

    @discussion The payload of actions with type SKTMessageActionTypeReply or SKTMessageActionTypePostback, if applicable. May be nil

    Declaration

    Objective-C

    @property (nullable) NSString *payload;

    Swift

    var payload: String? { get set }

Buy actions

  • @abstract The purchase state of the action

    @discussion This property is only non-nil for actions of type SKTMessageActionTypeBuy. Valid states include SKTMessageActionStateOffered and SKTMessageActionStatePaid.

    Declaration

    Objective-C

    @property (nullable) NSString *state;

    Swift

    var state: String? { get set }
  • @abstract The amount of money to charge for the action.

    @discussion This property is only valid for actions of type SKTMessageActionTypeBuy. For USD, this value is in cents.

    Declaration

    Objective-C

    @property long amount;

    Swift

    var amount: Int { get set }
  • @abstract The currency in which the amount is expressed.

    @discussion This property is only valid for actions of type SKTMessageActionTypeBuy.

    Declaration

    Objective-C

    @property (nullable) NSString *currency;

    Swift

    var currency: String? { get set }