Altszn.com
  • Home
  • Crypto
    • Altcoins
    • Bitcoin
    • Ethereum
    • Monero
    • XRP
    • Zcash
  • Web3
  • DeFi
  • NFTs
No Result
View All Result
Altszn.com
  • Home
  • Crypto
    • Altcoins
    • Bitcoin
    • Ethereum
    • Monero
    • XRP
    • Zcash
  • Web3
  • DeFi
  • NFTs
No Result
View All Result
Altszn.com
No Result
View All Result

Notify API Alternatives โ€“ Easiest Way to Set Up Web3 Notifications

Altszn.com by Altszn.com
February 1, 2023
in Web3
0
Notify API Alternatives โ€“ Easiest Way to Set Up Web3 Notifications
399
SHARES
2.3k
VIEWS
Share on FacebookShare on Twitter

[ad_1]

Listen to a smart contract address and create desktop Web3 notifications for on-chain events:

Track a Web3 walletโ€™s activity:

To integrate Web3 notifications, you must utilize tools such as the Notify API or its alternatives. While the Notify API is a great tool, it canโ€™t match the speed and power of Moralis Streams. Moralis Streams is an enterprise-grade API that, for example, supports the implementation of blockchain notifications and enables devs to listen to any wallet or smart contract address. In fact, hereโ€™s how simple it is to create a new stream via the Moralis JS SDK to track a specific wallet:

const newStream = await Moralis.Streams.add(options)   const {id}=newStream.toJSON();  const address=โ€wallet_address_you_want_to_trackโ€  await Moralis.Streams.addAddress({address,id})

It doesnโ€™t get more straightforward than this when using the best Notify API alternative, and whether youโ€™re listening to wallet addresses or smart contracts, the methods are pretty similar. In either case, we can use logged events and implement Web3 notifications in different forms. Our blockchain notifications can be built into dapps or social media (via bots) platforms as mobile or desktop notifications, etc. For example, the following lines of code use a USDT stream to create a desktop notification for every transfer of USDT above any specific threshold:

app.post('/webhook', (req, res) => {    const webhook = req.body;   for (const erc20Transfer of webhook.erc20Transfers){        const addrs = `${erc20Transfer.from.slice(0, 4)}...${erc20Transfer.from.slice(38)}`;       const amount = Number(erc20Transfer.valueWithDecimals).toFixed(0);        notifier.notify({           title: 'NEW USDT Transfer',           message: `${addrs} just sent \n$${amount}`,         });    }    return res.status(200).json();  })

If you wish to learn how to implement the above-presented code snippets correctly, create your free Moralis account and follow our lead!

Scalable Notify API Alternatives - Sign Up with Moralis Streams Today

Overview

In todayโ€™s article, weโ€™ll first show you how to implement the code snippets above and use them with the best Notify API alternative. The first example will demonstrate how to create blockchain notifications by listening to a smart contract address. For that, we will use the Moralis Streams API via the Moralis admin UI. The second example will lean on using Moralis Streams via the JS SDK to implement crypto wallet tracking. 

Below the two tutorials, we will also explore various Notify API alternatives, where youโ€™ll have a chance to learn more about the Moralis Streams API and other tools that this ultimate Web3 API provider has to offer.

Web3 and JavaScript Tutorials - Moralis Streams vs Notify API

Easiest Way to Set Up Web3 Notifications with NodeJS

The easiest way to set up blockchain notifications with JavaScript (JS) is using the Moralis Streams API. So, before you dive into the following two examples, make sure you have your free Moralis account ready. To do this, use the โ€œcreate your free Moralis accountโ€ link above or visit โ€œmoralis.ioโ€ and hit one of the โ€œStart for Freeโ€ buttons:

Moralis landing page and the Sign Up for Free button

Once you have your free account ready, you can access your admin area. This is where you can obtain your Web3 API key and access the UI for Moralis Streams:

  • Obtaining your Web3 API key:
Web3 Streams API key and Streams UI tab
Streams UI landing page

Tutorial 1: Blockchain Notifications for Desktop

Create a new project folder (โ€œDesktopNotificationsโ€) and open it in Visual Studio Code (VSC). Then, you may proceed by creating an Express dapp using NodeJS. This backend dapp will serve as a webhook, to which you will send on-chain events detected with your USDT stream.

To initialize a NodeJS project, use the following command:

npm init

Then simply hit enter a couple of times to choose the default options. After confirming โ€œIs this OK?โ€ in your terminal, youโ€™ll see a โ€œpackage.jsonโ€ file in your project folder: 

package.json file inside Visual Studio Code

Next, install the required dependencies by running this command:

npm i express nodemon node-notifier

Now, you have everything ready to create a new โ€œindex.jsโ€ file:

touch index.js

Open your โ€œindex.jsโ€ script and import Express and โ€œnode-notifierโ€œ. You must also define a local port you want to use and ensure that your dapp uses JSON. These are the lines that will cover these aspects:

const express = require('express') const notifier = require('node-notifier'); const app = express() const port = 3000  app.use(express.json())

Create Nodemon Script, Ngrok Tunnel, and Use the Post Endpoint

Open the โ€œpackage.jsonโ€ file and add a โ€œstartโ€ script with โ€œnodemon index.jsโ€:

Use โ€œngrokโ€ to create a tunnel to your local machine and get a URL you can use as a webhook. For that purpose, open a new terminal and enter the command below to install โ€œngrokโ€œ:

sudo npm i ngrok

Next, run the following command:

ngrok http 3000

As a response, youโ€™ll get a URL that you can use as a webhook URL:

Moving forward, you want to create a โ€œpostโ€ endpoint that will be your webhook URL. The latter will read what your stream is sending and then fire up the appropriate logic. For starters, use the following lines of code: 

app.post('/webhook', (req, res) => {    const webhook = req.body;    console.log(webhook)    return res.status(200).json();  })

Finally, you want to initialize your Express dapp to listen to the local port: 

app.listen(port, () => {    console.log(`Listening to streams`)  })

With the above script in place, you can run your dapp:

npm run start

With your webhook URL ready and your backend NodeJS dapp running, you are ready to use the ultimate Notify API alternative to start listening to on-chain events. 

Using the Moralis Admin UI to Create Triggers for Blockchain Notifications 

Thanks to the screenshot presented earlier, you already know how to access the Streams tab. Once there, hit the โ€œNew Streamsโ€ button: 

On the next page, youโ€™ll get to set up a new stream. Since we want to listen to USDT transfers, you must paste the USDT contractโ€™s address. You can copy it from Etherscan:

Then, you need to add a description, webhook URL, and a tag:

As far as the webhook URL goes, make sure to use your โ€œngrokโ€ URL obtained above and add โ€œ/webhookโ€ at the end. Next, select the โ€œEthereum Mainnetโ€ network โ€“ this is where the USDT smart contract lives:

Transfers are specific events of contract interactions, so you need to choose the right type of activity:

You also need the USDT contractโ€™s ABI, which you can also copy from Etherscan (โ€œContractโ€ tab):

Once on the โ€œContractโ€ tab, scroll down until you see โ€œContract ABIโ€ and copy it:

After pasting the above-copied ABI into the designated area in your setup, Moralis will automatically detect the available on-chain events. As such, you simply select the โ€œTransferโ€ option:

Finally, you need to add a filter that will focus on transfers of more than 50 thousand USDT:

These are the lines of code presented in the above screenshot:

[  {  โ€œtopic0โ€: โ€œTransfer(address,address,unit256)โ€,  โ€œfilterโ€: {โ€œgt: [โ€œvalueโ€, โ€œ50000000000]}  }  ]

Note: You need to use โ€œ50000000000โ€ because USDT uses six decimal places. You can explore different filters on our GitHub page in the โ€œFilter Streamsโ€ section. 

If you return to your terminal where you are running your โ€œindex.jsโ€ script, you should see detected USDT transfers in the following format:

Showing a Notify API alternative example response code

All thatโ€™s left to do is to present these results via neat desktop notifications, which weโ€™ll look at next!

Displaying Web3 Notifications

To ensure that every new USDT transfer triggers a corresponding desktop blockchain notification, you need to tweak your โ€œindex.jsโ€ script. This is where the snippet of code from the intro comes into play. So, your updated โ€œpostโ€ endpoint should contain the following:

app.post('/webhook', (req, res) => {    const webhook = req.body;    for (const erc20Transfer of webhook.erc20Transfers){        const addrs = `${erc20Transfer.from.slice(0, 4)}...${erc20Transfer.from.slice(38)}`;       const amount = Number(erc20Transfer.valueWithDecimals).toFixed(0);        notifier.notify({           title: 'NEW USDT Transfer',           message: `${addrs} just sent \n$${amount}`,         });    }    return res.status(200).json();  })

Note: You can access the final โ€œindex.jsโ€ script used above on GitHub.

This is what these USDT transfer notifications look like on a desktop:

Web3 notification popup from using the Moralis Streams Notify API alternative

Tutorial 2: Using the Notify API Alternative to Track Web3 Wallets

Note: To set up your Express dapp using NodeJS and create a โ€œngrokโ€ tunnel, use the steps covered in the above tutorial. 

In this example, we will show you how to use the Moralis JS SDK to create a new stream that tracks a Web3 wallet address. You need to initialize another NodeJS app and create a new โ€œindex.jsโ€ file. Inside that script, require Moralis and โ€œdotenvโ€œ:

const Moralis = require("moralis").default; const { EvmChain } = require("@moralisweb3/common-evm-utils"); require("dotenv").config();

Also, create a โ€œ.envโ€ file where you want to paste your Moralis Web3 API key in the โ€œMORALIS_KEYโ€ variable. Next, initialize Moralis:

Moralis.start({     apiKey: process.env.MORALIS_KEY,   });

Then, you need to define the streamโ€™s options (include the same details as inside the Streams UI):

async function streams(){    const options = {     chains: [EvmChain.MUMBAI],     description: "Listen to Transfers",     tag: "transfers",     includeContractLogs: false,     includeNativeTxs: true,     webhookUrl: "your webhook url"   }

Looking at the lines of code above, you can see that the options cover a chain to focus on, a description, a tag, and a webhook URL. You can also see that the script focuses on different on-chain events by setting โ€œincludeContractLogsโ€ to โ€œfalseโ€ and โ€œincludeNativeTxsโ€ to โ€œtrueโ€œ. This way, you can focus on native currency transfers. For the Mumbai testnet, thatโ€™s testnet MATIC. To use the above lines of code, make sure to replace โ€œyour webhook urlโ€ with your โ€œngrokโ€ URL. Donโ€™t forget to add โ€œ/webhookโ€ at the end of that URL. 

Create a New Wallet-Tracking Stream

With the lines of code above set in place, itโ€™s time to use the snippet from todayโ€™s introduction. So, add those lines of code inside the โ€œasyncโ€ function of your โ€œindex.jsโ€ file:

const newStream = await Moralis.Streams.add(options)    const {id} = newStream.toJSON();    const address = "wallet_address_you_want_to_track";    await Moralis.Streams.addAddress({address, id})    console.log("Fin")  }  streams()

To use this script, make sure to replace โ€œwallet_address_you_want_to_trackโ€ with an actual wallet address. If you want to test this stream firsthand, we recommend you use one of your wallet addresses. In that case, youโ€™ll be able to execute example testnet MATIC transfers to see the results in your terminal:

Note: To obtain testnet MATIC, you must use a reliable Polygon Mumbai faucet. If you want to target different testnets, youโ€™ll need other crypto faucets. Fortunately, you can find an Ethereum faucet (Goerli faucet), Chainlink testnet faucet, Solana testnet faucet, and others on the Pure Faucets page.

Exploring Notify API Alternatives

If you completed the above two tutorials, you already have a decent sense of what the best Notify API alternative is all about. However, you can explore the Moralis Streams API in more detail in the upcoming sections. However, letโ€™s first make sure you know what the Notify API is. 

Title - Notify API

What is the Notify API?

In the realm of Web3, the Notify API refers to Alchemyโ€™s product that allows developers to send real-time push notifications to users for critical on-chain events. Given the name โ€œNotifyโ€, it has raised awareness regarding Web3 and blockchain notifications. However, other products serve the same purpose more efficiently, and the Moralis Streams API is the ultimate Notify API alternative. Itโ€™s faster, covers all leading blockchains, and offers a lot more than just notifications.

Title - Notify API for Web3 Notifications versus Moralis Streams API

The Best Notify API Alternative

The Streams API is the best alternative to Alchemyโ€™s Notify API. One of its advantages is cross-chain interoperability. If you completed the first tutorial herein, you were able to see multiple chains in the โ€œSelect Networksโ€ step of the Streams UI. But itโ€™s worth pointing out that Moralis Streams support all leading EVM-compatible chains. As such, you can monitor any leading chain or multiple networks simultaneously. Aside from targeting multiple chains, this also future-proofs your work as it ensures youโ€™re never stuck on any particular chain.

Cross-chain networks compatible with Moralis Streams outlined - Ethereum, BNB Chain, Polygon, Avalanche, Solana, etc.

Another outstanding benefit the Streams API offers is user-friendliness. By offering an admin UI and an SDK to work with Moralis Streams, anyone can find a way to quickly set the backend in place required to listen to on-chain events. Plus, the Moralis SDK supports all leading legacy programming languages and frameworks. Hence, you can use your Web3 programming skills to listen to any smart contract and wallet address. Whatโ€™s more, you can do so with a free Moralis account! All these advantages even make Web3 libraries obsolete in several ways.

TRUSTED BY INDUSTRY LEADERS

Polygon Network founder testimonal - Moralis Streams offers seamless integration - Best Notify API alternative
  • โœ… Cross-chain interoperability
  • โœ… User-friendliness (cross-platform interoperability)
  • โœ… Listening to crypto wallets and smart contracts
  • โœ… Speed and efficiency
  • โœ… Advanced filtering options
  • โœ… Accessible with a free account
  • โŒ Connecting and maintaining buggy RPC nodes
  • โŒ Building unnecessary abstractions
  • โŒ Wasting time building complex data pipelines

Moralis โ€“ Beyond Web3 Notifications

Registering blockchain events and fetching parsed on-chain data is what all decentralized applications (dapps) need. While several devs still make the mistake of building an infrastructure to help them do that from scratch, you donโ€™t want to waste time reinventing the wheel. This is where the Web3 APIs from Moralis change the game. With this toolbox in your corner, you donโ€™t have to waste resources on building a unique backend. Instead, you can use short snippets of code to cover all your blockchain-related backend needs and then devote maximum attention to creating the best possible frontend.  

With that in mind, make sure to explore the full power of Moralis. Aside from the Streams API, Moralis offers you the ultimate Web3 Data API and Web3 Auth API. The former supports your need to fetch any type of on-chain data with a single line of code. It allows you to use the Web3 get block timestamp function, token price API, the ultimate NFT API, and much more:

Various Notify API alternatives outlined at Moralis landing page

As far as Moralis authentication goes, it lets you add all the leading Web3 login methods to your dapps. Consequently, your dappโ€™s users can experience a frictionless Web3 onboarding experience while you unify Web3 wallets and Web2 accounts. To experience this tool firsthand, take on our Supabase authentication tutorial. 

Nonetheless, aside from solutions for building dapps on Ethereum and leading EVM-compatible chains, Moralis also enables you to target Solana. The two most popular options for that network are the Solana Python API and the Solana JS API. 

Notify API Alternatives โ€“ Easiest Way to Set Up Web3 Notifications โ€“ Summary

In todayโ€™s article, you had a chance to roll up your sleeves and take on two tutorials that taught you how to use the ultimate Notify API alternative to listen to on-chain events without breaking a sweat. The first tutorial offered you an opportunity to focus on listening to a smart contract address and using the Streams API via the Moralis admin UI. In the second tutorial, we showed you how to focus on Web3 wallet addresses while using the power of Moralis Streams via the JS SDK. After completing the tutorials, you were able to learn what Alchemyโ€™s Notify API is and get a better sense of the Moralis Streams API and the rest of Moralisโ€™ suite of tools.    

Now that you know how to cover the backend aspect of using the best Notify API alternative, itโ€™s time you start building some unique frontends incorporating blockchain notifications. Additionally, you may also use on-chain events to automate social media posts. For instance, you can create a Twitter bot, NodeJS Telegram bot, or a blockchain Discord bot. 

On the other hand, you might be interested in exploring other blockchain development topics or getting the crypto basics under your belt, such as answering questions like โ€œwhat is Web3 technology?โ€œ. In that case, you should explore our crypto blog further. That said, if you are ready to start BUIDLing and would like some guidance, make sure to check out the Moralis YouTube channel and documentation. If you plan on dealing with token prices in ETH, youโ€™ll want to use a reliable gwei to ETH calculator. 

[ad_2]

Read More: moralis.io

Tags: alternativesAPIEasiestNotificationsNotifysetweb 3.0Web3
ADVERTISEMENT

Recent

VIRTUAL Rallies Ahead of First Ethereum-Based AI Agent Launch

VIRTUAL Rallies Ahead of First Ethereum-Based AI Agent Launch

June 15, 2025
Is it the future of finance?

Is it the future of finance?

June 15, 2025
U.S. Lawmakers Unveil CLARITY Act Regulating Digital Assets

U.S. Lawmakers Unveil CLARITY Act Regulating Digital Assets

June 10, 2025

Categories

  • Bitcoin (4,214)
  • Blockchain (10,148)
  • Crypto (8,074)
  • Dark Web (339)
  • DeFi (7,801)
  • Ethereum (4,217)
  • Metaverse (6,116)
  • Monero (193)
  • NFT (741)
  • Solana (4,793)
  • Web3 (18,927)
  • Zcash (430)

Category

Select Category

    Advertise

    Advertise your site, company or product to millions of web3, NFT and cryptocurrency enthusiasts. Learn more

    Useful Links

    Advertise
    DMCA
    Contact Us
    Privacy Policy
    Shipping & Returns
    Terms of Use

    Resources

    Exchanges
    Changelly
    Web3 Jobs

    Recent News

    VIRTUAL Rallies Ahead of First Ethereum-Based AI Agent Launch

    VIRTUAL Rallies Ahead of First Ethereum-Based AI Agent Launch

    June 15, 2025
    Is it the future of finance?

    Is it the future of finance?

    June 15, 2025

    ยฉ 2022 Altszn.com. All Rights Reserved.

    No Result
    View All Result
    • Home
      • Home โ€“ Layout 1
      • Home โ€“ Layout 2
      • Home โ€“ Layout 3

    ยฉ Altszn.com. All Rights Reserved.

    • bitcoinBitcoin (BTC) $ 103,895.00
    • ethereumEthereum (ETH) $ 2,473.66
    • tetherTether (USDT) $ 1.00
    • xrpXRP (XRP) $ 2.16
    • bnbBNB (BNB) $ 643.95
    • solanaSolana (SOL) $ 146.39
    • usd-coinUSDC (USDC) $ 0.999762
    • tronTRON (TRX) $ 0.273799
    • dogecoinDogecoin (DOGE) $ 0.167075
    • staked-etherLido Staked Ether (STETH) $ 2,472.43
    • cardanoCardano (ADA) $ 0.606319
    • wrapped-bitcoinWrapped Bitcoin (WBTC) $ 103,937.00
    • hyperliquidHyperliquid (HYPE) $ 38.99
    • wrapped-stethWrapped stETH (WSTETH) $ 2,977.04
    • suiSui (SUI) $ 2.82
    • bitcoin-cashBitcoin Cash (BCH) $ 464.83
    • leo-tokenLEO Token (LEO) $ 9.22
    • chainlinkChainlink (LINK) $ 12.91
    • stellarStellar (XLM) $ 0.252190
    • avalanche-2Avalanche (AVAX) $ 18.37
    • the-open-networkToncoin (TON) $ 2.94
    • usdsUSDS (USDS) $ 0.999758
    • whitebitWhiteBIT Coin (WBT) $ 48.35
    • shiba-inuShiba Inu (SHIB) $ 0.000011
    • wethWETH (WETH) $ 2,474.20
    • wrapped-eethWrapped eETH (WEETH) $ 2,643.64
    • litecoinLitecoin (LTC) $ 83.33
    • binance-bridged-usdt-bnb-smart-chainBinance Bridged USDT (BNB Smart Chain) (BSC-USD) $ 1.00
    • hedera-hashgraphHedera (HBAR) $ 0.148009
    • ethena-usdeEthena USDe (USDE) $ 0.999332
    • moneroMonero (XMR) $ 320.03
    • polkadotPolkadot (DOT) $ 3.69
    • bitget-tokenBitget Token (BGB) $ 4.39
    • coinbase-wrapped-btcCoinbase Wrapped BTC (CBBTC) $ 103,886.00
    • uniswapUniswap (UNI) $ 7.38
    • pepePepe (PEPE) $ 0.000010
    • pi-networkPi Network (PI) $ 0.543853
    • aaveAave (AAVE) $ 263.95
    • daiDai (DAI) $ 0.999771
    • ethena-staked-usdeEthena Staked USDe (SUSDE) $ 1.18
    • bittensorBittensor (TAO) $ 339.12
    • okbOKB (OKB) $ 49.03
    • blackrock-usd-institutional-digital-liquidity-fundBlackRock USD Institutional Digital Liquidity Fund (BUIDL) $ 1.00
    • aptosAptos (APT) $ 4.44
    • internet-computerInternet Computer (ICP) $ 5.11
    • crypto-com-chainCronos (CRO) $ 0.087826
    • nearNEAR Protocol (NEAR) $ 2.12
    • jito-staked-solJito Staked SOL (JITOSOL) $ 177.03
    • susdssUSDS (SUSDS) $ 1.06
    • ethereum-classicEthereum Classic (ETC) $ 16.39
    • bitcoinBitcoin (BTC) $ 103,895.00
    • ethereumEthereum (ETH) $ 2,473.66
    • tetherTether (USDT) $ 1.00
    • xrpXRP (XRP) $ 2.16
    • bnbBNB (BNB) $ 643.95
    • solanaSolana (SOL) $ 146.39
    • usd-coinUSDC (USDC) $ 0.999762
    • tronTRON (TRX) $ 0.273799
    • dogecoinDogecoin (DOGE) $ 0.167075
    • staked-etherLido Staked Ether (STETH) $ 2,472.43
    • cardanoCardano (ADA) $ 0.606319
    • wrapped-bitcoinWrapped Bitcoin (WBTC) $ 103,937.00
    • hyperliquidHyperliquid (HYPE) $ 38.99
    • wrapped-stethWrapped stETH (WSTETH) $ 2,977.04
    • suiSui (SUI) $ 2.82
    • bitcoin-cashBitcoin Cash (BCH) $ 464.83
    • leo-tokenLEO Token (LEO) $ 9.22
    • chainlinkChainlink (LINK) $ 12.91
    • stellarStellar (XLM) $ 0.252190
    • avalanche-2Avalanche (AVAX) $ 18.37
    • the-open-networkToncoin (TON) $ 2.94
    • usdsUSDS (USDS) $ 0.999758
    • whitebitWhiteBIT Coin (WBT) $ 48.35
    • shiba-inuShiba Inu (SHIB) $ 0.000011
    • wethWETH (WETH) $ 2,474.20
    • wrapped-eethWrapped eETH (WEETH) $ 2,643.64
    • litecoinLitecoin (LTC) $ 83.33
    • binance-bridged-usdt-bnb-smart-chainBinance Bridged USDT (BNB Smart Chain) (BSC-USD) $ 1.00
    • hedera-hashgraphHedera (HBAR) $ 0.148009
    • ethena-usdeEthena USDe (USDE) $ 0.999332
    • moneroMonero (XMR) $ 320.03
    • polkadotPolkadot (DOT) $ 3.69
    • bitget-tokenBitget Token (BGB) $ 4.39
    • coinbase-wrapped-btcCoinbase Wrapped BTC (CBBTC) $ 103,886.00
    • uniswapUniswap (UNI) $ 7.38
    • pepePepe (PEPE) $ 0.000010
    • pi-networkPi Network (PI) $ 0.543853
    • aaveAave (AAVE) $ 263.95
    • daiDai (DAI) $ 0.999771
    • ethena-staked-usdeEthena Staked USDe (SUSDE) $ 1.18
    • bittensorBittensor (TAO) $ 339.12
    • okbOKB (OKB) $ 49.03
    • blackrock-usd-institutional-digital-liquidity-fundBlackRock USD Institutional Digital Liquidity Fund (BUIDL) $ 1.00
    • aptosAptos (APT) $ 4.44
    • internet-computerInternet Computer (ICP) $ 5.11
    • crypto-com-chainCronos (CRO) $ 0.087826
    • nearNEAR Protocol (NEAR) $ 2.12
    • jito-staked-solJito Staked SOL (JITOSOL) $ 177.03
    • susdssUSDS (SUSDS) $ 1.06
    • ethereum-classicEthereum Classic (ETC) $ 16.39