How to Get Ethereum Transaction Notifications in Slack and Discord with Webhooks

Blocknative Ethereum Web3

Anyone doing transactions on Ethereum is familiar with a certain level of transaction anxiety. The complexity and mutability of the pre-chain layer creates uncertainty about transaction settlement—transactions get stuck or dropped, need canceling or replacing, gas prices fluctuate. The mempool contains the information needed to take action and improve transaction outcomes. The trick is tapping into the data and making it actionable, which is what we’ll cover in this blog— with a special focus on wallet monitoring and customizable event notifications. 

Below you will find a step-by-step guide covering:

  • How to hook your wallet up to Mempool Explorer; 
  • How to create a configuration to monitor wallet activity; 
  • How to use webhooks to set up notifications on Slack (or, really, anywhere you want); 
  • And, (bonus!) customize Mempool Explorer to make data about any smart contract actionable;  

By the end of this guide, you will have all the skills you need to receive actionable transaction information directly on Slack and Discord.

 

What is Mempool Explorer and What Can It Do?

Every public transaction on Ethereum goes through the mempool. Blocknative’s Mempool Explorer is the easiest way to work with public blockchain mempool data. Mempool Explorer continuously captures thousands of data points that describe and illuminate in-flight, pre-chain events. We capture and normalize the data in a unified, always-on data stream. This gives users instant access to every transaction state change, error, and anomaly.

We have pre-made filters and streams but you can also customize filters to get alerts based on your exact parameters. At the end of this guide, we will even show you how to set up Mempool Explorer to monitor for smart contracts not supported out-of-the-box. 

 

Setting up an API Key to monitor Ethereum Transactions

Before you can set up a webhook to monitor a wallet or smart contract you'll need to create an API key in Mempool Explorer. This process is completely free.

In this blog we will walk you through setting up an API key to monitor your own wallet as an example, but the steps are the same for any wallet or smart contract you'd like to monitor. 

It is simple to set up monitoring for your wallet. Go to explorer.blocknative.com. If you haven’t yet, create a free user account so you can save your connections and create custom configurations. Next, on the right-hand side under “Live Examples,” you’ll see a button that says, “Click here to connect and monitor your own wallet address”. 

When you click “Watch now”, a wallet selector opens that allows you to select any of the most popular wallets in the ecosystem. 

 

 

This wallet selector is powered by Blocknative’s Web3 Onboard, an open-source, framework-agnostic JavaScript library widely deployed across popular web3 apps.

For this example, we will use a Metamask wallet. After clicking Metamask, we’ll see a little pop-up asking you to login and authorize your wallet. This fires an event to Metamask that grants permission to connect to Mempool Explorer. Click “next” to connect.

 

 

And just like that, your wallet will tell you that you’re connected to Mempool Explorer.  

Alternatively, you could also input your address or ENS manually under Create Subscription if you don't want to connect your wallet. 

 

Saving Your Wallet Monitoring Subscription 

Your wallet connection creates a filter for the Mempool Explorer to surface mempool transactions specifically affiliated with your wallet address. You will want to save your subscription by clicking the “Save” button at the bottom of the screen. 

 

For this example, we’ll opt to “create new API key” and name it “wmw” for “watch my wallet”. You can call yours whatever you want. Now when you log into Mempool Explorer, you will see “wmw” (or whatever you use for your wallet subscription) under “My Configurations”. As you get to know Mempool Explorer, you will want to create new filters in your configurations and new subscriptions, as needed. 

 

Testing your Wallet Monitoring Subscription

Now that we’ve connected a wallet and saved the subscription, we can use Mempool Explorer to monitor activity associated with this Metamask address. For the purposes of a test, we’d recommend using Goerli. You can change to view different networks (we support Ethereum, Polygon, and Gnosis), on the upper right of the monitoring screen. 

 

To run the test, copy your wallet address and send yourself a little bit of test ETH in your Metamask wallet and hit “Next”. Your wallet will show you the transaction you want to execute and your next step will be to hit “Confirm.”

What happens when you hit “Confirm?” Understanding this helps you understand what’s happening with your wallet monitoring subscription: So when you hit confirm, your wallet signs the transaction and transmits it to Infura. An Infura node will receive and inspect that transaction to ensure that it's valid. If it is, it will insert it into its local mempool. 

That Infura Goerli testnet node will then broadcast your transaction to its peers on the Goerli testnet over the peer-to-peer protocol, a.k.a., the “gossip protocol.” 

Blocknative’s global infrastructure, which includes nodes on the Goerli testnet, will receive this transaction over the peer-to-peer protocol. Mempool Explorer will check to see if anyone subscribed to receive information about this data and will find your newly created subscription, and then enrich the payload. Mempool Explorer will then present the event in your subscription monitoring field. 

That whole process end-to-end generally takes a couple milliseconds. 

 

Setting up Webhooks on Slack

Of course, if you’re logged into and watching Mempool Explorer when a transaction associated with your wallet appears in the mempool, you’ll see it. But obviously, transactions can happen at any time of day, you may be doing other things, and you still want to get a notification. Mempool Explorer has a feature to ensure that anytime your wallet is party to a transaction, you’re notified on your desktop, phone, and even your smartwatch. 

Using webhooks, you can connect your wallet monitor transaction feed to Slack… or Telegram, Discord, Twitter, and any other platform that supports webhooks. Like so many remote-first organizations, we are sort of Slack addicts so we will focus on it for our first example. 

Above, we walked through how to connect a Metamask wallet and monitor for transactions on the Goerli network. We named our configuration “wmw” for “watch my wallet”. We saw how sending testnet transactions will populate Mempool Explorer with actionable information about the transaction.  

 

For maximum visibility, we want to consume the mempool events outside of Mempool Explorer. To do so, we’ll use a webhook to send this information to a Slack channel. Go to Slack’s app directory and choose “Incoming WebHooks.” 

 

 

There’s a great Slack support article here that will walk you through setting up incoming WebHooks. It's very simple and straightforward.

In Mempool Explorer, navigate to your account page by clicking “Account” in the top drop-down menu., Here, you’ll see a list of your API keys, included the one we created called “wmw” or  “watch my wallet”. For this example, click “Add Webhook” on the “wmw” API key.  

 

 

Next you’re going to paste in the Slack webhook URL. In addition to the other information required for authentication (Slack username and password), you must specify the network you want to monitor in Slack. Double check that this detail matches in your saved Mempool Explorer wallet monitoring subscription and the Slack webhook configuration. (For example, if your subscription is monitoring testnet and you select mainnet for your webhook, you won’t see anything in Slack). Finally, click “create” and “save.”

 

Once you do that, you can watch any transactions and receive those events in your chosen Slack channel. 

If you use your Metamask wallet to send some Goerli, as we did in our example above, Mempool Explorer will detect the event and post it to the Slack channel. The event data will be the same whether viewed on Slack or on Mempool Explorer.

 

 

Setting up Webhooks on Discord

Discord webhooks are a little easier to set up. 

To set up webhooks on Discord:

  1. Go to the server settings for any server you admin.
  2. Go to Apps > Integrations > View Webhooks > New Webhooks
  3. Name your webhook and select the channel you want the transaction notifications sent to
  4. Copy the webhook URL and past it into the API under your Mempool Explorer settings just like you did in the Slack example above.
  5. You're all set!

 

Additional Resources

For more information about Mempool Explorer’s documentation and check out the following videos

For a deeper dive on Mempool Explorer, check out this three-part series on the Mempool to build a better foundation. 

Observe Ethereum

Blocknative's proven & powerful enterprise-grade infrastructure makes it easy for builders and traders to work with mempool data.

Visit ethernow.xyz

Want to keep reading?

Good choice! We have more articles.

ethernow-transaction-explorer-now-supports-the-sepolia-testnet
Ethereum

Ethernow Transaction Explorer Now Supports the Sepolia Testnet

Introducing the Ethernow Sepolia Testnet Transaction Explorer The Ethernow Transaction Explorer has..

blobsplaining-part-2:-lessons-from-the-first-eip-4844-congestion-event
Gas

Blobsplaining Part 2: Lessons From The First EIP-4844 Congestion Event

We recently witnessed the first network congestion event post-Dencun with the blobscription craze,..

announcing-degen-support-in-web3-onboard
Web3 Onboard

Announcing Degen Support in Web3 Onboard

Exciting news for the Degen community! We are thrilled to announce that Web3 Onboard has enabled..

Connect with us. Build with us.

We love to connect with teams who are building with Blocknative. Tell us about your team and what you would like to learn.

"After first building our own infrastructure, we appreciate that mempool management is a difficult, expensive problem to solve at scale. That's why we partner with Blocknative to power the transaction notifications in our next-generation wallet."

Schedule a demo