Debugging with Ngrok
Confused about "Debugging with Ngrok"?
Let us know how we can improve our documentation:
Ngrok is a tool allows you to expose a port on your local machine to the internet, allowing you to receive and monitor incoming requests from external sources such as webhooks. This makes Ngrok a perfect fit for debugging webhook payloads that come from Stream Chat.
Step 1. Installation
Copied!Confused about "Step 1. Installation"?
Let us know how we can improve our documentation:
Ngrok can be installed on macOS using Homebrew with the following command:
Alternatively, you can download Ngrok from their website at https://ngrok.com/. Once downloaded and unzipped, place the Ngrok executable in your applications
directory (macOS).
Create a symlink using the following commands:
ngrok
command from any directory while in the terminal. Without the symlink, you would need to either cd
into the Applications directory (or wherever you installed the executable) or reference ngrok with its full path every time.Once installed, you can safely move onto the next step.
Step 2. Ngrok Configuration
Copied!Confused about "Step 2. Ngrok Configuration"?
Let us know how we can improve our documentation:
Now that Ngrok is properly installed, we'll need to spin it up on port 80
using the following command:
Once you execute the command listed above, Ngrok will spin up a "forwarding URL" that you can use to specify in the Stream Dashboard. The output of the above command will look like this:
Now that your forwarding URL is available and online, copy the HTTPS
forwarding URL as we will need it in the next step.
Step 3. Dashboard Configuration
Copied!Confused about "Step 3. Dashboard Configuration"?
Let us know how we can improve our documentation:
With your forwarding URL copied, login to your Stream Chat dashboard and scroll down to the webhook section. Activate the webhook and then paste your HTTPS forwarding URL in the webhook URL input . Click save to persist your settings. Your dashboard will now look similar to the image below.
Step 4. Receiving Events
Copied!Confused about "Step 4. Receiving Events"?
Let us know how we can improve our documentation:
One of the many helpful tools that Ngrok provides is a web interface for inspecting incoming payloads. If you reference your terminal, you'll notice that there is a link for the "Web Interface" that runs on a local port – generally port 4040 if available. Navigate to http://localhost:4040
and you will see a dashboard for Ngrok.
Next, fire off an event such as a message from your chat interface to receive and inspect the payload. Once sent, the webhook will forward the payload to your Ngrok server for inspection via a POST request.
Below is an example of the payload for a message: