Skip to content

Commit

Permalink
Update snap_notify method reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Montoya committed Dec 12, 2024
1 parent 8a8cb37 commit b8489be
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion snaps/reference/snaps-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,9 @@ await snap.request({
## `snap_notify`

Displays a [notification](../features/notifications.md) in MetaMask or natively in the OS.
Snaps can trigger a short notification text for actionable or time sensitive information.
Snaps can trigger a short notification text for actionable or time sensitive information.
`inApp` notifications can also include an optional title, content, and footer shown in an
expanded view when a user expands the notification.

#### Parameters

Expand All @@ -874,6 +876,10 @@ An object containing the contents of the notification:
We recommend using `type: "inApp"` because there's no guarantee that native notifications are
displayed to the user.
- `message` - A message to show in the notification.
- `title` (optional) - The title of the expanded view, shown when a user expands the notification.
- `content` (optional) - A custom Snap UI shown in the expanded view
- `footer` (optiona) - A custom footer object with `text` and `href`, displayed as an action button

Check failure on line 881 in snaps/reference/snaps-api.md

View workflow job for this annotation

GitHub Actions / Lint / Spelling (.md)

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'optiona'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'optiona'?", "location": {"path": "snaps/reference/snaps-api.md", "range": {"start": {"line": 881, "column": 13}}}, "severity": "ERROR"}
in the footer of the expanded view.

#### Example

Expand All @@ -883,6 +889,17 @@ await snap.request({
params: {
type: "inApp",
message: "Hello, world!",
title: "Hello from a Snap",
content: (
<Box>
<Heading>Hello, world!</Heading>
<Text>This is a notification sent from a Snap.</Text>
</Box>
),
footerLink: {
href: "https://snaps.metamask.io",
text: "Find more Snaps"
}
},
})
```
Expand Down

0 comments on commit b8489be

Please sign in to comment.