Skip to main content

Manage channel overview

This section covers all APIs related to managing channel including adding settings, getting and updating channel info, etc.

Get channel info API

// userAlice.channel.info(channel?)
const channelInfo = await userAlice.channel.info();

Fetch channel info parameters

ParamTypeSubtypeDefaultRemarks
channelstring--Channel address in chain specific wallet format. If no channel address is passed, then signer is used to derive the channel

Note: Parameters in this style are mandatory.

Expected response
{
id: 23,
channel: '0xD8634C39BBFd4033c0d3289C4515275102423681',
ipfshash: 'QmVaY4HQaorrMhKo1sHk7FM1B8Xi1JnT3DvJbG9Xv7VeLZ',
name: 'Updated Name',
info: 'Testing new description',
url: 'https://google.com',
icon: 'https://gateway.ipfs.io/ipfs/bafybeib76bmkscu6efwawi2tkltdgthwrpny2ok7lur7nltffgydiq7ruy/QmVaY4HQaorrMhKo1sHk7FM1B8Xi1JnT3DvJbG9Xv7VeLZ',
processed: 1,
attempts: 0,
alias_address: 'NULL',
alias_blockchain_id: 'NULL',
is_alias_verified: 1,
blocked: 0,
alias_verification_event: '{"aliasAddress": "eip155:420:0xD8634C39BBFd4033c0d3289C4515275102423681", "aliasBlockchainId": "420"}',
activation_status: 1,
verified_status: 0,
subgraph_details: null,
counter: null,
timestamp: '2023-10-04T11:53:09.000Z',
subgraph_attempts: 0,
channel_settings: '[]',
subscriber_count: 0
}

Get channel alias info API

A channel alias address is a link to other EVM / non-EVM chain address that acts as an alias to your channel on Ethereum. Currently, alias info needs to be given when you are creating your channel.

// await userAlice.channel.alias.info({options?})
const aliasInfo = await userAlice.channel.alias.info({
alias: aliasAddress,
aliasChain: 'POLYGON',
});

Get alias info parameters

ParamTypeSubtypeDefaultRemarks
optionsobject-Configuration options for retrieving alias information.
-options.aliasstringThe alias address
-options.aliasChainALIAS_CHAINThe name of the alias chain, which can be 'POLYGON' or 'BSC' or 'OPTIMISM' or 'POLYGONZKEVM'

Note: Parameters in this style are mandatory.

Expected response
{
channel: '0x35B84d6848D16415177c64D64504663b998A6ab4',
alias_address: '0x35B84d6848D16415177c64D64504663b998A6ab4',
is_alias_verified: 1,
blocked: 0,
activation_status: 1
}

Get channel subscribers API

// userAlice.channel.subscribers({options?})
const channelSubscribers = await userAlice.channel.subscribers();

Get channel subscribers parameters

ParamTypeSubtypeDefaultRemarks
optionsobject--Configuration options for retrieving subscribers.
-options.channelstringDerived from signerChannel address in chain specific wallet format. If no channel address is passed, then signer is used to derive the channel
-options.pagenumber-A number representing the page of results to retrieve.
-options.limitnumber-Represents the maximum number of subscriptions to retrieve per page
-options.settingbooleanfalseA boolean flag if when set to true, fetches user settings along with the subscriber
-options.categorynumber-Filters out subscribers that have enabled a specific category of notification settings

Note: Parameters in this style are mandatory.

Expected response
// PushAPI.channels.getSubscribers | Response - 200 OK
{
"itemcount": 10,
"subscribers": [
"0x1d4f52775344f9a32093af0ccd03a4fb6dac8e30",
"0x28d615edd8404f8ca1e0271a0b5a48171589921a",
"0x4352639b99689069f9b0b847eee349c3c1b0706c",
"0x50029e62540537045bcfd3d320483865344edb33",
"0x5ac9e6205eaca2bbba6ef716fd9aabd76326eeee",
"0x778d3206374f8ac265728e18e3fe2ae6b93e4ce4",
"0xa44f2994750cf774eab05751d90ade4dedabe7fe",
"0xbcfb7da1dcf40e8cfb331683bb7d6f4eba091b08",
"0xcf5dbf241fc65a5af56c95101ac4e9ec2c57d941",
"0xd8634c39bbfd4033c0d3289c4515275102423681"
]
}

Search channel API

// userAlice.channel.search(query, {options?})
const searchedChannels = await userAlice.channel.search('push');

Search channel parameters

ParamTypeSubtypeDefaultRemarks
querystring-The search query to find channels
optionsobject-Configuration options for the search
-options.pagenumber1The page of results to retrieve
-options.limitnumber10The maximum number of channels to retrieve per page

Note: Parameters in this style are mandatory.

Expected response
[
{
id: 2,
channel: '0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924',
ipfshash: 'QmSbRT16JVF922yAB26YxWFD6DmGsnSHm8VBrGUQnXTS74',
name: 'Ethereum Push Notification Service',
info: 'The channel provides useful information, notifications, etc to all the users of the EPNS platform. While not recommended, you can unsubcribe if you want to.',
url: 'https://epns.io/',
icon: 'https://gateway.ipfs.io/ipfs/bafybeihwgapkthxi6udojr7soqetk5xx22bdy56uupivcwkriaiqzwlyiu/QmSbRT16JVF922yAB26YxWFD6DmGsnSHm8VBrGUQnXTS74',
processed: 1,
attempts: 0,
alias_address: 'NULL',
alias_blockchain_id: 'NULL',
is_alias_verified: 0,
blocked: 0,
alias_verification_event: null,
activation_status: 1,
verified_status: 0,
subgraph_details: null,
counter: null,
timestamp: '2022-12-12T05:17:02.000Z',
subgraph_attempts: 0,
channel_settings: null,
subscriber_count: 11,
},
{
id: 96,
channel: '0x18C0Ab0809589c423Ac9eb42897258757b6b3d3d',
ipfshash: 'QmYo8ABBk3tj3g6FRiLkoJNFRedm7JVk6iiVWTRdeEmRmy',
name: 'test with push',
info: 'test with push',
url: 'https://push.org',
icon: 'https://gateway.ipfs.io/ipfs/bafybeicsksoatvksk4xazftcehg6sodevkgzkzuuvoz3htzt7ejskbdu2y/QmYo8ABBk3tj3g6FRiLkoJNFRedm7JVk6iiVWTRdeEmRmy',
processed: 1,
attempts: 0,
alias_address: 'NULL',
alias_blockchain_id: 'NULL',
is_alias_verified: 0,
blocked: 0,
alias_verification_event: null,
activation_status: 1,
verified_status: 0,
subgraph_details: null,
counter: null,
timestamp: '2023-01-10T04:42:26.000Z',
subgraph_attempts: 0,
channel_settings: null,
subscriber_count: 0,
},
];

Update channel API

note

This function requires the wallet to have some Push Tokens and eth to pay for gas fees.

No. of Push Token Required = 50 + (No. of Times Channel Has been updated) * 50

// userAlice.channel.update({options?})
const updateChannelRes = await userAlice.channel.update({
name: newChannelName,
description: newChannelDescription,
url: newChannelURL,
icon: newBase64FormatImage,
alias: newAliasAddressInCAIP,
});

Update channel parameters

ParamTypeSubtypeDefaultRemarks
optionsobject--Configuration options for updating a channel
-options.namestring-New name of the channel
-options.descriptionstring-New description of the channel
-options.iconstring (base64 encoded)-New channel's icon in base64 encoded string format
-options.urlstring-New URL associated with the channel
-options.aliasstring-New alias address in Channel address in chain specific wallet format
-options.progresshook(progress) => void-A callback function that's called during channel creation progress, see progress object

Note: Parameters in this style are mandatory.

Expected response
{
transactionHash: '0xf5056d382f209b5a7bcbf08d69c80dd13079467ba38413da8ca065a45f901a32';
}

Update channel progress object parameters

Optional: Informs about individual progress stages during channel creation if progresshook is function is passed during channel creation API call.

ParamTypeSubtypeDefaultRemarks
progressobject--progress object that is passed in the callback
-Progress.idstring-Predefined, ID associated with the progress objects
-Progress.levelstring-Predefined, Level associated with the progress objects
-Progress.titlestring-Predefined, title associated with the progress objects
-Progress.infostring-Predefined, info associated with the progress objects

Progress object details

Progress.idProgress.levelProgress.titleProgress.info
PUSH-CHANNEL-CREATE-01INFOUploading data to IPFSThe channel’s data is getting uploaded to IPFS
PUSH-CHANNEL-CREATE-02INFOApproving PUSH tokensGives approval to Push Core contract to spend 50 DAI
PUSH-CHANNEL-CREATE-03INFOChannel is getting createdCalls Push Core contract to create your channel
PUSH-CHANNEL-CREATE-04SUCCESSChannel creation is done, Welcome to Push EcosystemChannel creation is completed
PUSH-CHANNEL-UPDATE-01INFOUploading new data to IPFSThe channel’s new data is getting uploaded to IPFS
PUSH-CHANNEL-UPDATE-02INFOApproving PUSH tokensGives approval to Push Core contract to spend 50 DAI
PUSH-CHANNEL-UPDATE-03INFOChannel is getting updatedCalls Push Core contract to update your channel details
PUSH-CHANNEL-UPDATE-04SUCCESSChannel is updated with new dataChannel is successfully updated
PUSH-ERROR-02ERRORTransaction failed for a function callTransaction failed

Verify channel API

note

The wallet must have a channel with verification tag to verify other channels.

Channel Verification feature enables a channel owner to verify other channels. A verified channel not only boosts user trust in its notifications but also receives a prominent position in the User interface. Verifications done can have either a Primary or a Secondary verification tag.

  • Primary Verification tag: Channels that have directly been verified by the Push.

  • Secondary Verification tag: Channels that have been verified by other Primary Verified channels and not directly by the Push.

// userAlice.channel.verify(channel)
const verifyChannelRes = await userAlice.channel.verify(channel);

Verify channel parameters

ParamTypeSubtypeDefaultRemarks
channelstring--Channel address in CAIP to be verified

Note: Parameters in this style are mandatory.

Expected response
{
transactionHash: '0xf5056d382f209b5a7bcbf08d69c80dd13079467ba38413da8ca065a45f901a32';
}