Edit in GitHubLog an issue

Use custom metadata with in-app messages

You can add and retrieve custom metadata in an in-app message payload by completing the following steps:

Add custom metadata to an in-app message in AJO

When authoring an in-app message in AJO, from the Content tab, under Message layout, select the Data tab to add key/value pairs to the payload of the in-app message.

ajo-inapp-kvp-data

Implement and assign a PresentationDelegate/MessagingDelegate

To retrieve custom metadata from a Message object, you will first need to implement and set a PresentationDelegate (for Android SDK) or MessagingDelegate (for iOS SDK).

Please read the tutorial for more detailed instructions on implementing and using a PresentationDelegate/MessagingDelegate.

Retrieve custom metadata from the Message object

From within the PresentationDelegate or MessagingDelegate, call Message.getMetadata() or Message.metadata after getting an instance of the Message object.

The following example shows retrieving custom metadata using the Message.getMetadata() API. The example uses the canShow method of the PresentationDelegate, however you may retrieve the custom metadata anywhere within the delegate where the Message object is available.

Kotlin

Copied to your clipboard
var currentMessagePresentable: Presentable<InAppMessage>? = null
override fun canShow(presentable: Presentable<*>): Boolean {
if (presentable.getPresentation() !is InAppMessage) {
return
}
currentMessagePresentable = presentable as Presentable<InAppMessage>
// Get the Message object
val message = MessagingUtils.getMessageForPresentable(currentMessagePresentable)
// Retrieve the custom metadata as type Map<String, Any>
val metadata = message?.metadata
}

Java

Copied to your clipboard
Presentable<InAppMessage> currentMessagePresentable = null;
@Override
public void canShow(Presentable<?> presentable) {
if (!(presentable.getPresentation() instanceof InAppMessage)) {
return;
}
currentMessagePresentable = (Presentable<InAppMessage>) presentable;
// Get the Message object
Message message = MessagingUtils.getMessageForPresentable(currentMessagePresentable);
// Retrieve the custom metadata
if (message != null) {
Map<String, Object> metadata = message.getMetadata();
}
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2025 Adobe. All rights reserved.