How to Create a Whale Alert Discord Bot
Track the activity of whales on Ethereum, Polygon, Arbitrum, and Optimism in Discord using Alchemy webhooks.
Whales are individuals, DAOs, or companies that hold a large amount of cryptocurrency in their digital asset wallets, which gives them outsized influence on the market, especially when they hold large amounts of unlocked tokens in small market cap projects.
Tracking their on-chain (and not only off-chain, publicly available data) activity across different networks--Ethereum, Arbitrum, Optimism, or Polygon--can create unique insights you can share on Discord.
What is a Discord whale alert?
Discord whale alerts are web3 notifications that are automatically published to Discord channels that display transaction details about the on-chain activity of wallets that hold a large amount of cryptocurrency (whales).
What are the use cases for a Discord whale alert?
Because Discord is a public communications tool used by a majority of NFT projects, web3 startups, crypto trade groups, and blockchain developers, the primary use case for developing a Discord bot for whale alerts is to help teams track the activity of important users, traders, treasury wallets, and competitors.
For example, Discord whale alerts might help web3 teams:
- Monitor incoming and outgoing movement of cryptocurrency.
- Track the wallet activity of high-profile traders to see the projects they are investing in.
- Identify investments DAOs and treasury wallets are using to diversify their holdings.
- Gain insight on potential collaborations based on wallet-to-wallet relationships.
There are multiple reasons why crypto users, blockchain teams, and web3 devs using Discord might want to build a bot that tracks wallet activity across Ethereum, sidechains, and layer 2s.
How to Develop a Discord Whale Alert Bot
This tutorial will detail how to build a whale alert bot for Discord that tracks Ethereum addresses.
These are the three tools you'll need:
- Alchemy Notify API - webhook URLs for Ethereum, Arbitrum, Optimism, or Polygon.
- Zapier - a means to send web3 notifications to Discord by How to Integrate Alchemy Webhooks with Zapier.
- Discord - a tool to receive on-chain transaction details and share it with users in a Discord channel.
Notify API Endpoints and Zapier to publish Discord messages for custom events that occur on blockchain networks (such as Ethereum, Optimism, Arbitrum, and Polygon) takes eight steps.
1. Sign up for a new account with Alchemy and Zapier
First, we'll set up our integrations and webhooks in Zapier and Alchemy.
To start, create your new accounts:
If you already have login credentials, sign in and skip to the next step.
2. Build a Zap and generate a webhook URL
From the Zapier dashboard, create a new webhook automation:
- Click Create Zap in the top left corner.
- Go to Trigger.
- Search for then select Webhooks by Zapier.
- Select Catch Hook as the Trigger Event.
- Click Continue in the Set up trigger section.
- Copy and save the Custom Webhook URL.
Note:
Zapier's Catch Hook trigger event will be used to receive data from tracked events using Alchemy webhooks.
3. Create a webhook with Alchemy on Ethereum
Create the address activity webhook to track the event data sent to Zapier. If you don't have one, sign up for a free Alchemy developer account.
There are two ways to configure an Alchemy webhook:
- Manually with Alchemy's Notify tab within the dashboard
- Programmatically with Alchemy's Notify API (recommended for tracking 10+ addresses).
Manually create a webhook from the dashboard
- From the Ethereum + L2 ecosystem, click the Notify tab.
- Click + Create Webhook button in the Address Activity section.
- Fill in these fields to create the webhook:
- Select Chain to be Ethereum
- Select Network to be Mainnet
- Paste the Zapier webhook URL you created in step 2.
- Paste the wallet address you want to monitor. If you have less than 10 addresses, select the Add Addresses button to add them.
- For this tutorial, use the well-known "Itachi", an address with over 1.9 million ETH tokens in their wallet. The address is
0x73bceb1cd57c711feac4224d062b0f6ff338501e
.
- For this tutorial, use the well-known "Itachi", an address with over 1.9 million ETH tokens in their wallet. The address is
You can also use Alchemy's Notify API for Polygon, Arbitrum, and Optimism.
To finish your configuration, Return to Zapier and continue to the Test trigger section by clicking Test trigger. The configuration is complete if you see a We found a request notification.
Programmatically create a webhook using the Notify API
If your Discord whale alert bot is going to track more than 10 addresses, create an Ethereum webhook using the Notify API.
First, copy your Alchemy authentication token (X-Alchemy-Token
) from the Notify dashboard.
Update and run this script from your command line:
curl https://dashboard.alchemyapi.io/api/create-webhook \
-X POST \
-H "X-Alchemy-Token":"<your-X-Alchemy-Token>" \
-d '{"network":"ETH_GOERLI","webhook_type":"ADDRESS_ACTIVITY","webhook_url":"<your-Zapier-Webhook-URL>", "addresses":["<your-Ethereum-Address>"]}'
Replace the script's defaults with your Ethereum webhook's details:
<your-X-Alchemy-Token>
with your Alchemy auth token.<your-Zapier-Webhook-URL>
with your Zapier webhook URL.<your-Ethereum-Address>
with the wallet address(es) you want to monitor (e.g., Itachi's wallet address).
Note:
You can add as many Ethereum addresses as you’d like to track send and receive events.
Refresh your Alchemy web app and you should see the new address activity webhook in the Notify dashboard.
4. Parse the Ethereum webhook response in Zapier
Now, parse the webhook response from Alchemy to create a Zapier action that sends a Discord alert with a human-readable message whenever the tracked wallet address sends a transaction.
- On the Zappier application, under the Action section, select Filter.
- In Filter setup & testing, only continue if the Event Activity From Address text exactly matches our whale's Ethereum address:
0x73bceb1cd57c711feac4224d062b0f6ff338501e
- If you don't want to use a webhook value, you can search for
fromAddress
.
Note:
If you click Continue and find that Your Zap would not have continued, don't worry! The test notification was not sent from the whale wallet, so this message is expected.
5. Create a Discord server or sign into Discord
Create an account on Discord or log into your account if you already have a Discord account.
Create a new server:
- Click the + button on the left-hand side.
- Click Create my Own.
- Choose For a club or community.
- Name the server Whale Alerts Server.
6. Handle Discord whale alerts for sending tokens
Next, we want to send a Discord message if our whale makes a send transaction.
- Click + at the bottom.
- Search for and select Discord in the new Action section.
- For the Action Event, choose Send Channel Message.
- Sign in to your Discord account.
Next, fill out the fields to send our message in the Set up action section.
- Choose your channel.
- Choose what fields and values you want to send.
- Set text-to-speech to false.
In the message text, you can get creative and choose what fields and values you want to send. We chose these fields:
- Event Activity Value
- Event Activity Asset
- Event Activity to Address
- Event Activity Network
You can leave everything else on the default option. A sample Discord message might read:
Whale Alert! A transaction of 100 ETH was sent to
0x73bceb1cd57c711feac4224d062b0f6ff338501e
on the Ethereum network
To finalize your Discord configuration:
- Click Continue.
- Click Test and continue. If no errors pop up, your Discord whale alert bot works! A message should be published in the Whale Alerts.
- Publish the Zap.
Now, whenever the whale sends a transaction, your Discord bot will share the transaction event.
7. Handle Discord whale alerts for receiving tokens
To publish Discord messages when the whale wallet receives tokens:
- Edit the Continue only if action.
- Click on Filter Setup & Testing and press the + or button.
- Fill in Event Activity To Address (or search for
fromAddress
. - Ensure the text matches our whale Ethereum address (
0x73bceb1cd57c711feac4224d062b0f6ff338501e
).
Now our Zap will execute whenever Itachi receives tokens.
8. Create a “Code by Zapier” action with Javascript
As a final step, create a Code by Zapier action between the Only continue if… and Send Channel Message in Discord actions.
You can choose either "Run Python" or "Run Javascript." We chose Run Javascript, but the logic works similarly for Python. After clicking Continue, set up your input data under Set up action as follows:
We are going through the webhook response again, but this time for receiving tokens since the existing Discord message only gets submitted when Itachi sends tokens.
Paste this code in the code block:
// Since JavaScript is case-sensitive, we will be comparing addresses in upper case const address = "Whale-Wallet-Address".toUpperCase();
// Define Account 1 (the whale wallet)
let account_1 = "";
// Define Account 2 (the user whale wallet is sending to / receiving from)
let account_2 = "";
// Define to use "to" or "from" in message
let t_or_f = "";
let f_or_t = "";
if (inputData.fromAddress.toUpperCase() == address) {
// If Whale is sending, then it is the fromAddress
account_1 = inputData.fromAddress;
account_2 = inputData.toAddress;
t_or_f = "from";
f_or_t = "to";
} else if (inputData.toAddress.toUpperCase() == address) {
// If Whale is receiving, then it is the toAddress
account_1 = inputData.toAddress;
account_2 = inputData.fromAddress;
t_or_f = "to";
f_or_t = "from";
}
// Output the fields to be used in email
output = [{account_1: account_1, account_2: account_2, t_or_f: t_or_f, f_or_t: f_or_t}];
Note:
Remember to replace Whale-Wallet-Address with the whale wallet address.
Lastly, go to the Send Channel Message in Slack action and click on the Set up action section.
Replace the fields from the webhook response in the message text with the dynamic outputs from the Javascript code, which are specific to whether the whale wallet sent or received tokens:
Click Continue and test your action, then publish.
Congrats! You just successfully created a Discord whale alert bot!
Updated over 2 years ago