Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Apr 29, 2024

Resolve conflicts

In the rare case where an event is sent and meets the criteria set forth by multiple in-app messages, the library needs to decide which message to return. If such a conflict should arise, In-App Messaging will choose a message by:

  1. Sorting the messages in order of campaign expiration
  2. Returning the top message sorted (the closest message to expiry)

However, this may not be how you wish to resolve such conflicts so you may want to set your own conflict handler.

import { setConflictHandler } from 'aws-amplify/in-app-messaging';
/**
* Regardless of your conflict resolution strategy the handler must always accept
* an array of in-app messages and return a single in-app message.
*/
const myConflictHandler = (messages) => {
// Return a random message
const randomIndex = Math.floor(Math.random() * messages.length);
return messages[randomIndex];
};
setConflictHandler(myConflictHandler);