---
title: "Clear messages"
section: "frontend/in-app-messaging"
platforms: ["angular", "javascript", "nextjs", "react", "react-native", "vue"]
gen: 2
last-updated: "2026-03-25T17:40:00.000Z"
url: "https://docs.amplify.aws/react/frontend/in-app-messaging/clear-messages/"
---

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

```js title="src/index.js"
import { clearMessages } from 'aws-amplify/in-app-messaging';

await clearMessages();
```

<Callout informational>

**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.

</Callout>
