Salmandabbakuti / push-curator

Your Personalized News, Curated and Pushed with Push Protocol Notifications

Home Page:https://push-curator.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Push Curator

Push Curator is a project aimed at delivering personalized news notifications to users based on their interests. It utilizes push protocols and custom notification channels to allow users to subscribe to specific categories and receive relevant updates accordingly.

Overview:

Push Curator provides the following main functionalities:

  1. Creating Channel Settings: Channel admin can create notification channels with settings for different categories such as tech, business, education, politics, entertainment, etc.

  2. Subscribing to Channels: Users can opt-in to channels and toggle their interests by selecting the categories they are interested in receiving notifications for.

  3. Sending Notifications: Channel admin can send notifications to subscribed users based on their selected categories.

Getting Started:

npm install

npm run dev

Open http://localhost:3000 with your browser to see the result.

Demo

Screen2

Screen1

How its been implemented:

Initializing SDK

import { PushAPI, CONSTANTS } from "@pushprotocol/restapi";

const pushUser = await PushAPI.initialize(signer, {
  env: CONSTANTS.ENV.STAGING
});

Creating Channel with Settings

const createChannelSettingRes = pushUser.channel.setting([
  {
    type: 1, // Boolean type
    default: 1,
    description: "Tech"
  },
  {
    type: 1, // Boolean type
    default: 1,
    description: "Business"
  }
]);

Subscribing to Channel with Settings

const response = await userAlice.notification.subscribe(
  `eip155:11155111:${channelAddress}`,
  {
    settings: [
      // settings are dependent on channel
      { enabled: true }, // setting 1
      { enabled: false }, // setting 2
      { enabled: true } // setting 3
    ]
  }
);

Sending Notification with category

await pushUser.channel.send(["*"], {
  notification: {
    title: "New Notification",
    body: "This is a new notification"
  },
  payload: {
    category: 1, // category id, setting index in this case(tech 1, business 2, education 3, etc.)
    cta: "https://example.com/cta"
  }
});

About

Your Personalized News, Curated and Pushed with Push Protocol Notifications

https://push-curator.vercel.app


Languages

Language:JavaScript 88.5%Language:CSS 11.5%