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

[ADD] notification standards #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
62 changes: 62 additions & 0 deletions types/notificationFeed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Notification Feed [Draft]

## Schema

The SCHEMA is to be described.

Users get different type of notifications from users.
It should be used when you need a user to be notified of some event. This event might even happen outside Near Social. For example
- You've been mentioned on a widget.
- You are requested to do something on a website you've given permission to send you notifications

On this notifications, you might even want to have a link to be redirected to the corresponding place, always considering security.

## Example 1

In this case, Alice would create a notification to Bob letting Bob know Alice mentioned Bob in Alice's main page with no message

```json
{
"alice.near": {
"index": {
"notify": {
"key": "bob.near",
"value": {
"type": "mention",
"item": {
"type": "social",
"path": "alice.near/post/main",
"blockHeight": 88260018,
Comment on lines +26 to +29

Choose a reason for hiding this comment

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

Item shouldn't include the message. Item is more like a pointer. It provides enough information to identify the given item. E.g. for a post it indicates the following:

  • type = "social" - means it belongs to social DB
  • path = "alice.near/post/main" - absolute path the item, in this case for alice.near
  • blockHeight = 88260018 - the block height when the information at the path above is written, if omitted it means the same as the notification (for example when you post smth, you don't have a block height until it's saved).

"message": ""

Choose a reason for hiding this comment

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

Message can be included as part of the value, but not item

}
}
}
}
}
}
```

## Example 2

In this case, Alice would create a notification alert to Bob letting Bob know Alice played in a game along with a link to the website. For this, it is ideal to have either a whitelisted and blacklisted websites and an alert for not yet listed pages telling the user they are getting out of Near Social so they can proceed under their own risk.

```json
{
"alice.near": {
"index": {
"notify": {
"key": "bob.near",
"value": {
"type": "alert",
"item": {
"type": "social",
"path": "https://near.gaming",
"blockHeight": 88260018,
"message": "It's your turn"
}
}
Comment on lines +49 to +57

Choose a reason for hiding this comment

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

We don't have a schema for items yet, but we should add it. Example for url below:

Suggested change
"value": {
"type": "alert",
"item": {
"type": "social",
"path": "https://near.gaming",
"blockHeight": 88260018,
"message": "It's your turn"
}
}
"value": {
"type": "alert",
"item": {
"type": "url",
"path": "https://near.gaming",
},
"message": "It's your turn"
}

}
}
}
}
```