Skip to main content

Create channel overview

This API is useful for creating a channel, which is the first step for sending a notification on Push Protocol.

Create channel API

Any protocol that wants to send a notification to their users needs to create a channel. A wallet can only have one channel.

// userAlice.channel.create({options})
const response = await userAlice.channel.create({
name: "Test Channel",
description: "Test Description",
icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAz0lEQVR4AcXBsU0EQQyG0e+saWJ7oACiKYDMEZVs6GgSpC2BIhzRwAS0sgk9HKn3gpFOAv3v3V4/3+4U4Z1q5KTy42Ql940qvFONnFSGmCFmiN2+fj7uCBlihpgh1ngwcvKfwjuVIWaIGWKNB+GdauSk8uNkJfeNKryzYogZYoZY40m5b/wlQ8wQM8TayMlKeKcaOVkJ71QjJyuGmCFmiDUe+HFy4VyEd57hx0mV+0ZliBlihlgL71w4FyMnVXhnZeSkiu93qheuDDFDzBD7BcCyMAOfy204AAAAAElFTkSuQmCC",
url: "https://push.org",
});

Create channel parameters

ParamTypeSubtypeDefaultRemarks
optionsobject--Configuration options for creating a channel
-options.namestring-The name of the channel
-options.descriptionstring-A description of the channel
-options.iconstring (base64 encoded)-The channel's icon in base64 encoded string format
-options.urlstring-The URL associated with the channel
-options.aliasstring-alias address in 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: "0x0232fb66e2cb41c291ca10af4aa3ad0bc515adcea34de0f456db10306db89677";
}

Create 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 $PUSH
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 $PUSH
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