Push Protocol Web3 Notifications Integration
Email and push notifications in dApp—Web2 standard. In Web3 problem: user has no email, only wallet. Push Protocol (formerly EPNS) solves this: notifications tied to wallet address, user subscribes to channels and gets notifications in Push-compatible apps or directly via SDK in dApp.
Creating Channel and Sending Notifications
Channel—on-chain entity deployed to Ethereum or Polygon. Create via Push SDK or UI. After creation—send notifications via backend SDK:
import { PushAPI, CONSTANTS } from '@pushprotocol/restapi';
import { ethers } from 'ethers';
const signer = new ethers.Wallet(process.env.CHANNEL_PRIVATE_KEY!);
const user = await PushAPI.initialize(signer, {
env: CONSTANTS.ENV.PROD,
});
// Send notification to specific address
await user.channel.send(['0xUserAddress...'], {
notification: {
title: 'Position at Risk of Liquidation',
body: 'Your health factor dropped to 1.05. Add collateral.',
},
payload: {
title: 'Liquidation Warning',
body: 'Health factor: 1.05',
cta: 'https://app.yourprotocol.com/positions',
img: 'https://cdn.yourprotocol.com/alert.png',
},
channel: `eip155:1:${CHANNEL_ADDRESS}`,
type: 3, // Targeted (specific address)
});
Notification types: 1—Broadcast (all subscribers), 3—Targeted (one address), 4—Subset (address list).
User Subscription in dApp
import { useAccount } from 'wagmi';
import { PushAPI, CONSTANTS } from '@pushprotocol/restapi';
const { address } = useAccount();
const subscribe = async () => {
// User signs message (free, no transaction)
const pushUser = await PushAPI.initialize(signer, { env: CONSTANTS.ENV.PROD });
await pushUser.notification.subscribe(`eip155:1:${CHANNEL_ADDRESS}`);
};
// Get notifications for display in dApp
const { data: notifications } = useQuery({
queryKey: ['push-notifications', address],
queryFn: () => PushAPI.user.getFeeds({
user: `eip155:1:${address}`,
env: CONSTANTS.ENV.PROD,
}),
enabled: !!address,
refetchInterval: 30_000,
});
Typical Use Cases
- DeFi: notification on approaching liquidation, limit order execution, lock period ending
- NFT: listing sold, bid received, mint open
- DAO: new proposal, voting ends in 24 hours, voting results
Sending notifications from backend—via cron job or on-chain listener event. Example: indexer caught HealthFactorLow event → call Push API to send targeted notification to position address.
Development Timeline
Create channel + SDK integration in frontend (subscribe UI + display notifications) + backend send from event listener: 2-3 days.







