What's a webhook and how can I can debug it?

A high-level intro to webhooks and troubleshooting tool examples.

What's a webhook and how can I can debug it?
Photo by Brooklyn MacNally / Unsplash

Hoo boy. This is one of those topics that could easily be very lengthy and geeky. I'll try to refrain from going too far off in the weeds here. 😄

In essence, a webhook is a way for one application to "push" info (typically some form of instructions or event data) to another application. It's especially popular in a sub-field of IT/DevOps called "event-driven automation" (where actions/activities are executed on a remote tool/service as a result of something happening).

Confused? OK, let's talk through the high-level process and I think this will make more sense. It's basically a 4-step workflow:

  1. Event Trigger
    Something happens. Examples: An order is placed on an e-commerce web site... A project management task is created... A service is started... etc, etc, etc.
  2. Webhook Trigger
    Now that some external factor or condition has taken place, we need to do something about it. The source application initiates a push action. It's typically a HTTP POST to a remote service/tool via a pre-defined URL.
  3. Data Transfer
    Inside the HTTP POST is a structured piece of data (JSON and XML are the most popular formats but there can be others). Again, this could be any number of things (log data, orchestration instructions, ticket creation, etc).
  4. Target application receives data and "does the thing" 😃
    At this point, the application should have a piece of information and can perform some sort of action/activity based on that.

With me thus far? Cool. So you might be wondering: What's so useful about webhooks anyway? There's a lot of benefits but here are a few, top of mind:

  • Since updates/actions are "pushed", they can (transact) happen faster because they're on-demand.
  • Since it's typically using HTTP/HTTPS as the transport method, it can be highly scalable and high-performing.

OK, so now that we know what webhooks are, how would one go about troubleshooting and "debugging" them? Generally speaking, there are a few options/approaches:

  • If you have direct access to the source application, you can use a debugger with an IDE.
  • If you have direct access to the source application server, you might be able to leverage log files on the originating server (depending on the app and logging capabilities).
  • If none of the options above are feasible, you can try leveraging software or online tools to capture the API request. Examples include:
⚠️
Careful. If you're using any third-party webhook debugging tools, it's best to assume that the data you're sending is not secure. Never send sensitive information/credentials when testing through these types of services.

Interested in learning more? Check out the following "light reading" material:

What is a webhook?
A webhook is an HTTP-based callback function that allows lightweight, event-driven communication between 2 application programming interfaces (APIs). Webhooks are used by a wide variety of web apps to receive small amounts of data from other apps, but webhooks can also be used for event-driven automation and to trigger automation workflows in GitOps environments.
How do I debug a webhook POST?
A webhook is sending me a POST, and I want to do some debugging on it. Currently I’m looping over the array and then sending a mail() to myself instead of printing (because how could I see what’s
Use Webhooks to create external handlers for server events - Power Apps
Learn how to send data about events that occur on the server to a web application using Webhooks.