FIP: Notifications as protocol primitives #131
Replies: 1 comment 3 replies
-
Thanks for writing out this proposal, it's very thorough! I'm a little hesitant to finalize this until there's another client that wants to work through the implementation. It's sometimes hard to predict the right design until there is a practical use case to validate it against. For example, most in-app notifications are time based -- that is, i know the last time a user looked at their notifications and simply compute the number of "new things", and as soon as they open notifications they get reset to zero. Perhaps all that is necessary is a single message per user that stores the 'last viewed' timestamp and each client can compute their notifications accordingly. I propose leaving this in draft and collecting more feedback as we go. |
Beta Was this translation helpful? Give feedback.
-
Title: Notifications as protocol primitives
Type: Standards FIP
Authors: @vrypan
Abstract
A proposal to make Notifications a protocol primitive.
Problem
Right now, notifications are a client-specific feature. Clients may decide to notify users when an onchain event happened (someone minted a NFT), when there was a reaction (reply, recast) to one of their casts, when their storage is running low, or a new DAO proposal is open for voting.
However, there is no standard way for an app other than the client the user makes use of to send notifications.
Also, client-specific notifications are not portable between clients. For example, if Warpcast implements storage limits/expiration notifications, users of alternative clients will not receive them.
Specification
Notifications can be considered as "light" casts (no embeds) intended to appear in a single user's notification feed. A notification is valid ONLY if the recipient (
m.data.body.to
) follows the sender (m.data.fid
).A new NotificationsStore CRDT to track NotificationAdd/NotificationRemove messages must be implemented.
NotificationAddBody messages contain the fid of the recipient, an action (CastID or URL and a label) that can be presented as a call to action button, a text and an optional
displayBefore
timestamp that can be used by clients (but has no impact on CRDT) to hide a time-sensitive notification after a point in time.A NotificationAddBody in a message
m
is valid only if it passes these validations:m.signature_scheme
must be SIGNATURE_SCHEME_ED25519.m.data.type
must be MESSAGE_TYPE_NOTIFICATION_ADD.m.data.body.type
must be NotificationAddBody.m.data.body.to
must be a known fid.m.data.body.to
must followm.data.fid
m.data.body.text
must contain <= 160 bytes and be a valid UTF8 string.m.data.displayBefore
must be a valid Farcaster epoch timestamp.Hub changes
Hubs must implement NotificationStore which tracks Notifications for each fid. The Hubs also expose the following APIs for this new functionality:
Storage limits
One storage unit increases
CRDT limits
by 1000 Notifications.Rationale
Notifications will allow applications to implement custom flows that require notifying a user, without polluting the timeline.
Spam is prevented by requiring that the recipient already follows the sender at the time the notification was posted to hubs. Abuse is also prevented and penalized because users can unfollow the account that abuses the system, and block them from sending notifications in the future.
While Notifications are a premium way of communicating with users, this is why 1 storage unit = 1000 Notifications. An application that wants to send 100,000 notifications per day, will either have to pay 100 storage units, or 99% of its notifications will be pruned by hubs before they are read by their recipients.
There is nothing preventing clients to continue populating notifications streams with custom notifications as they wish.
Example flows that could take advantage of Notifications:
Examples of current Warpcast notifications that could be implemented by other apps using this FIP:
Limitations
The design does not have a way to update a notification. Notification updates may be a desirable feature (for example, a notification about the number of mints of a specific NFT will have to be updated over time). The current design assumes that applications will use a
NotificationRemoveBody
to remove the outdated notification and post a newNotificationAddBody
.Beta Was this translation helpful? Give feedback.
All reactions