Skip to main content
  • Snap
  • Restricted

snap_notify

Description

Display a notification in MetaMask or natively in the OS. Snaps can trigger a short (up to 80 characters) notification message for actionable or time sensitive information. inApp notifications can also include an optional expanded view. The expanded view has a title, content, and optional footer link shown when a user clicks on the notification.

Parameters

union

An object containing the parameters for the snap_notify method.

Options

object
required

type

"native"
required

The literal string "native" to indicate that this is a native OS notification. We recommend using inApp instead, as native notifications may be rate-limited by the operating system.

or

object
required

type

"inApp"
required

The literal string "inApp" to indicate that this is an in-app notification displayed in the MetaMask UI.

or

object
required

type

"inApp"
required

The literal string "inApp" to indicate that this is an in-app notification displayed in the MetaMask UI.

content

JSXElement
required

The custom UI content to display when the notification is expanded.

title

string
required

The title of the expanded notification.

footerLink

object

An optional link to display in the footer of the expanded notification.

href

string
required

The URL to navigate to when the link is clicked.

text

string
required

The link text to display.

Common properties

message

string
required

The message to display in the notification.

Returns

null

This method does not return any data, so the result is always null.

Examples

Basic in app notification

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

Expandable in app notification

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

Native notification

{
"initialPermissions": {
"snap_notify": {}
}
}
On this page