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!
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"
}
Now you can start webhookthing with npx webhookthing@latest
and it will start the web UI and load all of your webhooks.
Make sure you have your webserver running then dispatch the webhook payload we created by clicking the play button.
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.
Top comments (0)