logo
  • Core Gateway
  • Documentation
  • Blog
  • Pricing
  • About
  • Sign In
    Start your project
Blog
Engineering

How To Debug Your Webhooks With Convoy CLI

3 min read November 09, 2022

Written by

Raymond Tukpe
Raymond Tukpe

CTO

Share

Debugging webhook configuration can be very tedious, many times you are required to plumb together multiple tools to get it to work end to end, the tools include but are not limited to a proxy (e.g. ngrok), an HTTP dump (e.g. webhook.site) and most importantly the service provider’s server which triggers the webhook; which might be Convoy if you are the service provider. We have built tools to bridge that gap by allowing Convoy users and their users (in the case of API companies) debug event headers and payloads. Using our new CLI tools you can test event delivery with ease and in minutes.

Components

We added new components to make this possible which I’ll go into in this section

Stream Server

Convoy ships with a separate stream server which is communicated with using web sockets. This server runs independently of the main Convoy server, it listens on a MongoDB change stream and forwards saved events to registered devices as well as already existing application endpoints. This can be started by running convoy stream, it uses the same configuration file as the main convoy server.

Stream Client

The client is used to communicate with the stream server. It can be used to register applications, listen to events sent in the past or tail events as they come in.

lightbulb iconPro-Tip

Both the stream server and client are in alpha.

Putting it all together

To effectively use these tools you would need to connect your local machine to a Convoy host; the host could be our hosted cloud at https://cli.getconvoy.io, your hosted Convoy stream server instance or a locally hosted stream server instance.

Create a CLI Key

We need to create a CLI key. CLI keys are access tokens that are scoped to one application. They can only be used to authenticate stream client and receive events from the stream server. To create one, go the application’s page and click on the “+” button.

Create CLI Key

Register the app

Copy the generated key and proceed to your terminal to register the application. You can do this by running convoy login.

terminal
$ convoy login --host "https://cli.getconvoy.io" --api-key "API_KEY"

Register the app

Listen for events

To start listening to events we will need to run the listen command, passing the source and host where you want the events to be forwarded to. This will tail events sending them to both our device and the endpoint as they are received by the configured source.

terminal
# only tail events as they come in
$ convoy listen --source="f9116a91-b9d5-4a68-b5b0-75a4c115469a" \
	--forward-to "https://webhook.site/2f1adc9b-1e2b-4809-bd42-3022be6eb3fa" 
lightbulb iconPro-Tip

The source flag is only required for incoming projects.

When listening for events the device is set to active and a subscription is created using the device and source passed to the --source flag. This subscription will not have an endpoint since the events are be delivered to the device.

devices

sources

Dashboard changes

When a device is offline, it won’t be able to receive events, so all it’s event deliveries will be in the discarded state. An icon which is used to denote that an event delivery is meant for a device is also displayed on the dashboard.

Events dashboard showing discarded events

Events dashboard showing discarded events

Replaying missed events

Using the listen command, we can chose to tail events as they come in or fetch past events which were sent while the device was offline. To fetch past events, we can replay all the discarded event deliveries by passing either a date string or a valid ISO date timestamp to the --since flag when running the listen command.

terminal
# replay all discarded events since the last 12 hours
# and tail events as they come in
$ convoy listen --source="f9116a91-b9d5-4a68-b5b0-75a4c115469a" \
	--forward-to "https://webhook.site/2f1adc9b-1e2b-4809-bd42-3022be6eb3fa" \
	--since "12h"

# replay all discarded events since the timestamp
# and tail events as they come in
$ convoy listen --source="f9116a91-b9d5-4a68-b5b0-75a4c115469a" \
	--forward-to "https://webhook.site/2f1adc9b-1e2b-4809-bd42-3022be6eb3fa" \
	--since "2022-10-31"

Running the listen command with —since as a valid ISO timestamp

Running the listen command with —since as a valid ISO timestamp

Running the listen command with —since as a valid time duration string

Running the listen command with —since as a valid time duration string

Conclusion

Using Convoy’s CLI the time taken to debug webhook configurations will be reduced drastically and these benefits are provided to you and your customers out of the box. Sounds good for your platform? Why not try it out for yourself and give us feedback on our slack community!

Getting started with Convoy?

Want to add webhooks to your API in minutes? Sign up to get started.

Sign up

Related Posts

What I’ve learned from talking to users as a Technical Founder

April 23, 2025

It’s widely accepted that the two most important things a startup needs to get right are building a great product and talking to users. As a technical founder, building has always come naturally to me. Talking to users? Not so much. In this post, i’ll share some of the misconceptions I had about talking to users—and the surprising benefits I’ve discovered from doing it consistently.

Subomi Oluwalana
Subomi Oluwalana

Co-Founder & CEO

Transactional Outbox: How to reliably generate webhook events

April 17, 2025

In the world of distributed systems, ensuring reliable event delivery is crucial, especially when dealing with webhooks. The transactional outbox pattern has emerged as a robust solution to this challenge. In this post, we'll explore how to implement this pattern to guarantee reliable webhook delivery, even in the face of system failures.

Subomi Oluwalana
Subomi Oluwalana

Co-Founder & CEO

logo

2261 Market Street, San Francisco, CA 94114

Companyaccordion icon

About Us

Trust Center

Terms of Use

Privacy Policy

DPA

Productaccordion icon

Open Source

Core Gateway

Cloud

Convoy Playground

Resourcesaccordion icon

API Reference

Documentation

Status Page

Roadmap

What are Webhooks?

Convoy vs. Internal Implementation

Speak to usaccordion icon

Slack

Follow Us

Copyright 2025, All Rights Reserved

soc stamp