InAppMessageCloseAction

Package: com.salesforce.marketingcloud.inappmessagingfeature
Module: In App Messaging Feature Module v1.0.0

Overview 

1data class InAppMessageCloseAction(
2    val actionType: InAppMessageCloseAction.InAppMessageDismissReason,
3    val id: String?
4)

A data class that represents how an in-app message was closed, including the dismiss reason and an optional identifier.

This class is used in the didCloseMessage callback to inform the host application about the manner in which a message was dismissed—whether through auto-dismiss, a close control, or a button tap.

Parameters 

ParameterTypeDescription
actionTypeInAppMessageDismissReasonThe reason why the message was closed
idString?Optional identifier (e.g., button ID when dismissed via BUTTON); null otherwise

Constructors 

InAppMessageCloseAction 

1constructor(
2    actionType: InAppMessageCloseAction.InAppMessageDismissReason,
3    id: String?
4)

Creates an instance of InAppMessageCloseAction with the specified dismiss reason and optional ID.


Properties 

actionType 

1val actionType: InAppMessageCloseAction.InAppMessageDismissReason

The reason the in-app message was dismissed.

id 

1val id: String?

Optional identifier associated with the close action. Contains a button ID when the message is closed via the BUTTON dismiss reason; null for other dismiss reasons.


Nested Types 

Companion 

1object Companion

Companion object for InAppMessageCloseAction.

InAppMessageDismissReason 

1enum InAppMessageDismissReason : Enum<InAppMessageCloseAction.InAppMessageDismissReason>

An enumeration representing the possible reasons an in-app message was dismissed.

Enum Values:

  • BUTTON - Message was dismissed by tapping a button
  • Additional values may exist. See the enum documentation for complete list.

Usage 

This class is typically received in the InAppMessageManager.EventListener.didCloseMessage callback:

1override fun didCloseMessage(closeAction: InAppMessageCloseAction) {
2    when (closeAction.actionType) {
3        InAppMessageDismissReason.BUTTON -> {
4            // Handle button tap with closeAction.id
5        }
6        // Handle other dismiss reasons
7    }
8}