DEV Community

Cover image for Testing Webhooks Locally Just Got Easier
Sean Boult
Sean Boult

Posted on

Testing Webhooks Locally Just Got Easier

Testing webhooks locally has been quite a pain for me.

In the past I've used Cloudflare tunnels to forward real webhook requests to my local server. Despite that approach working it leaves much to be desired from a developer experience standpoint.

Some tools like stripe CLI will give you a better experience for their webhook development but that does not solve all of your webhook needs from different providers.

There is a pretty awesome solution though!
loki

The people from Ping Labs have built a very nice tool for this called webhookthing.

How does it work?

It uses JSON files on your file system to dispatch requests to your server.

Getting started

To get started with webhookthing you just need to create a .thing/hooks directory.

The next step is to create a new file in the .thing/hooks directory, let's say example.json.

{
  "hello": "world"
}
Enter fullscreen mode Exit fullscreen mode

Now you can start webhookthing with npx webhookthing@latest and it will start the web UI and load all of your webhooks.

Image description

Make sure you have your webserver running then dispatch the webhook payload we created by clicking the play button.

Image description

Voilà! We now have a very convenient way to test webhook payloads.

Benefits

  • 🔧 Super simple to configure and maintain
  • 👨‍💻 Version & share the payloads in source control
  • 🌎 No need for internet access to test your webhooks
  • 🎨 Nice UI to manage, test, and execute payloads

If you want to see a demo check out this repo I put together.

Feel free to leave your comments on what you think about the tool and if there is anything I can clarify.

Resources

Top comments (0)