Page updated Jan 16, 2024

Clear messages

Once messages have been synced to your user’s device, clearMessages() can be used to clear the synced messages.

1import { clearMessages } from 'aws-amplify/in-app-messaging';
3await clearMessages();

NOTE: If your app has authentication implemented, we recommend calling clearMessages() in between user log-ins to remove messages targeted for specific user segments. This is especially important if you anticipate your application will be used in shared device scenarios.