Pavel Evstigneev

@pavelevstigneev

Waithook — Testing WebHooks Behind the Router

Waithook.com was build to ease receiving HTTP notifications in development and testing environments. It uses WebSockets to deliver messages, so it can work behind firewall, network routes and proxy.

Testing HTTP notifications from other services is hard, normally I would setup some SSH tunneling from my computer to remote server or use some public service to do that. And especially hard to make such setup on CI server each time it runs tests. So I came up with idea of a service: clients will connect using WebSocket protocol, my service will receive HTTP requests and send to all subscribers. Think of it as Pub/Sub for HTTP callback. It works great when more then one developers use it at same time or your tests run in parallel, because all subscribers receive all messages.

I find it useful for:

  • Testing integration with payment systems
  • Testing GitHub/GitLab webhooks
  • Testing incoming email processing
  • Testing slack bots
  • Testing facebook webhooks

How to use it

You need to choose your unique prefix, change notification URL in sending service to http://waithook.com/$your_unique_path (the service that will send you HTTP notifications, such as payment system, incoming emails, etc).

It can also send http request to other URL, for example your staging server. To do that, just add ?forward_url=http://example.com in endpoint URL. Example:

http://waithook.com/foobar?forward_url=http://foobar.com/

Then you should open WebSocket connection to waithook.com/foobar, for details you can see online demo or use ruby library waithook-ruby:

gem install waithook
waithook waithook.com/foobar --forward http://localhost:3000/notify

Now you can try sending request to http://waithook.com/foobar and it will send same request to http://localhost:3000/notify Yay!

Waithook is free and open source. I’m making it for fun and using at my work for testing webhook processing from payment systems. In my tests I open new connection every time I expect HTTP callback coming to my system and wait until I got a correct message, in this way I can test a full flow.

I would be glad to hear any feedback from you! Happy coding!

Hacker Noon is how hackers start their afternoons. We’re a part of the @AMIfamily. We are now accepting submissions and happy to discuss advertising &sponsorship opportunities.
To learn more, read our about page, like/message us on Facebook, or simply, tweet/DM @HackerNoon.
If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!

More by Pavel Evstigneev

Topics of interest

More Related Stories