Skip to main content

How to test webhooks locally with ngrok

When Starton sends a notification, Monitor sends an HTTP request to a web server. If your server is actually localhost, the request will fail. Starton cannot actually reach localhost. We need a tool to make that possible. The tool we're using is called ngrok.

Installing ngrok

  1. Go to Ngrok.
  2. Install ngrok on your system.

Launching your ngrok URL

  1. Launch your web application.
  2. Go to your localhost port. For example, http://localhost:3001.
  3. Launch ngrok with the command ngrok http 3001.
  4. Go to your Ngrok Web Interface
  5. Click the Status tab.
  6. Copy the URL of the tunnel which should look like this

Creating your watcher in Starton

You can use this Webhook URL in Starton to create your watcher.

To create a watcher from the code of you application, use the following snippet. You can find the full list of networks and event types in our API reference.

const axios = require("axios");
// First, authenticate to the API
const startonApi = axios.create({
baseURL: "",
headers: {
"x-api-key": "YOUR_API_KEY",
// Use the watcher creation endpoint
name: "Name of your watcher", // Enter a name for your watcher
description: "Describe your watcher", // Enter a description for your watcher
address: "0x000000000000", // Enter the address to watch (either a wallet or a smart contract)
network: "polygon-amoy",// Enter the network of your address.
type: "ADDRESS_ACTIVITY",// Select an event type
webhookUrl: "https://xxxxxxx/", // Here, enter the webhook url you got from ngrok.
confirmationsBlocks: 50 // Depending on your needs, select the number of confirmed blocks before an event triggers your watcher
).then((response) => {

Loubna Benzaama

Lead technical writer


February 26, 2024

Reading time:

2 min

  • Installing ngrok