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
- js
// userAlice.channel.info(channel?)
const channelInfo = await userAlice.channel.info();
Fetch channel info parameters
Param | Type | Subtype | Default | Remarks |
---|---|---|---|---|
channel | string | - | - | 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.
- js
// await userAlice.channel.alias.info({options?})
const aliasInfo = await userAlice.channel.alias.info({
alias: aliasAddress,
aliasChain: 'POLYGON',
});
Get alias info parameters
Param | Type | Subtype | Default | Remarks |
---|---|---|---|---|
options | object | - | Configuration options for retrieving alias information. | |
- | options.alias | string | The alias address | |
- | options.aliasChain | ALIAS_CHAIN | The 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
- js
// userAlice.channel.subscribers({options?})
const channelSubscribers = await userAlice.channel.subscribers();
Get channel subscribers parameters
Param | Type | Subtype | Default | Remarks |
---|---|---|---|---|
options | object | - | - | Configuration options for retrieving subscribers. |
- | options.channel | string | Derived from signer | Channel address in chain specific wallet format. If no channel address is passed, then signer is used to derive the channel |
- | options.page | number | - | A number representing the page of results to retrieve. |
- | options.limit | number | - | Represents the maximum number of subscriptions to retrieve per page |
- | options.setting | boolean | false | A boolean flag if when set to true, fetches user settings along with the subscriber |
- | options.category | number | - | 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
- js
// userAlice.channel.search(query, {options?})
const searchedChannels = await userAlice.channel.search('push');
Search channel parameters
Param | Type | Subtype | Default | Remarks |
---|---|---|---|---|
query | string | - | The search query to find channels | |
options | object | - | Configuration options for the search | |
- | options.page | number | 1 | The page of results to retrieve |
- | options.limit | number | 10 | The 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
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
- js
// userAlice.channel.update({options?})
const updateChannelRes = await userAlice.channel.update({
name: newChannelName,
description: newChannelDescription,
url: newChannelURL,
icon: newBase64FormatImage,
alias: newAliasAddressInCAIP,
});
Update channel parameters
Param | Type | Subtype | Default | Remarks |
---|---|---|---|---|
options | object | - | - | Configuration options for updating a channel |
- | options.name | string | - | New name of the channel |
- | options.description | string | - | New description of the channel |
- | options.icon | string (base64 encoded) | - | New channel's icon in base64 encoded string format |
- | options.url | string | - | New URL associated with the channel |
- | options.alias | string | - | 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.
Param | Type | Subtype | Default | Remarks |
---|---|---|---|---|
progress | object | - | - | progress object that is passed in the callback |
- | Progress.id | string | - | Predefined, ID associated with the progress objects |
- | Progress.level | string | - | Predefined, Level associated with the progress objects |
- | Progress.title | string | - | Predefined, title associated with the progress objects |
- | Progress.info | string | - | Predefined, info associated with the progress objects |
Progress object details
Progress.id | Progress.level | Progress.title | Progress.info |
---|---|---|---|
PUSH-CHANNEL-CREATE-01 | INFO | Uploading data to IPFS | The channel’s data is getting uploaded to IPFS |
PUSH-CHANNEL-CREATE-02 | INFO | Approving PUSH tokens | Gives approval to Push Core contract to spend 50 DAI |
PUSH-CHANNEL-CREATE-03 | INFO | Channel is getting created | Calls Push Core contract to create your channel |
PUSH-CHANNEL-CREATE-04 | SUCCESS | Channel creation is done, Welcome to Push Ecosystem | Channel creation is completed |
PUSH-CHANNEL-UPDATE-01 | INFO | Uploading new data to IPFS | The channel’s new data is getting uploaded to IPFS |
PUSH-CHANNEL-UPDATE-02 | INFO | Approving PUSH tokens | Gives approval to Push Core contract to spend 50 DAI |
PUSH-CHANNEL-UPDATE-03 | INFO | Channel is getting updated | Calls Push Core contract to update your channel details |
PUSH-CHANNEL-UPDATE-04 | SUCCESS | Channel is updated with new data | Channel is successfully updated |
PUSH-ERROR-02 | ERROR | Transaction failed for a function call | Transaction failed |
Verify channel API
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.
- js
// userAlice.channel.verify(channel)
const verifyChannelRes = await userAlice.channel.verify(channel);
Verify channel parameters
Param | Type | Subtype | Default | Remarks |
---|---|---|---|---|
channel | string | - | - | Channel address in CAIP to be verified |
Note: Parameters
in this style
are mandatory.
Expected response
{
transactionHash: '0xf5056d382f209b5a7bcbf08d69c80dd13079467ba38413da8ca065a45f901a32';
}