Installation
Install the Unhook CLI globally using your preferred package manager:Quick Start
- Initialize your project:
- Start the webhook:
- 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.
unhook listen
Start the Unhook relay to receive and forward webhooks to your local server. Keeps the CLI running and displays incoming requests.
unhook login
Authenticate your CLI with your Unhook account. Opens a browser for login (unless in non-interactive mode).
Global Options
| Option | Alias | Description | Default |
|---|---|---|---|
--verbose | -v | Enable verbose debug logging for troubleshooting | false |
--non-interactive | -y | Enable non-interactive mode. Disables browser prompts, interactive forms, and user input. Automatically enabled in CI environments. | false |
--api-key | -k | API key or token for authentication in non-interactive mode. Can also be set via UNHOOK_API_KEY environment variable. | - |
--help | -h | Show help | - |
--version | - | Show version number | - |
Configuration
Configuration File
The CLI uses anunhook.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:unhook.yml(current directory)unhook.yaml(current directory)unhook.config.yml(current directory)unhook.config.yaml(current directory)unhook.config.js(current directory)unhook.config.cjs(current directory)unhook.config.ts(current directory)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
Navigation
- 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
Theping 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:- Run
npx @unhook/cli loginornpx @unhook/cli init - A browser window opens for authentication
- Complete the OAuth flow in your browser
- 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: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
Exit Codes
| Code | Description |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Invalid configuration |
| 3 | Network error |
| 4 | Authentication error |
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
- Use Configuration Files: Store your settings in
unhook.ymlfor consistency - Enable Debug Logging: Use
--verbosewhen troubleshooting issues - Health Checks: Configure appropriate health checks for your setup
- Environment Variables: Use env vars for sensitive information (e.g.,
UNHOOK_API_KEY) - Team Configuration: Share configuration files in version control
- CI/CD Authentication: Use API keys in CI/CD environments instead of browser-based OAuth
- Non-Interactive Mode: Use
--non-interactiveflag or setCI=truefor automated environments
Troubleshooting
Common Issues
-
Connection Issues
- Check your internet connection
- Verify the webhook ID is correct
- Ensure the port is available
-
Authentication Problems
- Clear auth data:
rm ~/.unhook/auth-storage.json - Re-run initialization:
npx @unhook/cli init
- Clear auth data:
-
Configuration Issues
- Verify YAML syntax in
unhook.yml - Check file permissions
- Ensure required fields are present
- Verify YAML syntax in
-
Debug Mode
- Enable debug logging:
npx @unhook/cli listen --verbose - Check the debug panel for detailed information
- Enable debug logging:
Getting Help
- Documentation: docs.unhook.sh
- GitHub Issues: github.com/unhook-sh/unhook/issues
- Discord Community: discord.gg/unhook