Skip to main content

Unhook CLI Tool

The Unhook CLI is a powerful command-line interface that enables developers to test webhooks locally without exposing their development environment to the internet.

Overview

The CLI tool provides a seamless way to:
  • Create shareable webhook URLs that route to your local environment
  • Monitor webhook events in real-time
  • Debug webhook payloads and responses
  • Collaborate with team members using shared webhook configurations

Installation

Install the Unhook CLI globally using your preferred package manager:

Quick Start

  1. Initialize your project:
  2. Start listening for webhooks:
  3. Use the generated webhook URL in your provider’s settings:

Core Features

Local Webhook Routing

The CLI creates a secure tunnel that routes incoming webhooks to your local development server:

Real-time Monitoring

Monitor webhook activity directly in your terminal:

Team Collaboration

Share webhook URLs across your team while maintaining individual environments:

Configuration

Configuration File

Create an unhook.yaml file in your project root:

Environment Variables

All CLI options can be set via environment variables:

Command Reference

unhook listen

Start listening for webhook events. Options:
  • --port, -p: Local port to deliver requests to
  • --webhook-id, -t: Webhook ID to use
  • --client-id, -c: Unique client ID for team routing
  • --redirect, -r: Redirect URL instead of local port
  • --debug, -d: Enable debug logging
  • --ping: Health check configuration
Examples:

unhook init

Initialize a new Unhook project. Examples:

unhook status

Check the status of your webhook connection. Examples:

Advanced Features

Health Checks

Configure health checks for your endpoints:

Multiple Destinations

Route different webhook types to different endpoints:

Authentication

Configure API key authentication for private webhooks:

Integration Examples

Stripe Webhooks

GitHub Webhooks

Clerk Authentication

Troubleshooting

Common Issues

  • Check your internet connection
  • Verify the webhook ID is correct
  • Ensure the port is available and not blocked by firewall
  • Clear auth data: rm ~/.unhook/auth-storage.json
  • Re-run initialization: npx @unhook/cli init
  • Verify API key is correct
  • Check webhook URL is correctly configured in provider dashboard
  • Verify webhook is active in Unhook dashboard
  • Enable debug mode: unhook listen --debug

Debug Mode

Enable debug logging for detailed troubleshooting:

Best Practices

  1. Use Client IDs: Always specify a meaningful client ID in team environments
  2. Enable Health Checks: Configure health checks for all endpoints
  3. Use Configuration Files: Keep settings in version control for team consistency
  4. Monitor Logs: Use debug mode when troubleshooting issues
  5. Secure API Keys: Store sensitive information in environment variables

Next Steps