Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: notification metadata #1503

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/web3inbox/backend-integration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ To send a notification notification you can call the `/notify` endpoint. This en
- `title` - The title of the notification. Max 64 characters.
- `body` - The body of the notification containing more detail. Max 255 characters.
- `url` (optional) - A URL attached to the notification that the user can navigate to. Max 255 characters.
- `data` (optional) - Arbitrary custom data that can be attached to the notification. Accessible by apps that display notifications. Max 255 characters.
- `accounts` - A list of [CAIP-10](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md) account IDs for which to send the notification to. Max 500 accounts per request. Also see the [rate limits](#rate-limits) below.
- `notification_id` (optional) - An idempotency key of arbitrary format used to dedup multiple requests. Max 255 characters. Multiple calls with the same `notification_id` will use the first call's `notification` content, but will send to any additional account IDs listed in `accounts`.

Expand All @@ -37,6 +38,7 @@ type RequestBody = {
title: string
body: string
url?: string | null
data?: string | null
}
accounts: string[]
}
Expand Down
36 changes: 26 additions & 10 deletions docs/web3inbox/frontend-integration/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -338,16 +338,24 @@ const { data: notifications, nextPage } = useNotifications(notificationsPerPage,

- **notificationsPerPage:** Number representing how many notifications to get per fetch
- **isInfiniteScroll:** Whether or not to keep already fetched notifications when getting next page
- **notifications:** Array of notifications, of type
- **notifications:** Array of notifications:

```ts
{
title: string
type Notification = {
// Unique ID of this notification assigned by the Notify Server
id: string
// The timestamp when this notification was sent to the Notify Server
sentAt: number
// The notification type ID of the notification
type: string
// The title of the notification
title: string
// The body of the notification
body: string
id: string
// A call-to-action URL for when clicking on the notification
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really control the UX of how they use the URL though

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I guess I was overly prescriptive. But I wanted to explain what it was intended for more than just "a URL". Do you have a suggestion for better description?

url: string | null
type: string
// Arbitrary custom data set by the sender of the notification
data: string | null
}
```

Expand Down Expand Up @@ -375,16 +383,24 @@ const { nextPage } = client.pageNotifications(notificationsPerPage, isInfiniteSc
- **isInfiniteScroll:** Whether or not to keep already fetched notifications when getting next page
- **onUpdate:**: A callback that will be called whenever notifications get updated
- **nextPage:**: A function to be called to fetch the next page of notifications
- **notifications:** Array of notifications, of type
- **notifications:** Array of notifications:

```ts
{
title: string
type Notification = {
// Unique ID of this notification assigned by the Notify Server
id: string
// The timestamp when this notification was sent to the Notify Server
sentAt: number
// The notification type ID of the notification
type: string
// The title of the notification
title: string
// The body of the notification
body: string
id: string
// A call-to-action URL for when clicking on the notification
url: string | null
type: string
// Arbitrary custom data set by the sender of the notification
data: string | null
}
```

Expand Down