Skip to main content

Installation

Install the Unhook CLI globally using your preferred package manager:

Quick Start

  1. Initialize your project:
  1. Start the webhook:
  1. Use the generated webhook URL in your provider’s settings:

Core Commands

unhook init

Authenticate with Unhook and set up your project. Creates an unhook.yml config and guides you through connecting your webhook provider.
Examples:

unhook listen

Start the Unhook relay to receive and forward webhooks to your local server. Keeps the CLI running and displays incoming requests.
Examples:

unhook login

Authenticate your CLI with your Unhook account. Opens a browser for login (unless in non-interactive mode).
Examples:

Global Options

Configuration

Configuration File

The CLI uses an unhook.yml file for configuration. This file should be in your project root:

Configuration File Locations

The CLI will look for configuration files in the following order:
  1. unhook.yml (current directory)
  2. unhook.yaml (current directory)
  3. unhook.config.yml (current directory)
  4. unhook.config.yaml (current directory)
  5. unhook.config.js (current directory)
  6. unhook.config.cjs (current directory)
  7. unhook.config.ts (current directory)
  8. unhook.config.json (current directory)

Environment Variables

All configuration options can be set via environment variables:

Interactive UI

The CLI includes an interactive terminal UI that shows:
  • Connection status
  • Webhook activity
  • Error messages
  • Debug information (when enabled)

UI Elements

  • Status Bar: Shows connection status and client ID
  • Activity Log: Real-time webhook request log
  • Debug Panel: Detailed debug information (visible with --verbose)
  • Error Messages: Highlighted in red for visibility
  • Arrow Keys: Navigate through lists and menus
  • Enter: Select items or execute actions
  • ESC: Go back to previous screen
  • q: Quit the application
  • ?: Show keyboard shortcuts

Health Checks

The ping option in your configuration configures connection health monitoring:

Authentication

The CLI supports multiple authentication methods:

Interactive Authentication (Default)

In interactive mode, the CLI uses OAuth browser-based authentication:
  1. Run npx @unhook/cli login or npx @unhook/cli init
  2. A browser window opens for authentication
  3. Complete the OAuth flow in your browser
  4. The CLI automatically receives the authentication token

Non-Interactive Authentication

For CI/CD pipelines, automated scripts, or environments without browser access, use API key authentication: Using API key flag:
Using environment variable:
Using authentication code:
In non-interactive mode, if no API key or authentication code is provided, the CLI will display an error message with instructions on how to authenticate.

Authentication Storage

Authentication data is stored locally at ~/.unhook/auth-storage.json:
  • Authentication state
  • User tokens
  • Organization ID
  • Basic user info
To clear auth data:

Exit Codes

Examples

Basic Development Setup

Team Development

Custom Configuration

Debug Mode

CI/CD and Non-Interactive Usage

Non-interactive mode is automatically enabled when the CI environment variable is set to true, making it seamless for CI/CD pipelines.

Best Practices

  1. Use Configuration Files: Store your settings in unhook.yml for consistency
  2. Enable Debug Logging: Use --verbose when troubleshooting issues
  3. Health Checks: Configure appropriate health checks for your setup
  4. Environment Variables: Use env vars for sensitive information (e.g., UNHOOK_API_KEY)
  5. Team Configuration: Share configuration files in version control
  6. CI/CD Authentication: Use API keys in CI/CD environments instead of browser-based OAuth
  7. Non-Interactive Mode: Use --non-interactive flag or set CI=true for automated environments

Troubleshooting

Common Issues

  1. Connection Issues
    • Check your internet connection
    • Verify the webhook ID is correct
    • Ensure the port is available
  2. Authentication Problems
    • Clear auth data: rm ~/.unhook/auth-storage.json
    • Re-run initialization: npx @unhook/cli init
  3. Configuration Issues
    • Verify YAML syntax in unhook.yml
    • Check file permissions
    • Ensure required fields are present
  4. Debug Mode
    • Enable debug logging: npx @unhook/cli listen --verbose
    • Check the debug panel for detailed information

Getting Help

Support