Skip to main content

How to Get SMS Notifications for USDC Token Transfers with the QuickAlerts UI

Updated on
Dec 14, 2023

4 min read

Overview

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.

This guide is also available as a video in Spanish below. - Esta guía también está disponible como video en español a continuación.
Subscribe to our YouTube channel for more videos!

What You Will Do

  • Learn about QuickAlerts
  • Create an expression for USDC transfers over 1,000 USDC
  • Trigger an SMS with Twilio when the QuickAlert fires

What You Will Need

Creating your alert on QuickNode

Step 1 - Define your notification and select a template

First, go to your dashboard and navigate to the QuickAlerts product.

QuickNode developer dashboard

After that, we need to click the Create notification button.

QuickAlerts dashboard

Name your notification. Don't worry too much about this value; you can always update it later.

Select your desired chain and network. We'll be using Ethereum for our example here.

Create QuickAlert step 1

Lastly, choose the blank template. There are options here that make it very easy to get started for other use cases as well.


Looking for more QuickAlerts examples?

Check out our Expression Library for pre-written expressions that you can use to power your apps and workflows.

Step 2 - Create your expression

In the create expression field at the top left, we will write our expression.

Create QuickAlert step 2

First, we will target a tx_logs_address of the USDC contract address, 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48. This will ensure that we only receive notifications for USDC transfers.

Then, we will configure our expression to notify us of transfers for over 1,000 USDC. ERC-20 tokens are configured with a given number of decimals. In our case, USDC has 6, meaning transfers of 1 USDC will appear as a value of 1,000,000 on the blockchain.

In our case, 1000 + 6 decimals = 1000000000.

Expression
Deploy
1
tx_logs_address == '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
2
&&
3
tx_logs_data_int > 1000000000

We then need to test the expression. Click the Test Expression button. If there were any transactions that matched your expression, you'll see a green checkmark next to the block number(s) you tested against.

Step 3 - Select your destination

To complete the creation of our QuickAlert, you will need to configure a destination. To do so, click the "Create destination" button.

Create QuickAlert step 3

We will select the "Webhook" option, then "Continue".

You might be thinking, 'What is a Webhook?'. In simple words, it's the place where you will receive the alert.

Building your Webhook

To get notified, you will need to create a webhook on (Render)[https://render.com/].

Here are the steps:

  1. Go to your dashboard
  2. Click on the "New" button
  3. Click on the "Web Service" option

Render.com dashboard

On this page, select "Build and deploy from a Git repository" and then "Next".

Paste the following value in the "Public Git Repository" field:

https://github.com/irwingtello/QuickAlertsSMS

Then fill out the following fields:

Build command
npm install
Start command
node app.js

Note: if you want to have your service available 24/7, upgrade your plan.

Lastly, we will need to add our environment variables. To do so, click on "Advanced" and click the "Add Secret File" button.

Name the file '.env' and paste in the following content:

.env
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"

Go to your Twilio console to retrieve your account Phone number, auth token, and SID.

Twilio console

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

Render secret file example with environemnt variables

Save your secret file and then scroll down to find the "Create Web Service" button and click it.

Click on the icon next to your new web service URL to copy it.

Render web service page with copy to clipboard button shown

Go back to the QuickNode dashboard 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".

Your destination configuration should look similar to this:

QuickAlert destination creation form filled out with an example

After that click the button "Create Webhook".

Toggle the switch at the right to enable this destination for your QuickAlert, then click "Deploy Notification".

Configuratios! Your alert is now created and whenever a matching transaction occurs, you will see this reflected in the last delivery field.

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

SMS application showing text messages resulting from our above work

At the end of some messages, you may notice a number after the word "amount." For transactions that contain multiple matching transfers, this number will represent the index of a given transfer.

Conclusion

Fantastic work! You'll now receive SMS 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 🚀.

A version of this guide first appeared on Irwing Tello's blog here and was republished with permission.

We ❤️ Feedback!

Let us know if you have any feedback or requests for new topics. We'd love to hear from you.

Share this guide