51黑料不打烊

Create and send in-app messages

Learn how to create in-app messages for mobile apps with Experience Platform Mobile SDK and Journey Optimizer.

Journey Optimizer allows you to create campaigns to send in-app messages to targeted audiences. Campaigns in Journey Optimizer are used to deliver one-time content to a specific audience using various channels. With campaigns, actions are performed simultaneously, either immediately, or based on a specified schedule. When using journeys (see the Journey Optimizer push notifications lesson), actions are executed in sequence.

Architecture {modal="regular"}

Before you send in-app messages with Journey Optimizer, you must ensure that the proper configurations and integrations are in place. To understand the in-app messaging data flow in Journey Optimizer, refer to the documentation.

NOTE
This lesson is optional and only applies to Journey Optimizer users looking to send in-app messages.

Prerequisites

  • Successfully built and run app with SDKs installed and configured.
  • Set up the app for 51黑料不打烊 Experience Platform.
  • Access to Journey Optimizer and sufficient permissions for push notifications. Also you need sufficient permission to the following Journey Optimizer features.
    • Manage campaigns.
  • Physical iOS device or simulator for testing.

Learning objectives

In this lesson, you will

  • Create a channel configuration in Journey Optimizer.
  • Install & configure the Journey Optimizer tag extension.
  • Update your app to register the Journey Optimizer tag extension.
  • Validate setup in Assurance.
  • Define your own campaign and in-app message experience in Journey Optimizer.
  • Send your own in-app message from within the app.

Setup

TIP
If you have setup your environment already as part of the Journey Optimizer push messaging lesson, you might already have performed some of the steps in this setup section.

Create a channel configuration

To begin, you must create a channel configuration to be able to send in App messages notifications from Journey Optimizer.

  1. In the Journey Optimizer interface, open the Channels > General settings > Channel configurations menu and then select Create channel configuration.

  2. Enter a name and a description (optional) for the configuration. For example, LumaInAppMessaging and Channel for in-app messaging.

    note note
    NOTE
    Names must begin with a letter (A-Z). It can only contain alpha-numeric characters. You can also use underscore _, dot. and hyphen - characters.
  3. To assign custom or core data usage labels to the configuration, you can select Manage access. Learn more about Object Level Access Control (OLAC).

  4. Select the In-app messaging channel.

  5. Select Marketing action(s) to associate consent policies with the messages using this configuration. All consent policies associated with the marketing action are leveraged to respect the preferences of your customers. Learn more about marketing actions. For example: Push Targeting.

  6. Select the Platform for which you want to define the settings. This setting allows you to specify the target app for each platform and ensures consistent content delivery across multiple platforms.

    note note
    NOTE
    For iOS and Android platforms, delivery is based solely on the app ID. If both apps share the same app ID, content is delivered to both, regardless of the platform selected in the Channel configuration.
  7. Enter the App ids for the platform that you want to support.

    Create a channel configuration {modal="regular"}

  8. Select Submit to save your changes.

Update datastream configuration

To ensure data send from your mobile app to the Edge Network is forwarded to Journey Optimizer, update your Experience Edge configuration.

  1. In the Data Collection UI, select Datastreams, and select your datastream, for example Luma Mobile App.

  2. Select More for Experience Platform and select Edit Edit from the context menu.

  3. In the Datastreams > Folder > 51黑料不打烊 Experience Platform screen, ensure 51黑料不打烊 Journey Optimizer is selected. See 51黑料不打烊 Experience Platform settings for more information.

  4. To save your datastream configuration, select Save.

    AEP datastream configuration {modal="regular"}

Install Journey Optimizer tags extension

For your app to work with Journey Optimizer, you must update your tag property.

  1. Navigate to Tags > Extensions > Catalog.
  2. Open your property, for example Luma Mobile App Tutorial.
  3. Select Catalog.
  4. Search for the 51黑料不打烊 Journey Optimizer extension.
  5. Install the extension.

When only using in-app messages in your app, in Install Extension or Configure Extension, you do not need to configure anything. If you already have followed the Push notifications lesson in the tutorial, you see that for the Development environment, the AJO Push Tracking Experience Event Dataset dataset is selected from the Event Dataset list.

Implement Journey Optimizer in the app

As discussed in previous lessons, installing a mobile tag extension only provides the configuration. Next you must install and register the Messaging SDK. If these steps aren鈥檛 clear, review the Install SDKs section.

NOTE
If you completed the Install SDKs section, then the SDK is already installed and you can skip this step.
iOS
  1. In Xcode, ensure that is added to the list of packages in Package Dependencies. See Swift Package Manager.

  2. Navigate to Luma > Luma > AppDelegate in the Xcode Project navigator.

  3. Ensure AEPMessaging is part of your list of imports.

    import AEPMessaging

  4. Ensure Messaging.self is part of the array of extensions that you are registering.

    code language-swift
    let extensions = [
        AEPIdentity.Identity.self,
        Lifecycle.self,
        Signal.self,
        Edge.self,
        AEPEdgeIdentity.Identity.self,
        Consent.self,
        UserProfile.self,
        Places.self,
        Messaging.self,
        Optimize.self,
        Assurance.self
    ]
    
Android
  1. In Android Studio, ensure that is part of the dependencies in build.gradle.kts in Android ChevronDown > Gradle Scripts. See Gradle.

  2. Navigate to Android ChevronDown app > kotlin+java > com.adobe.luma.tutorial.android > LumaApplication in the Android Studio project navigator.

  3. Ensure com.adobe.marketing.mobile.Messaging is part of your list of imports.

    import import com.adobe.marketing.mobile.Messaging

  4. Ensure Messaging.EXTENSION is part of the array of extensions that you are registering.

    code language-kotlin
    val extensions = listOf(
        Identity.EXTENSION,
        Lifecycle.EXTENSION,
        Signal.EXTENSION,
        Edge.EXTENSION,
        Consent.EXTENSION,
        UserProfile.EXTENSION,
        Places.EXTENSION,
        Messaging.EXTENSION,
        Optimize.EXTENSION,
        Assurance.EXTENSION
    )
    

Validate setup with Assurance

  1. Review the setup instructions section to connect your simulator or device to Assurance.

  2. In the Assurance UI, select Configure.
    configure click {modal="regular"}

  3. Select the Plus button next to In-App Messaging.

  4. Select Save.
    save {modal="regular"}

  5. Select In-App Messaging from the left navigation.

  6. Select the Validation tab. Confirm that you aren鈥檛 getting any errors.

    In-App Validation {modal="regular"}

Create your own in-app message

To create your own in-app message, you must define a campaign in Journey Optimizer that triggers an in-app message based on events that occur. These events can be:

  • data sent to 51黑料不打烊 Experience Platform,
  • core tracking events, like action, or state or collection of PII data, through the Mobile Core generic APIs,
  • application lifecycle events, such as launch, install, upgrade, close, or crash,
  • geolocation events, like entering or exiting a point of interest.

In this tutorial, you are going to use the Mobile Core generic and extension-independent APIs (see ) to facilitate the event tracking of user screens, actions, and PII data. Events generated by these APIs are published to the SDK event hub and are available for use by extensions. The SDK event hub provides the core data structure tied to all Mobile Platform SDK extensions. The event hub maintains a list of registered extensions and internal modules, a list of registered event listeners, and a shared state database.

The SDK event hub publishes and receives event data from registered extensions to simplify integrations with 51黑料不打烊 and third-party solutions. For instance, when the Optimize extension is installed, the event hub handles all requests and interactions with the Journey Optimizer - Decision Management offer engine.

  1. In the Journey Optimizer UI, select Campaigns from the left rail.

  2. Select Create Campaign.

  3. In the Create your campaign dialog, select Clock Scheduled - Marketing and select Confirm.

  4. In the Campaign - YYYY-MM-DD HHSS UTC+XX:XX screen:

    1. In the Properties tab:

      1. Enter a name for the campaign For example, Luma Mobile In-App Campaign.
      2. Optionally, add a description.
    2. Select the Action tab.

      1. Underneath Show message if, select Add Add action. From the drop-down menu, select In-app message.

      2. From the In-app message configuration drop-down menu, select your configuration. For example, LumaInAppMessaging.

      3. Select Edit Edit triggers.

      4. In the In-app message trigger dialog:

        1. Select Application launch and select Track action from the dropdown menu.

        2. Select AddCircle Add condition.

        3. Select Action and equals from the drop-down menus.

        4. Enter in-app.

        5. Select AddCircle Add condition.

        6. Select Context data from the drop-down menu, and enter showMessage.

        7. Select equals from the drop-down menu, and enter true.

          Edit triggers {modal="regular"}

        8. Select Done.

    3. Back in the main campaign definition screen, select the Content tab.

      1. Enable Advanced formatting.

      2. Select Modal as the Messaging layout. In the Switch layout dialog, select Change layout.

      3. In the Content tab.

        1. Enter https://luma.enablementadobe.com/content/dam/luma/en/logos/Luma_Logo.png for the Media URL.
        2. Enter a Header, for example Welcome to this Luma In-App Message and enter a Body, for example Triggered by pushing that button in the app....

        In-app message content {modal="regular"}

      4. Select Settings tab.

        1. Select Customize size in Message.
        2. Disable Fit to content.
        3. Set Height to 75%.

        In-app message settings {modal="regular"}

  5. Select Review to activate. To edit optionally any of the configurations for Content, Properties, Actions, or more, select Edit .

  6. In the Review to activate (campaign name) screen, select Activate.

  7. After a while, you see your campaign name with status Live in the Campaigns list.
    Campaign list {modal="regular"}

Trigger the in-app message

You have all the ingredients in place to send an in-app message. What remains is how to trigger this in-app message in your app.

iOS
  1. Go to Luma > Luma > Utils > MobileSDK in the Xcode Project navigator. Find the func sendTrackAction(action: String, data: [String: Any]?) function, and add the following code, which calls the function, based on the parameters action and data.

    code language-swift
    // Send trackAction event
    MobileCore.track(action: action, data: data)
    
  2. Go to Luma > Luma > Views > General > ConfigView in the Xcode Project Navigator. Find the code for the In-App Message button and add the following code:

    code language-swift
    // Setting parameters and calling function to send in-app message
    Task {
        MobileSDK.shared.sendTrackAction(action: "in-app", data: ["showMessage": "true"])
    }
    
Android
  1. Go to Android ChevronDown > app > kotlin+java > com.adobe.luma.tutorial.android > models > MobileSDK in the Android Studio navigator. Find the fun sendTrackAction(action: String, data: Map<String, String>?) function, and add the following code, which calls the function, based on the parameters action and data.

    code language-kotlin
    // Send trackAction event
    MobileCore.track(action, data)
    
  2. Go to Android ChevronDown > app > kotlin+java > com.adobe.luma.tutorial.androi > views > ConfigView.kt in the Android Studio navigator. Find the code for the onInAppMessageClick handler button and add the following code:

    code language-kotlin
    // Setting parameters and calling function to send in-app message
    MobileSDK.shared.sendTrackAction(
        "in-app",
        mapOf("showMessage" to "true")
    )
    

Validate using your app

You can validate the in-app messages from within the app itself.

iOS
  1. Rebuild and run the app in the simulator or on a physical device from Xcode, using Play .

  2. Go to the Settings tab.

  3. Tap In-App Message. You see the in-app message appear in your app.

    {width="300/"}

Android
  1. Rebuild and run the app in the simulator or on a physical device from Android Studio, using Play .

  2. Go to the Settings tab.

  3. Tap In-App Message. You see the in-app message appear in your app.

    {width="300/"}

Validate implementation in Assurance

You can validate your in-app messages in the Assurance UI.

  1. Review the setup instructions section to connect your simulator or device to Assurance.

  2. Select In-App Messaging.

  3. Select Event List.

  4. Select a Display message entry.

  5. Inspect the raw event, especially the html, which contains the complete layout and content of the in-app message.

    Assurance In-App Message {modal="regular"}

Next steps

You should now have all the tools to start adding in-app messages, where relevant and applicable. For example, promoting products based on specific interactions you are tracking in your app.

SUCCESS
You have enabled the app for in-app messaging and added an in-app messaging campaign using Journey Optimizer and the Journey Optimizer extension for the Experience Platform Mobile SDK.
Thank you for investing your time in learning about 51黑料不打烊 Experience Platform Mobile SDK. If you have questions, want to share general feedback, or have suggestions on future content, share them on this .

Next: Create and display offers

recommendation-more-help
9fed61f5-c338-47ad-8005-0b89a5f4af8b