Push Protocol: Channel settings overview
This blog encompasses APIs associated with the configuration of channel settings.
What do you mean by channel settings??
A channel might have the need to send notifications for various categories. For instance, Coindesk may wish to send notifications for tech, marketing, DeFi, and more. Similarly, Aave may want to send notifications for specific loan liquidation values.
Configuring settings for your channel empowers users to specify their preferences regarding the types of notifications they wish to receive and the timing of such notifications.
After enabling channel settings, you can retrieve the preferences of each user through the Fetch Subscription API. Additionally, you can initiate notifications targeted at specific settings categories using the Send Notification API.
Channel settings API
// creates channel settings
const createChannelSettingRes = userAlice.channel.settings([
{
type: 1, // Boolean type
default: 1,
description: 'Receive marketing notifications'
},
{
type: 2, // Slider type
default: 10,
description: 'Notify when loan health breaches',
data: { upper: 100, lower: 5, ticker: 1 },
},
])
Discussing channel settings parameters
The type (type: number) param: The notification setting type: 1 for boolean type, and 2 for slider type.
The default (type: number) param: The default value for the setting.
The description (type: string) param: A description of the setting.
The data.upper (type: number) param: Valid for slider type only. The upper limit for the setting.
The data.lower (type: number) param: Valid for slider type only. The lower limit for the setting.
The data.ticker (type: number) param: Valid for slider type only. The ticker by which the slider moves.
This is the expected response:
{
transactionHash: '0xf5056d382f209b5a7bcbf08d69c80dd13079467ba38413da8ca065a45f901a32'
}
Types of channel settings
Push currently facilitates the configuration of the following settings for your channel:
Boolean Setting - Users can express their preference as true or false. For instance, opting to receive marketing notifications.
Slider Setting - Users can determine their preference within a specified range using a slider. For example, setting an alert for when an ENS domain expires, with a range of 1 to 7 days.
What if I face any problem??
What to do in case of problems??
Thoroughly go through the documentation of Push Protocol before starting anything or in between
Join the Discord server to discuss that issue
Raise an issue on the Push GitHub
That's it, folks if you loved the blog then please leave a heart coz that keeps me motivated to write more such blogs.