June 09, 2021

How to setup WebHooks with QuickNode

What are WebHooks

In this article, we'll learn about WebHooks and how we can set-up WebHooks with QuickNode.

What are WebHooks?

Everything we do on the internet can be marked/considered as events and as the internet grows, these events grow in numbers. We often require API calls to other apps to get their event's status, which is called polling. In polling we make requests to see if there are any new events. If you do not want to write a script for polling or do not want to run a server 24/7 you can use WebHooks - with WebHooks, we can get notified as soon as a new event is triggered.

WebHook (also known as web callback or HTTP push API) is a way for an application to provide its real-time data to other applications. WebHooks are very efficient as compared to the typical API method where we have to poll frequently.

Example:

Let's say we have a streaming service application and we've set-up Stripe to accept payments. Now whenever a new user makes a payment they need to be added to our user database. So, what we need to do is set-up a WebHook with Stripe, which is configured to send the user information via a WebHook URL as a POST request to our application whenever a user pays via Stripe. Our application after receiving this data adds the user to the user database.

We have made WebHooks available for all QuickNode customers as an Add On.

WebHooks with QuickNode

WebHooks are the best way for server-side apps to send automated messages or information to other server-side apps.

QuickNode WebHooks were created to allow users to bring Web3 smart-contract event listeners to Web2, by handling the discovery and notification of new smart-contract events in real-time. This means users don’t have to run a server 24/7 doing their own polling or WebSocket listening.

How to setup QuickNode WebHooks

Now that we know what WebHooks are and how they can be really helpful, let's set-up one with QuickNode.

Head over to QuickNode.com and make an account.
  1. Click on CREATE NODE.
  2. Choose a plan based on your usage and select your preferred network.
  3. From the "add ons" section add EVENT WEB HOOKS and complete the billing process.
  4. A node with WebHooks add-on will be added to your account under the Nodes tab.

Click on your node and go to WebHooks section from the left menu, you'll see a UI similar to the image below.

Let's set-up a WebHook for a smart-contract event.

The smart-contract we'll use is a URL shortening app deployed on Ethereum Blockchain. We're setting up this WebHook so when someone uses this app to shorten a URL, the WebHook sends the event data. 

  1. The name of our smart-contract is URLShortner which needs to go in the name field.
  2. The address at which our smart-contract is deployed is 0x19624fFa41FE26744E74FDBba77Bef967a222D4c - this needs to go in the contract address field.
  3. The event which we want to watch for is URLShortened, this needs to be entered in the event name field.
  4. Now in the next field, we need to enter the URL to the ABI JSON. 'https://raw.githubusercontent.com/dU4E/0xsu-smart-contracts/master/url_shortener.abi' - this needs to go in the ABI URL field
  5. For the fifth field, we need to enter the URL, where we want our event data to be delivered, 'https://dimaamid.free.beeceptor.com/special-webhook' - this needs to go in the WebHook URL field
  6. After entering all the values click on SAVE WEBHOOK and your WebHook is ready.

Note: Make sure that the ABI file has the event which we want to be notified about configured properly (URLShortened in this example).

After the setup, you must see your WebHook lined up in the WebHooks section



You can check the details by clicking on Details and you'll see the WebHook's details and the attempts, something like this,



You can view the full log of WebHooks sent to you and also the request, response of a particular WebHook attempt by clicking on View details on that particular entry. it'll look something like this:



Conclusion

So, now we know how to set up WebHooks with QuickNode. This WebHooks feature was requested by one of our users and we made it happen, you can always reach out to us if you have a feature request or need any help.

Subscribe to our newsletter for more articles and guide on Ethereum. If you have any feedback, please feel free to reach out to us via Twitter and you can always chat with us if you have a question via our community server on Discord, thanks :)
Ready to try QuickNode? Start your 7-day free trial

Related articles 5

Jun 9, 2021 Look up address balance for a wallet for Bitcoin on QuickNode

If you're running your own bitcoin node (such as bitcoind or bcoin) there is a chance you will want the ability to look up the balance of an address that you do not own. The first time this happens, you might create a

Continue reading
Oct 18, 2021 Intro to EtherFlow

Sending RPC calls to get data is a common standard most blockchains follow. EtherFlow is a tool that makes it easier to send these RPC calls. This guide will explain in depth about EtherFlow, and how it...

Continue reading
Aug 24, 2021 How to setup referrer whitelist with QuickNode

Security is one of the most significant aspects when developing an application. If a resource like a node falls into the hands of an unauthorized individual, it can exhaust your limits and resources. In this guide, we will see how to avoid this and learn how to set up a...

Continue reading
Jun 21, 2021 How to set a custom provider in MetaMask

MetaMask is one of the essential tools for web3 development. It comes set up with Ethereum blockchain networks out of the box. But there can be some specific use cases where you might want to add a custom provider to MetaMask for faster transaction processing or to...

Continue reading
Oct 7, 2021 Look up all NFTs for a given address on an EVM based chain

If you're running your own EVM based chain, such as Ethereum, Polygon, xDAI, BSC, Fantom or Celo there is chance you will want the ability to look up all of the NFTs owned by an address on those chains. The first time this happens, you might create a small script to check...

Continue reading