Get Immediate Alerts for Blockchain Events with QuickAlerts via SMS on Ethereum

Get Immediate Alerts for Blockchain Events with QuickAlerts via SMS on Ethereum

Introduction

In the web3 space, there are times when you need to be notified when a specific event occurs, even if you're away from your computer or busy with other tasks.

But don't worry, QuickAlerts is the optimal solution for receiving notifications when a blockchain event happens.

In this tutorial, you will learn how to set up blockchain notifications in under 10 minutes and receive SMS notifications via Twilio.

What We Will Do

  • Create an expression to receive notifications when a transaction with a specified amount in USDC occurs on the Ethereum network.

What You Will Need

  • Create an account on QuickNode.

  • Create an account on Render to deploy our custom solution and receive notifications.

  • Create an account on Twilio and get a phone number.

What is QuickNode?

QuickNode simplifies the creative process by taking the hard things out of dealing with complex web3 components.

With QuickNode, you can leave behind concerns about transaction security and blockchain management.

QuickNode takes care of all the intricacies, allowing you to focus on your passion – tackling significant endeavors and thrilling projects! 😊

What is QuickAlerts?

QuickAlerts allows you to use up-to-the-minute blockchain data and smart alerts to supercharge your apps. It helps you make decisions for DeFi trading using the data that's important to you.

You can also include real-time blockchain events in your workflows and do even more.

Creating our alert on QuickNode

First, we need to go to our dashboard and navigate to the QuickAlerts.

QuickNode's Dashboard

After that, we need to click the button "Create QuickAlert"

QuickAlerts dashboard

Select your desired chain and network.

QuickAlerts dashboard, where we will select the blockchain and network.

In this step, I'm selecting the Ethereum network.

Creating a blockchain alert on the Ethereum network

Furthermore, we need to enter a name and choose a template.

Choosing a name and a blank template to create our blockchain alert

In consequence, you will see the next dashboard.

Setting up a Desired Notification with Quicknode Alert Expression

To receive notifications for a specific amount, you can use the following expression as a reference:

1 USDC = 10,000,000 decimals

If you wish to calculate notifications for a different amount, simply multiply your USDC by the decimals factor:

For example, if you want notifications for 1,000 USDC, the calculation would be:

1,000 USDC * 1,000,000 decimals = 1,000,000,000 decimals

tx_logs_address == '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
&&
tx_logs_data_int >  1000000000

You can test the expression on the "Test expression" tab. If the alert is correct, you will see a green mark. If the alert doesn't meet the criteria, it will show a red mark

Testing our blockchain expression on quicknode.com

Furthermore, we need to select a destination to get notified on the "Create destination" button:

Select the destination where you will receive notifications for our blockchain updates.

As a consequence, you will see the next window. Please click on "Webhook" and continue.

In the 'Window' tab, you can choose your webhook to receive notifications

In consequence, you will see the next windows

The destination where QuickAlert will send the notification

After that, you will see that you need a Webhook, and you might be thinking, 'What is a Webhook?' In simple words, it's 'the place where you will receive the alert.

Building a Webhook

To get notified, you need to create this webhook on Render.

Here are the steps:

  1. Please go to your dashboard.

  2. To create this webhook, click on the "New" button, and then click on the "Web Service" tab.

Render.com dashboard

As a consequence, you will see another dashboard.

Click on "Build and deploy from a Git repository" and then "Next".

Render.com deployment options

After that, you need this URL:
https://github.com/irwingtello/QuickAlertsSMS

Please copy and paste in the "Public Git Repository" field.

Selecting the solution to deploy our service

Consequently, you will see this page with the following fields:

  • Build command

  • Start command

Please fill in the following details in the specified instructions:

Build command: npm install

Start command: node app.js

If you want to have your service available 24/7, upgrade your plan.

Render.com plan

After that click on "Advanced" and click the "Add Secret File" button.

As a result, please name the file '.env' and replace its contents with the variables obtained from Twilio.
https://console.twilio.com/

Twilio Console where we obtain our variables.

FROM='Your Twilio Phone Number'
TO='Your Desired Number' 
AUTHTOKEN='Your Auth Token'
ACCOUNTSID='Your Account SID from your Twilio account'
MESSAGE="A whale moved funds with [Amount] amount"

Here is an example of how you need to fill in the information:

Environment variables are used to send messages when we detect a message on the blockchain

Afterward, click "Save" and then scroll down to find the "Create Web Service" button and click it.

In consequence, please copy the url generated by Render.

Render.com dashboard

Furthermore, you need to copy the URL and paste it into the "URL and request type" field on the QuickAlert dashboard, adding the following text: "/api/quickalerts".

Example:

https://quickalertssms.onrender.com/api/quickalerts

Don't worry about the webhook name,you can put any name.

In the Payload Type selection, please choose the option "4 - Matched Transactions".

After that click the button "Create Webhook".

As a result, you can view your alert:

Alert created on quicknode.com

When a coincidence occurs, you can see the field last delivery with the time when the coincidence happened.

Finally, when a transaction occurs, you will be notified by an SMS message.

You can see the numbers with no spaces after the word "amount." This number refers to the number of coincidences in that transaction.

Alerts for blockchain coincidences using quicknode.com

Conclusion

Fantastic work! . You'll now receive notifications for every action detected by QuickAlerts.

I encourage you to try and make it do even more.

Remember, small steps can lead to big results 🚀.

We ❤️ Feedback!

If you have any feedback or questions on this guide, let us know.
Or, feel free to reach out to us via Twitter or our Discord community server.

We’d love to hear from you!

Author: Irwing Tello

Discord: discord.com/invite/ADjtsHVreT

Twitter: twitter.com/irwingtello

LinkedIn: linkedin.com/in/irwingtello

Email:

Website: dfhcommunity.com

Youtube: youtube.com/@irwingtellomx

You can support my work here:

buymeacoffee.com/irwingtello

BTC: 34kXK9CpTJP1PyHKw2kUD2bt6rtGcG5CHY

EVM Address: 0x8B98F8Ff69d2A720120eD6C71A9Bc5072b8Eb46D

Solana: Ey9oVFHW79giacRZaKxigYjeihMsY7ox8jxc7Hp1sJmS

Did you find this article valuable?

Support Irwing Tello by becoming a sponsor. Any amount is appreciated!