> For the complete documentation index, see [llms.txt](/llms.txt).

# Notifications

You can display notifications directly in MetaMask or natively in a user's operating system (OS) using the [snap_notify](/snaps/reference/snaps-api/snap%5Fnotify/) API method.

## Steps[​](#steps "Direct link to Steps")

### 1\. Request permission to notify users[​](#1-request-permission-to-notify-users "Direct link to 1. Request permission to notify users")

Request the [snap_notify](/snaps/reference/snaps-api/snap%5Fnotify/) permission. Add the following to your Snap's manifest file:

snap.manifest.json

```
"initialPermissions": {
  "snap_notify": {}
}

```

### 2\. Create a notification[​](#2-create-a-notification "Direct link to 2. Create a notification")

Create a notification by calling [snap_notify](/snaps/reference/snaps-api/snap%5Fnotify/), which takes a notification `type` and `message`. Specify `type: "inApp"` to display the notification in the MetaMask UI, or `type: "native"` to display the notification in the user's OS.

note

We recommend using `type: "inApp"` because there's no guarantee that native notifications are displayed to the user. You can also call `snap_notify` twice, with each notification type, to trigger both an in-app and native notification.

The following example displays a notification in MetaMask, with the message "Hello, world!":

index.js

```
await snap.request({
  method: 'snap_notify',
  params: {
    type: 'inApp',
    message: 'Hello, world!',
  },
})

```

![Notification alert](/assets/images/notifications-1-def6ca5b7fbea5768f21904b4775ea25.png)

![Notification message](/assets/images/notifications-2-173fdb771f96910e23e0963e273a674e.png)

Notification rate limits

Each Snap can trigger up to:

- Five in-app notifications per minute.
- Two native notifications per five minutes.

## Expanded view[​](#expanded-view "Direct link to Expanded view")

In-app notifications can include an optional expanded view that displays when selected. The expanded view includes a title, [custom UI](/snaps/features/custom-ui/) content, and an optional footer link.

The following example displays a notification in MetaMask, with the message "Hello, world!" When the user selects the notification, the expanded view displays a page with a title, a paragraph, and a link to the MetaMask Snaps directory:

index.js

```
await snap.request({
  method: 'snap_notify',
  params: {
    type: 'inApp',
    message: 'Hello, world!',
    title: 'Hello',
    content: (
      <Box>
        <Text>Did you know you can find more Snaps in the MetaMask Snaps Directory?</Text>
      </Box>
    ),
    footerLink: {
      text: 'Visit the directory',
      href: 'https://snaps.metamask.io',
    },
  },
})

```

## Example[​](#example "Direct link to Example")

See the [@metamask/notifications-example-snap](https://github.com/MetaMask/snaps/tree/main/packages/examples/packages/notifications)package for a full example of implementing notifications using [snap_notify](/snaps/reference/snaps-api/snap%5Fnotify/). This example exposes a [custom JSON-RPC API](/snaps/learn/about-snaps/apis/#custom-json-rpc-apis) for dapps to display in-app and native notifications.
