Skip to main content


This tutorial explains how you can integrate notifications directly in your smart contract by importing Push comm smart contract and using its interface. We will be creating a simple token transfer notification for this guide.


What's going to happen

  • We create a channel and copy it's address
  • We import interface and function call to trigger notification
  • We deploy the contract and add the contract address as delegate
  • Watch in 😲 as each transfer now notifies the wallet address about tokens received

Tutorial time

Push protocol also supports sending notifications to user wallets directly from your smart contract and that too by only adding 2 lines of extra code to your smart contract 🎉.

The best way to do it is by creating your channel first > tweaking your smart contract with notification logic and finally adding the deployed contract address as delegate to your channel.

To learn more about how to import interface and the function call of send notification, please see send notification (via smart contract).


pragma solidity ^0.8.20;
// SPDX-License-Identifier: UNLICENSED

import "";
import "";

// PUSH Comm Contract Interface
interface IPUSHCommInterface {
function sendNotification(address _channel, address _recipient, bytes calldata _identity) external;

contract Push is ERC20 {

using StringsUpgradeable for uint256;
using StringsUpgradeable for address;

address public EPNS_COMM_ADDRESS = 0x0C34d54a09CFe75BCcd878A469206Ae77E0fe6e7;

constructor ()
ERC20("Push Token", "PUSH")
_mint(msg.sender, 1000 * 10 ** uint(decimals()));

function transfer(address to, uint amount) override public returns (bool success) {
address owner = _msgSender();
_transfer(owner, to, amount);
address sender = msg.sender;
uint256 readableAmount = amount / 10 ** uint(decimals());

//"0+3+Hooray! ", msg.sender, " sent ", token amount, " PUSH to you!"
0x554d29160f779Adf0a4328597cD33Ea1Df4D9Ee9, // from channel
to, // to recipient, put address(this) in case you want Broadcast or Subset. For Targeted put the address to which you want to send
// We are passing identity here:
"0", // this is notification identity:
"+", // segregator
"3", // this is payload type: (1, 3 or 4) = (Broadcast, targeted or subset)
"+", // segregator
"Tranfer Alert", // this is notification title
"+", // segregator
"Hooray! ", // notification body
sender.toHexString(), // notification body
" sent ", // notification body
readableAmount.toString(), // notification body
" PUSH to you!" // notification body

return true;

Add delegate

The only remaining step is to deploy your contract and then go to your channel and add the smart contract address as delegate to your channel which will allow that smart contract address to send notification on behalf of your channel.

That's it! Your channel should now send notification as soon as anyone transfer your tokens from one address to the other 🎉🎉🎉!