skip to content
A cartoon cactus looking at the 'Astro.build' logo Vinayak Sarawagi
Astro build wallpaper

Localhook - A local webhook testing tool

/ 2 min read

Introduction

Localhook is a simple tool to let you test your webhooks locally. It receives payload then sends them to your locally running application. If your application needs to respond to webhook, you’ll need some way to expose localhost to the internet.

Whether you’re integrating payment gateways, messaging platforms, CRMs, or custom APIs, LocalHook makes it dead simple to simulate live webhook traffic without deploying to the cloud.

πŸš€ Why Use LocalHook?

  • Instant Webhook Tunneling
    • Expose your local development server to the internet securely using a unique, temporary public URL. No need to push or deploy just to test a webhook.
  • Simple, Dev-Centric Workflow
    • Plug it into your webhook source (e.g., Stripe, GitHub, WhatsApp)
    • Subscribe locally to your desired endpoint
    • Test, log, and debug payloads in real time

πŸ›  Example Use Cases

  • Debugging Stripe or Razorpay payment flows
  • Testing WhatsApp message webhooks with local bot logic
  • Building a headless CMS sync pipeline
  • Simulating third-party callbacks in CI/CD

🧰 Tech Stack

  • Built with IntentJS + Redis
  • Uses Server Sent Events for relaying the requests to your localhost.

Getting Started

localhook is accessible via CLI right now, I will add support for webview in the next few releases. To install it, run the following command.

Terminal window
npm i -g localhook

Once installed, verify the installation by running the following command.

Terminal window
localhook --version

You can use localhook CLI to create new webhooks or tunneling the webhook to your local route.

Creating Webhooks

To create a new webhook, run the following command. The command gives you a unique webhook URL which you can add in your application.

Terminal window
localhook new

It will output you a new webhook details.

β„Ή Please configure the following webhook in your application.
βœ” New webhook created: https://lhook.xyz/vBAOv0WFZ5YPlY4
β„Ή You can use the webhook by running the following command:
βœ” localhook -u https://lhook.xyz/vBAOv0WFZ5YPlY4 -r <route> -p <port>

Once this step is done, we are good to subscribe to the webhook now.

Subscribe to the Webhook

We can subscribe to the webhook by simply running the localhook command.

Terminal window
localhook -u webhook_url -r local_route -p port_number

For example, to tunnel the request coming from the webhook to your local route, open a new terminal and run the following command.

Terminal window
localhook -u https://lhook.xyz/BYGwTpBz1DAiGYg -r /payments/hooks -p 5001

It will output like below

Terminal window
β„Ή Forwarding https://lhook.xyz/BYGwTpBz1DAiGYg to http://localhost:5001/payments/hooks
βœ” Connected to https://lhook.xyz/BYGwTpBz1DAiGYg

Once you run this command, all requests that you will receive on https://lhook.xyz/BYGwTpBz1DAiGYg will be routed to your local route.

Reporting Issue

Since, this is the first launch of localhook, so you might encounter some edge cases. Feel free to report the bugs on github.