Example: Trigger IAM after closing an IAM

Sometimes you may want to chain together IAMs based on specific buttons clicked in a previous IAM.

Using the Custom Action ID Click Action you can specify an identifier for that click action. It is also recommended to set it to Dismiss on click within the Advanced Options of that block and addTrigger method to show the IAM.

In this example, we call the action Name trigger-banner

868868

The action name will be detected upon click within the In App Message Click Handler. Combine this with the addTrigger method to pass in the identifier and trigger another In-App Message.

For example:

let inAppMessageClickBlock: OSInAppMessageClickBlock = { action in
    if let clickName = action.clickName {
        print("clickName string: ", clickName)
        if clickName == "trigger-banner" {
          OneSignal.addTrigger(clickName, "1")
        }
    }
}

OneSignal.setInAppMessageClickHandler(inAppMessageClickBlock)

In the In-App Message you want to chain after it, set the In-App Trigger to be the click name.

For example, set the click name trigger-banner to exists.

17941794

Did this page help you?