How to use Alchemy Notify to get real-time updates on your Web3 Application
If you are building a web3 app, you know how important it is to keep your users informed about the status of their transactions, events, and smart contracts. However, you also know how challenging it can be to monitor the blockchain and provide timely and accurate notifications.
That’s why Alchemy has created Notify, a powerful tool that lets you easily send real-time updates to your users via email, SMS, webhooks, or browser alerts. Notify is part of Alchemy’s suite of web3 developer products and tools that help you build faster, scale better, and create amazing user experiences.
In this tutorial, I will show you how to use Notify to send email notifications to your users when they interact with your web3 app. You will need an Alchemy account, a web3 app, and a SendGrid account to follow along.
Step 1: Create a Notify project
First, you need to create a Notify project on Alchemy.
Then go to https://dashboard.alchemy.com/notify and click on “Create Project”.
Give your project a name and select the network you want to monitor (mainnet, testnet, etc.).
Step 2: Configure your notification settings
Next, you need to configure your notification settings. You can choose from four types of notifications: transaction status, contract event, address activity, or custom webhook. For this tutorial, we will use transaction status notifications.
Click on “Add Notification” and select “Transaction Status” from the dropdown menu. Then, enter the name of your web3 app and the email address where you want to receive the notifications. You can also customize the subject and body of the email using variables such as {hash}, {status}, {from}, {to}, etc.
Step 3: Integrate Notify into your web3 app
Finally, you need to integrate Notify into your web3 app. You can do this by adding a few lines of code to your app using Alchemy’s SDK. The SDK will automatically generate a unique ID for each transaction and send it to Notify along with the email address you specified.
To install the SDK, run:
npm install @alchemy-web3/notify
To use the SDK, import it in your app and initialize it with your Alchemy API key:
import { createAlchemyWeb3 } from "@alchemy-web3/notify";
const web3 = createAlchemyWeb3("https://eth-mainnet.alchemyapi.io/v2/<your-api-key>");
Copy
Then, whenever you send a transaction using web3, add a notify parameter with the email address:
web3.eth.sendTransaction({
from: "0x123...",
to: "0x456...",
value: "1000000000000000000",
notify: {
email: "user@example.com",
},
});
That’s it! Now, whenever your users send a transaction using your Web3 app, they will receive an email notification from Notify with the status of their transaction. You can also use Notify to send notifications for other events such as contract events, address activity, or custom webhooks.
Notify is a powerful tool that can help you improve your user experience and retention by keeping them informed and engaged with your web3 app.
You can learn more about Notify and other Alchemy products and tools at https://www.alchemy.com/. Happy building!
Subscribe to my newsletter
Read articles from Subham Surana directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Subham Surana
Subham Surana
Building India's first Tech-Ed Ecosystem with Floxus 🚀 Community Founder at DEVs Dungeon 💜 Building Web3Jharkhand 💪 Kaggle Master 🥇 .NET Developer in C# 🧑💻