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.
Push Curator provides the following main functionalities:
-
Creating Channel Settings: Channel admin can create notification channels with settings for different categories such as tech, business, education, politics, entertainment, etc.
-
Subscribing to Channels: Users can opt-in to channels and toggle their interests by selecting the categories they are interested in receiving notifications for.
-
Sending Notifications: Channel admin can send notifications to subscribed users based on their selected categories.
npm install
npm run dev
Open http://localhost:3000 with your browser to see the result.
import { PushAPI, CONSTANTS } from "@pushprotocol/restapi";
const pushUser = await PushAPI.initialize(signer, {
env: CONSTANTS.ENV.STAGING
});
const createChannelSettingRes = pushUser.channel.setting([
{
type: 1, // Boolean type
default: 1,
description: "Tech"
},
{
type: 1, // Boolean type
default: 1,
description: "Business"
}
]);
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
]
}
);
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"
}
});