Tech Blog

Developing a webhook listener locally

In a previous blog post, we showed how to use an online service to test webhook listeners. Since then new technologies have emerged that make developing a webhook listener even easier. One such service is localtunnel. Localtunnel allows you to expose a port on your local development machine to the internet.

As described in the localtunnel help, starting up is simple. After installation, run the following to start listening:

$ npm install -g localtunnel
$ lt --port 8000

After starting, localtunnel will return a random URL such as https://chilly-snake-30.localtunnel.me. That address now exposes the service listening on the specified port on localhost (8000 by default).

For example, if we run the simple Node.js server shown in this gist, we can now configure Alma to send webhooks to this address. Webhook requests from Alma will now be sent to the service listening on your localhost!

Needless to say, this methodology should only be used in development. Strategies for hosting webhook listeners in public cloud services are demonstrated in the webhook blogs.

Leave a Reply