planetary-social / nos-event-service

A service which collects various events to pass them to other Nos services e.g. the notification service.
Mozilla Public License 2.0
1 stars 0 forks source link

[Notifications] Investigate adding follows as a notification to the notifications service #85

Closed setch-l closed 3 months ago

setch-l commented 6 months ago

Per our infra conversation from last week:

dcadenas commented 4 months ago

Our Events service has the necessary information, but we currently do not utilize it. To implement new follower notifications, we need to establish communication between the Events service and the Notifications service. The required changes are as follows:

  1. Calculate a diff each time follower data is updated through kind 3 updates. This will allow us to detect if new npubs are added (we can also detect removals for completeness, even if we don’t consume this information for now).
  2. Store the latest version of the kind 3 update in the database to minimize the possibility of race condition issues, as described in this GitHub comment.
  3. Communicate each added npub to the Notifications service. Currently, there is no communication between these services. They share a common queue but act as publishers, with the only consumer being the moderation service, Cleanstr. Each service downloads events from relays, so we can leverage the existing architecture. We will modify the Events service to publish added followers through an event of kind 30382, as described in NIP-81. This also enriches the network’s knowledge and benefits other clients and use cases.
  4. Update the Notifications service to consume these kind 30382 events and extend its current functionality, which detects mentions in kind 1 events.
  5. Implement any necessary cascading updates until the notification is rendered.
  6. I’ll need assistance from an iOS developer to set up a local environment to see push notifications on my phone or simulator. I’m currently experiencing Apple Developer ID issues, and the instructions in the Notifications service readme didn’t resolve them.