Inspecting webhook calls with ngrok

I’ve been experimenting with the Starling Bank developer APIs, which I wrote about in Get access to my bank account using Python….why not?!? and Creating an Alexa skill to read my bank balance.

The next thing on my list to experiment with was creating a webhook and getting this to call an Azure Function to “do something”………which I’m yet to decide exactly what 😀. It’s possible to create a webhook to fire for three specific event types (or any combination of the three) with Starling Bank:

  • Feed Item (for example making a purchase)
  • Standing Order (creating/editing a standing order)
  • Standing Order Payment

Before I started jumping into creating an Azure Function to “do something” based upon a webhook call from my Starling Bank account, I needed to see what these calls look like, so that I could figure out the data I had to play with. This is where I had the bright idea of using ngrok. My theory was that I could publish an endpoint on my local machine, publish this to the Internet and configure the Starling Bank webhook to call this public URL and then inspect the request made. I’ve previously written about ngrok here.

This is how I did it:

Step 1 – Configure ngrok

I downloaded the ngrok agent from here and copied it to my Raspberry Pi (you can also run on Windows, macOS and other variants of Linux).

I also created a free account with ngrok as this unlocks some additional features, this provides an Authtoken to authenticate your ngrok agent.

I then ran the following to register my Authtoken from the directory that ngrok had been copied to (this isn’t my Authtoken BTW)

Once that completed, I then created a tunnel:
ngrok http 80

Once this command had run, it provided the external URLs that the local port (80) has been exposed to (by default it will create HTTP and HTTPS endpoint if the command above is run). It’s then as simple as configuring the webhook to call the HTTPS endpoint that has been exposed.

Step 2 – Configure the Starling Bank Webhook

I logged into my developer account and created the webhook, I called this ngrok and in the Payload URL entered the public endpoint HTTPS exposed by ngrok. I selected Feed Item as I’m only interested in data generated by purchases and then hit Create V2 Webhook.

Step 3 – Create a Transaction

To get the webhook to fire so that I could inspect it using ngrok I needed to spend some money 💷! I headed over to Amazon and bought something using my Starling Bank account.

Step 4 – Inspecting the Webhook Call

I then flipped back over to my Raspberry Pi and launched the Web Interface for ngrok – which by default is

From here I could see the call made by the webhook, this had failed because I didn’t have anything listening on port 80, which is fine – all I wanted was to inspect the webhook call to see the JSON included. Which I could in all its glory:

Now that I know what is included, I’m going to create an Azure Function that the webhook will call (instead of the current ngrok black hole) to do something with the transaction data……I am tempted to “tax” myself when I buy fast food by transferring a percentage of the transaction to a savings “space” within my account. I should be able to use the counterPartyName and amount to do this.

3 thoughts on “Inspecting webhook calls with ngrok

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s