What Are Webhooks and Why You Should Be Using Them

Webhooks have been around for quite a while now, but surprisingly very few people, other than programmers/developers, know much about them or what they are used for. I am going to attempt to explain that in this article and hopefully you’ll see where your organization can start to take advantage of webhooks. If after reading this article, you’re still not sure what webhooks are or how they can benefit you, please contact me so we can discuss.

You might have seen webhooks mentioned in some of your web apps’ settings and wondered if they’re something you should use. The answer, in a nutshell, is probably yes.

Webhooks are one way that apps can send automated messages or information to other apps. It’s how PayPal tells your application when your clients pay you, or if their credit card was declined, it’s how Twilio routes phone calls to your number, and how WooCommerce can notify you about new online orders in your Slack app.

Webhooks are a simple way your online accounts can “speak” to each other and get notified automatically when something new happens in another app. In many cases, you’ll need to know how to use webhooks if you want to automatically push data from one app to another.

Let’s break it down, learn how to speak webhook, and get your favorite apps to talk to each other.

What Are Webhooks?

There are two ways your apps can communicate with each other to share information: 1. polling and 2. webhooks. Polling is like knocking on your friend’s door and asking if they have any sugar. Maybe they do, maybe they don’t. Webhooks are like someone tossing you a bag of sugar whenever you are running low.

Webhooks are automated messages sent from apps when something happens. They have a message—or payload—and are sent to a unique URL—essentially another app’s address.

They’re much like SMS notifications. Let’s say your bank is set to send you an SMS when you make a purchase over a certain $ amount. You already told the bank your phone number, so they knew where to send the message. They type out “You just spent $500 at NewStore” and send it to your phone number +1-234-567-8900. Something happened at your bank, and you got a message about it. All is now well.

Webhooks work the same way.

Take a  look at our example webhook message below about a new online order that was placed on your estore.

https://yourwebapp.com/data/process.php?Customer=bob&value=10.00&item=paper

Bob visited your websites’ eCommerce store, added $10 of paper to his shopping cart, and checked out. Boom, something happened, and the eCommerce app needs to tell your other app about it. It’s  time for a webhook.

Wait: who’s the eCommerce app going to call? With webhooks, you need to tell the first app—your eCommerce store,—the webhook URL (phone number) of the web app that you want to send the data/message to.

Let’s say you want to make an invoice in your online invoicing system for this new online order. You’d first open your invoice app, make an invoice template, and copy its webhook URL—something like yourwebapp.com/data/process.php. Then open your eCommerce app, and add that URL to its webhook settings for when new orders are placed.

Ok. Back to the order. Your eCommerce store got the order and knows it needs to send the details of the order to yourwebapp.com/data/process.php. It then writes the order in a serialization format. The simplest is form-encoded, and your customer’s order would look something like this:

Customer=bob&value=10.00&item=paper

Now you need to send the message. The simplest way to send data to a webhooks URL is with an HTTP GET request. Literally, that means to add the data to the URL and ping the URL (or enter it in your browser’s address bar). Your apps can send messages to each other by adding extra text after a question mark on the end of a website address. Here’s the full GET request for our order:

https://yourwebapp.com/data/process.php?Customer=bob&value=10.00&item=paper

Deep inside your invoice app, something dings and says “You’ve got mail!” and the app gets to work making a new invoice for Bob’s $10 paper order. That’s webhooks in action.

Remember when you had to check your email to see if you had new messages—and how awesome it was when push email became available? That’s what webhooks are, for your apps. They don’t have to frequently check for new info anymore. Instead, when something happens in an app, that app can push the data to another app and no time is wasted.

There are many possibilities and uses for webhooks for automating your work/life. If you’re still doing things the old way, ie email notifications (copy/paste), or just constantly checking for new information that happens in your apps, there is a better way. Let’s discuss the ways in which you can automate/simplify your work using Webhooks.