Skip to main content


Everything you will need to get up and running in 2 mins or less!


# Install Libraries
npm install @pushprotocol/restapi@latest ethers@^5.7

Import libraries

// Import restapi for function calls
import { PushAPI, CONSTANTS } from '@pushprotocol/restapi';

// Ethers or Viem, both are supported
import { ethers } from 'ethers';

Initialize User

// Creating a random signer from a wallet, ideally this is the wallet you will connect
const signer = ethers.Wallet.createRandom();

// Initialize wallet user
// 'CONSTANTS.ENV.PROD' -> mainnet apps | 'CONSTANTS.ENV.STAGING' -> testnet apps
const userAlice = await PushAPI.initialize(signer, {

Send Notification

// Requires user to have a channel, see Create Channel section for more info
// ['*'] sends to all wallets who have opted in to your channel
const response = await['*'], {
notification: {
title: 'You awesome notification',
body: 'from your amazing protocol',

Stream / Real time updates / Socket

// To listen to real time notifications
const stream = await userAlice.initStream([CONSTANTS.STREAM.NOTIF]);

// Setup event handling
stream.on(CONSTANTS.STREAM.NOTIF, (data) => {

// Connect stream but only after setting all event handling